]> git.ipfire.org Git - thirdparty/babel.git/commitdiff
Enable pre-commit (#943)
authorAarni Koskela <akx@iki.fi>
Wed, 11 Jan 2023 08:42:08 +0000 (10:42 +0200)
committerGitHub <noreply@github.com>
Wed, 11 Jan 2023 08:42:08 +0000 (10:42 +0200)
* Update pre-commit config syntax

* CI: run pre-commit

* CI: set up pip caching

.coveragerc
.github/workflows/test.yml
.pre-commit-config.yaml
babel/messages/pofile.py
docs/installation.rst

index a3d8ae65ee2729294f11dc03ff71d051b64204e0..f98d8023f96e2100a2a7ef1c752297881046ccdd 100644 (file)
@@ -2,4 +2,4 @@
 exclude_lines =
     NotImplemented
     pragma: no cover
-    warnings.warn
\ No newline at end of file
+    warnings.warn
index f9a7bee0b9e3615ed7b12d96b50656a27bec093d..1e89861792a26c10764610898877e2473b012933 100644 (file)
@@ -11,6 +11,11 @@ on:
       - '*-maint'
 
 jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: pre-commit/action@v3.0.0
   test:
     runs-on: ${{ matrix.os }}
     strategy:
@@ -27,9 +32,11 @@ jobs:
         path: cldr
         key: cldr-${{ hashFiles('scripts/*cldr*') }}
     - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v3
+      uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
+        cache: "pip"
+        cache-dependency-path: "**/setup.py"
     - name: Install dependencies
       run: |
         python -m pip install --upgrade pip setuptools wheel
index 0a345cee90481415e7123b0c4756c51b8620ae7f..b61dac46b6d979aef61d0e292d28085a571f96c9 100644 (file)
@@ -1,19 +1,18 @@
--   repo: https://github.com/pre-commit/pre-commit-hooks
-    sha: 97b88d9610bcc03982ddac33caba98bb2b751f5f
+repos:
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.4.0
     hooks:
-    -   id: autopep8-wrapper
-        exclude: (docs/conf.py|tests/messages/data/)
-    -   id: check-added-large-files
-    -   id: check-docstring-first
+      - id: check-added-large-files
+      - id: check-docstring-first
         exclude: (docs/conf.py)
-    -   id: check-json
-    -   id: check-yaml
-    -   id: debug-statements
-    -   id: end-of-file-fixer
-    -   id: flake8
-        exclude: (docs/conf.py|babel/messages/__init__.py|babel/__init__.py|tests/messages/data|scripts/import_cldr.py)
-    -   id: name-tests-test
-        args: ['--django']
+      - id: check-json
+      - id: check-yaml
+      - id: debug-statements
         exclude: (tests/messages/data/)
-    -   id: requirements-txt-fixer
-    -   id: trailing-whitespace
+      - id: end-of-file-fixer
+        exclude: (tests/messages/data/)
+      - id: name-tests-test
+        args: [ '--django' ]
+        exclude: (tests/messages/data/)
+      - id: requirements-txt-fixer
+      - id: trailing-whitespace
index a213b2237920904c4ff3395744d3d604f42f022b..b366ccb44e263bc9790bacfe80be5f0a2796eb95 100644 (file)
@@ -575,7 +575,7 @@ def write_po(fileobj, catalog, width=76, no_location=False, omit_header=False,
             # if no sorting possible, leave unsorted.
             # (see issue #606)
             try:
-                locations = sorted(message.locations, 
+                locations = sorted(message.locations,
                                    key=lambda x: (x[0], isinstance(x[1], int) and x[1] or -1))
             except TypeError:  # e.g. "TypeError: unorderable types: NoneType() < int()"
                 locations = message.locations
index c1b7ab9fe633591989ff79597de95c3606b58e5a..26fe23a470e4ae163f1604f0b1e5c512960acd60 100644 (file)
@@ -86,7 +86,7 @@ Get the git checkout in a new virtualenv and run in development mode::
     Finished processing dependencies for Babel
 
 Make sure to not forget about the ``pip install pytz`` and ``import_cldr`` steps
-because otherwise you will be missing the locale data.  
+because otherwise you will be missing the locale data.
 The custom setup command will download the most appropriate CLDR release from the
 official website and convert it for Babel but will not work without ``pytz``.