Skip to content

Commit 42c0a4d

Browse files
Add pre-commit (#146)
This commit includes fixing all existing infractions.
1 parent b432562 commit 42c0a4d

18 files changed

+179
-120
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ updates:
88
- "rffontenelle"
99
commit-message:
1010
prefix: "gha"
11-
11+
1212
- package-ecosystem: "pip"
1313
directory: "/"
1414
schedule:

.github/workflows/ci.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
concurrency:
3030
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
3131
cancel-in-progress: true
32-
32+
3333
env:
3434
TX_CLI_VERSION: '1.6.16'
3535
TX_PROJECT: python-newest # Project name for the latest python version
@@ -67,13 +67,13 @@ jobs:
6767
echo "all_versions=$(scripts/manage_versions.py all)" >> $GITHUB_OUTPUT
6868
echo "current=$(scripts/manage_versions.py current)" >> $GITHUB_OUTPUT
6969
echo "version_pairs=$(scripts/manage_versions.py generate_pairs)" >> $GITHUB_OUTPUT
70-
70+
7171
- name: Check out branch ${{ steps.version.outputs.current }}
7272
uses: actions/[email protected]
7373
with:
74-
ref: ${{ steps.version.outputs.current }}
74+
ref: ${{ steps.version.outputs.current }}
7575
path: ${{ steps.version.outputs.current }}
76-
76+
7777
- name: Set languages variable
7878
id: languages
7979
working-directory: ${{ steps.version.outputs.current }}
@@ -158,7 +158,7 @@ jobs:
158158
run: |
159159
deleted_files=$(git status -s | grep ^' D' | cut -d' ' -f3)
160160
if [ -n "$deleted_files" ]; then git rm -v $deleted_files; else echo "no POT files to remove"; fi
161-
161+
162162
- name: Remove problematic source messages from POT files
163163
run: |
164164
scripts/remove-msgid.sh cpython/Doc/locales/pot
@@ -237,19 +237,19 @@ jobs:
237237
steps:
238238
- name: Check out main
239239
uses: actions/[email protected]
240-
240+
241241
- name: Check out branch ${{ matrix.branch.new }}
242242
uses: actions/[email protected]
243243
with:
244244
ref: ${{ matrix.branch.new }}
245245
path: ${{ matrix.branch.new }}
246-
246+
247247
- name: Check out branch ${{ matrix.branch.prev }}
248248
uses: actions/[email protected]
249249
with:
250250
ref: ${{ matrix.branch.prev }}
251251
path: ${{ matrix.branch.prev }}
252-
252+
253253
- name: Set up Python 3
254254
uses: actions/[email protected]
255255
with:
@@ -262,7 +262,7 @@ jobs:
262262
working-directory: /usr/local/bin
263263
run: |
264264
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash -s -- v${{ env.TX_CLI_VERSION }}
265-
265+
266266
- name: Install dependencies
267267
run: |
268268
python3 -m pip install --upgrade pip
@@ -285,4 +285,3 @@ jobs:
285285
tx push -t -l ${{ matrix.language }}
286286
env:
287287
TX_TOKEN: ${{ secrets.TX_TOKEN }}
288-

.github/workflows/documentation-links.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ concurrency:
1414

1515
permissions:
1616
pull-requests: write
17-
17+
1818
jobs:
1919
documentation-links:
2020
runs-on: ubuntu-latest

.github/workflows/updpyver.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
run: |
4949
scripts/manage_versions.py update_versions_file
5050
51-
- name: Commit changes to a new branch
51+
- name: Commit changes to a new branch
5252
if: ${{ success() && !contains(fromJSON('["push", "pull_request"]'), github.event_name) }}
5353
uses: devops-infra/[email protected]
5454
with:
@@ -58,7 +58,7 @@ jobs:
5858
force: false
5959
target_branch: update/version
6060

61-
- name: Create pull request
61+
- name: Create pull request
6262
if: ${{ success() && !contains(fromJSON('["push", "pull_request"]'), github.event_name) }}
6363
uses: devops-infra/[email protected]
6464
with:

.pre-commit-config.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.11.4
4+
hooks:
5+
- id: ruff
6+
args: [--fix, --exit-non-zero-on-fix]
7+
- id: ruff-format
8+
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v5.0.0
11+
hooks:
12+
- id: check-added-large-files
13+
- id: check-case-conflict
14+
- id: check-merge-conflict
15+
- id: check-yaml
16+
- id: debug-statements
17+
- id: end-of-file-fixer
18+
- id: forbid-submodules
19+
- id: trailing-whitespace
20+
21+
- repo: https://github.com/python-jsonschema/check-jsonschema
22+
rev: 0.32.1
23+
hooks:
24+
- id: check-github-workflows
25+
26+
- repo: https://github.com/rhysd/actionlint
27+
rev: v1.7.7
28+
hooks:
29+
- id: actionlint
30+
31+
- repo: meta
32+
hooks:
33+
- id: check-hooks-apply
34+
- id: check-useless-excludes

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ sphinx:
1919
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
2020
python:
2121
install:
22-
- requirements: docs/requirements.txt
22+
- requirements: docs/requirements.txt

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ For information about translating on transifex for both users and maintainers se
1313
.. _python-doc: https://app.transifex.com/python-doc/
1414
.. _Transifex: https://www.transifex.com
1515
.. _translation: https://devguide.python.org/documentation/translating/
16-

docs/conf.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@
66
# -- Project information -----------------------------------------------------
77
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
88

9-
project = 'Python Docs Transifex Automations'
10-
copyright = '2025, rffontenelle'
11-
author = 'rffontenelle'
9+
project = "Python Docs Transifex Automations"
10+
copyright = "2025, rffontenelle"
11+
author = "rffontenelle"
1212

1313
# -- General configuration ---------------------------------------------------
1414
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
1515

1616
extensions = []
1717

18-
templates_path = ['_templates']
18+
templates_path = ["_templates"]
1919
exclude_patterns = []
2020

2121
# -- Options for HTML output -------------------------------------------------
2222
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
2323

24-
html_theme = 'furo'
25-
html_static_path = ['_static']
26-
html_title = 'Python Docs Transifex Automations'
24+
html_theme = "furo"
25+
html_static_path = ["_static"]
26+
html_title = "Python Docs Transifex Automations"
2727

2828
# ----------------------------------------------------------------------------
2929

3030
# Python versions
31-
newest = '3.13'
32-
previous = '3.12'
31+
newest = "3.13"
32+
previous = "3.12"
3333

3434
rst_prolog = f"""
3535
.. |py_new| replace:: {newest}

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,3 @@ See also Translating_ in the Python Developer's Guide for more information.
4141
bumping-relsease.rst
4242
commands.rst
4343
placeholders.rst
44-

docs/placeholders.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Some notes:
1616
of place holders, and will be rendered as normal text.
1717
- The roles :dfn: and :term: were not included because their content are normally translatable, so making them
1818
placeholders would pop up too many false-positive warnings.
19-
- \``$\`` is being wrongly replaced with the placeholder ```{TX-PL-LABEL}#x60;``` by Transifex because of the
19+
- \``$\`` is being wrongly replaced with the placeholder ```{TX-PL-LABEL}#x60;``` by Transifex because of the
2020
custom placeholder that starts and ends with \``. Removing this custom placeholder ceases the issue, but it
2121
disables custom placeholders for all literal expressions.
2222

@@ -76,7 +76,7 @@ Note that the commands sort by alphabetic order ``sort -u``, but it could be sor
7676
1. To list two-part roles (e.g. ``:c:func:` ``)::
7777

7878
.. code-block:: shell
79-
79+
8080
grep -Po '(^|\s+):([\w\-\_\~!]*:){2}`' strings.txt | sed -E 's|^ +||;' | tr '[:upper:]' '[:lower:]' | sort -u
8181
8282
2. To list one-part roles (e.g. ``:class:` ``):

0 commit comments

Comments
 (0)