From edf860a8da59082ed450edf1bfefd71b567fd0ac Mon Sep 17 00:00:00 2001 From: Anton Agestam Date: Mon, 30 Jan 2023 13:01:18 +0100 Subject: [PATCH] fix: Bump pre-commit hooks to fix isort issue CI is broken on main due to this isort issue, the root cause lies in an underlying incompatible change in Poetry. The new version of isort has dropped support for Python 3.7 so we bump CI to run on 3.11 instead (3.7 is EOL later this year anyway). https://github.com/PyCQA/isort/issues/2083 With the upgrade to flake8 6, we ran into an issue with comments in the configuration file. Those comments are moved to their own lines above the config instead, see issue below. https://github.com/PyCQA/flake8/issues/1756 Because of installation issues in the lint step, installation is altered to only installed pre-commit which handles its own dependencies anyway. --- .flake8 | 12 ++++++++---- .github/workflows/lint.yml | 6 +++--- .pre-commit-config.yaml | 8 ++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/.flake8 b/.flake8 index 71bc31f7b..ce13ab625 100644 --- a/.flake8 +++ b/.flake8 @@ -3,8 +3,12 @@ max-line-length = 125 # E203,W503: incompatibilities with black # E722: also signaled by pylint (disabling here globally and on case-by-case basis with pylint) +# E501: line length +# E203: whitespace before ':' +# W503: line break before binary operator +# E722: do not use bare 'except' ignore = - E501, # line length - E203, # whitespace before ':' - W503, # line break before binary operator - E722, # do not use bare 'except' + E501, + E203, + W503, + E722, diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ed7a78b48..10b97e931 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,13 +13,13 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.7 + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.11 - name: Install dependencies - run: pip install -r requirements-dev.txt + run: pip install 'pre-commit>=2.2.0' # required for pylint - name: Generate version.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 658a96b8e..5705da742 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ minimum_pre_commit_version: 2.9.2 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.1.0 + rev: v4.4.0 hooks: - id: trailing-whitespace exclude: ^vendor/|^tests/.*/fixtures/.*|^tests/integration/test_data/.* @@ -11,18 +11,18 @@ repos: - id: debug-statements - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.12.0 hooks: - id: isort name: isort (python) - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 6.0.0 hooks: - id: flake8