Skip to content

Commit 6109784

Browse files
authored
Enable pre-commit (#943)
* Update pre-commit config syntax * CI: run pre-commit * CI: set up pip caching
1 parent 338bfa1 commit 6109784

File tree

5 files changed

+26
-20
lines changed

5 files changed

+26
-20
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
exclude_lines =
33
NotImplemented
44
pragma: no cover
5-
warnings.warn
5+
warnings.warn

.github/workflows/test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
- '*-maint'
1212

1313
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- uses: pre-commit/[email protected]
1419
test:
1520
runs-on: ${{ matrix.os }}
1621
strategy:
@@ -27,9 +32,11 @@ jobs:
2732
path: cldr
2833
key: cldr-${{ hashFiles('scripts/*cldr*') }}
2934
- name: Set up Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@v3
35+
uses: actions/setup-python@v4
3136
with:
3237
python-version: ${{ matrix.python-version }}
38+
cache: "pip"
39+
cache-dependency-path: "**/setup.py"
3340
- name: Install dependencies
3441
run: |
3542
python -m pip install --upgrade pip setuptools wheel

.pre-commit-config.yaml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
- repo: https://github.com/pre-commit/pre-commit-hooks
2-
sha: 97b88d9610bcc03982ddac33caba98bb2b751f5f
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
34
hooks:
4-
- id: autopep8-wrapper
5-
exclude: (docs/conf.py|tests/messages/data/)
6-
- id: check-added-large-files
7-
- id: check-docstring-first
5+
- id: check-added-large-files
6+
- id: check-docstring-first
87
exclude: (docs/conf.py)
9-
- id: check-json
10-
- id: check-yaml
11-
- id: debug-statements
12-
- id: end-of-file-fixer
13-
- id: flake8
14-
exclude: (docs/conf.py|babel/messages/__init__.py|babel/__init__.py|tests/messages/data|scripts/import_cldr.py)
15-
- id: name-tests-test
16-
args: ['--django']
8+
- id: check-json
9+
- id: check-yaml
10+
- id: debug-statements
1711
exclude: (tests/messages/data/)
18-
- id: requirements-txt-fixer
19-
- id: trailing-whitespace
12+
- id: end-of-file-fixer
13+
exclude: (tests/messages/data/)
14+
- id: name-tests-test
15+
args: [ '--django' ]
16+
exclude: (tests/messages/data/)
17+
- id: requirements-txt-fixer
18+
- id: trailing-whitespace

babel/messages/pofile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ def _write_message(message, prefix=''):
575575
# if no sorting possible, leave unsorted.
576576
# (see issue #606)
577577
try:
578-
locations = sorted(message.locations,
578+
locations = sorted(message.locations,
579579
key=lambda x: (x[0], isinstance(x[1], int) and x[1] or -1))
580580
except TypeError: # e.g. "TypeError: unorderable types: NoneType() < int()"
581581
locations = message.locations

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Get the git checkout in a new virtualenv and run in development mode::
8686
Finished processing dependencies for Babel
8787

8888
Make sure to not forget about the ``pip install pytz`` and ``import_cldr`` steps
89-
because otherwise you will be missing the locale data.
89+
because otherwise you will be missing the locale data.
9090
The custom setup command will download the most appropriate CLDR release from the
9191
official website and convert it for Babel but will not work without ``pytz``.
9292

0 commit comments

Comments
 (0)