Skip to content

Commit 038f6ff

Browse files
committed
Remove line-length from checks, new pre-commit checks instead
1 parent 9cc7660 commit 038f6ff

File tree

5 files changed

+90
-66
lines changed

5 files changed

+90
-66
lines changed

.github/workflows/build.yml

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
name: Tests
2-
32
on:
43
workflow_dispatch:
54
push:
65
branches:
7-
- '**'
6+
- "**"
87
pull_request:
98
branches:
10-
- '**'
9+
- "**"
1110

1211
jobs:
1312
checks:
13+
# Using matrix-tool strategy in case we want to add more tools in the future
1414
strategy:
1515
matrix:
1616
tool:
1717
- name: sphinx-lint
1818
package: sphinx-lint
19-
command: 'sphinx-lint --enable default-role --ignore .git'
20-
- name: Line length
21-
command: 'awk ''{if (length($0) > 80 && length(gensub(/[^ ]/, "", "g")) > 1) {print FILENAME ":" FNR, "line too long:", $0; ERRORS+=1}} END {if (ERRORS>0) {exit 1}}'' $CHANGED_PO_FILES'
19+
command: "sphinx-lint --enable default-role --ignore .git"
2220

2321
name: ${{ matrix.tool.name }} (${{ matrix.tool.package }})
2422
runs-on: ubuntu-latest
@@ -30,7 +28,7 @@ jobs:
3028
token: ${{ secrets.GITHUB_TOKEN }}
3129
- uses: actions/setup-python@v4
3230
with:
33-
python-version: '3.11'
31+
python-version: "3.11"
3432
- name: Install ${{ matrix.tool.package }}
3533
run: |
3634
if [ -n "${{ matrix.tool.apt_dependencies }}" ]; then
@@ -57,14 +55,14 @@ jobs:
5755
fi
5856
5957
sphinx:
60-
name: 'Generate docs (sphinx)'
58+
name: "Generate docs (sphinx)"
6159
runs-on: ubuntu-latest
6260
timeout-minutes: 30
6361
steps:
6462
- uses: actions/checkout@v3
6563
- uses: actions/setup-python@v4
6664
with:
67-
python-version: '3.11'
65+
python-version: "3.11"
6866
- name: Prepare environment
6967
run: |
7068
pwd

.github/workflows/gh-pages.yml

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Build and Deploy to GitHub Pages
2-
32
on:
43
push:
54
branches:
6-
- '3.11'
5+
- "3.11"
76

87
jobs:
98
sphinx-lint:
@@ -15,22 +14,22 @@ jobs:
1514
token: ${{ secrets.GITHUB_TOKEN }}
1615
- uses: actions/setup-python@v4
1716
with:
18-
python-version: '3.11'
17+
python-version: "3.11"
1918
- name: Install sphinx-lint
2019
run: python -m pip install --upgrade sphinx-lint
2120
- name: Run sphinx-lint
22-
run: 'sphinx-lint --enable default-role --ignore .git'
21+
run: "sphinx-lint --enable default-role --ignore .git"
2322

2423
deploy:
25-
name: 'Generate docs and deploy to GitHub Pages'
24+
name: "Generate docs and deploy to GitHub Pages"
2625
runs-on: ubuntu-latest
2726
needs: sphinx-lint
2827
timeout-minutes: 30
2928
steps:
3029
- uses: actions/checkout@v3
3130
- uses: actions/setup-python@v4
3231
with:
33-
python-version: '3.11'
32+
python-version: "3.11"
3433
- name: Prepare environment
3534
run: |
3635
git clone https://github.com/python/cpython.git venv/cpython/
@@ -45,5 +44,5 @@ jobs:
4544
publish_dir: ./venv/cpython/Doc/build/html
4645
publish_branch: gh-pages
4746
allow_empty_commit: true
48-
user_name: 'github-actions[bot]'
49-
user_email: 'github-actions[bot]@users.noreply.github.com'
47+
user_name: "github-actions[bot]"
48+
user_email: "github-actions[bot]@users.noreply.github.com"

.github/workflows/update_doc.yml

+38-38
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,47 @@ name: Update Doc
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: '0 0 1 * *'
5+
- cron: "0 0 1 * *"
66

77
jobs:
88
create_pr:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v3
13-
14-
- name: Clone CPython Repo
15-
run: git clone https://github.com/python/cpython venv/cpython
16-
17-
- name: Set Up Python 3.11
18-
uses: actions/setup-python@v4
19-
with:
20-
python-version: "3.11"
21-
22-
- name: Install dependencies
23-
run: pip install -r requirements.txt && sudo apt install gettext -y
24-
25-
- name: Run merge.py
26-
run: python merge.py ${GITHUB_REF##*/}
27-
28-
- name: Commit changes
29-
run: |
30-
git config --local user.email "python.docs.tr@gmail.com"
31-
git config --local user.name "python-docs-turkish"
32-
git commit -m "Get changes from CPython Doc for ${{ github.ref_name }}"
33-
34-
- name: Create Pull Request
35-
uses: peter-evans/create-pull-request@v4.2.3
36-
with:
37-
token: ${{ secrets.BOT_PAT }}
38-
commit-message: Get changes from CPython Doc for ${{ github.ref_name }}
39-
author: python-docs-turkish <python.docs.tr@gmail.com>
40-
committer: python-docs-turkish <python.docs.tr@gmail.com>
41-
branch: translation-update-${{ github.ref_name }}
42-
delete-branch: true
43-
title: Translation Update ${{ github.ref_name }}
44-
body: There are some changes, don't forget to translate them!
45-
labels: update
46-
reviewers: |
47-
egeakman
48-
ardasak
12+
- uses: actions/checkout@v3
13+
14+
- name: Clone CPython Repo
15+
run: git clone https://github.com/python/cpython venv/cpython
16+
17+
- name: Set Up Python 3.11
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.11"
21+
22+
- name: Install dependencies
23+
run: pip install -r requirements.txt && sudo apt install gettext -y
24+
25+
- name: Run merge.py
26+
run: python merge.py ${GITHUB_REF##*/}
27+
28+
- name: Commit changes
29+
run: |
30+
git config --local user.email "python.docs.tr@gmail.com"
31+
git config --local user.name "python-docs-turkish"
32+
git commit -m "Get changes from CPython Doc for ${{ github.ref_name }}"
33+
34+
- name: Create Pull Request
35+
uses: peter-evans/create-pull-request@v4.2.3
36+
with:
37+
token: ${{ secrets.BOT_PAT }}
38+
commit-message: Get changes from CPython Doc for ${{ github.ref_name }}
39+
author: python-docs-turkish <python.docs.tr@gmail.com>
40+
committer: python-docs-turkish <python.docs.tr@gmail.com>
41+
branch: translation-update-${{ github.ref_name }}
42+
delete-branch: true
43+
title: Translation Update ${{ github.ref_name }}
44+
body: There are some changes, don't forget to translate them!
45+
labels: update
46+
reviewers: |
47+
egeakman
48+
ardasak

.github/workflows/wrap_branch.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
name: "Wrap All"
2-
32
on:
43
workflow_dispatch:
54
schedule:
6-
- cron: '0 0 15 * *'
5+
- cron: "0 0 15 * *"
76

8-
jobs:
7+
jobs:
98
wrap:
109
runs-on: ubuntu-latest
1110
steps:
@@ -34,13 +33,13 @@ jobs:
3433
uses: peter-evans/create-pull-request@v4.2.3
3534
with:
3635
token: ${{ secrets.BOT_PAT }}
37-
commit-message: 'Wrap all files on: ${{ github.ref_name }}'
36+
commit-message: "Wrap all files on: ${{ github.ref_name }}"
3837
branch: ${{ github.ref_name }}-wrapped
3938
delete-branch: true
4039
committer: python-docs-turkish <python.docs.tr@gmail.com>
4140
author: python-docs-turkish <python.docs.tr@gmail.com>
42-
title: 'Wrap branch: ${{ github.ref_name }}'
43-
body: 'Wrapped all files on branch: ${{ github.ref_name }}.'
41+
title: "Wrap branch: ${{ github.ref_name }}"
42+
body: "Wrapped all files on branch: ${{ github.ref_name }}."
4443
labels: wrap
4544
reviewers: |
4645
egeakman

.pre-commit-config.yaml

+33-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,37 @@
11
repos:
2-
- repo: local
2+
- repo: local
33
hooks:
4-
- id: lint
5-
name: Run sphinx linting
4+
- id: lint
5+
name: Run sphinx-lint on .po files
66
entry: sphinx-lint
77
language: python
8-
additional_dependencies: ['sphinx-lint==0.6.7']
9-
files: \.po$
8+
additional_dependencies: ["sphinx-lint"]
9+
files: \.po$
10+
11+
- id: wrap
12+
name: Run powrap on .po files
13+
entry: powrap
14+
language: python
15+
additional_dependencies: ["powrap"]
16+
files: \.po$
17+
18+
- repo: https://github.com/psf/black
19+
rev: 23.1.0
20+
hooks:
21+
- id: black
22+
name: Run black on Python files
23+
args: ["--line-length=140", "--target-version=py311"]
24+
files: \.py$
25+
26+
- repo: https://github.com/pre-commit/pre-commit-hooks
27+
rev: v4.4.0
28+
hooks:
29+
- id: end-of-file-fixer
30+
- id: trailing-whitespace
31+
32+
- repo: https://github.com/pre-commit/mirrors-prettier
33+
rev: v2.7.1
34+
hooks:
35+
- id: prettier
36+
name: Run prettier on .yml and .yaml files
37+
types: [yaml]

0 commit comments

Comments
 (0)