From 99609c7829b5a2737730eb42a3605060edf38161 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:48:07 +0100 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#855) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/pre-commit/pre-commit: v3.7.0 → v3.8.0](https://github.com/pre-commit/pre-commit/compare/v3.7.0...v3.8.0) - [github.com/PyCQA/pylint: v3.1.0 → v3.2.6](https://github.com/PyCQA/pylint/compare/v3.1.0...v3.2.6) - [github.com/PyCQA/flake8: 7.0.0 → 7.1.0](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.0) - [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.11.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.11.0) - [github.com/asottile/pyupgrade: v3.15.2 → v3.17.0](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.17.0) - [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](https://github.com/codespell-project/codespell/compare/v2.2.6...v2.3.0) * fixup tests --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com> --- .pre-commit-config.yaml | 12 ++++++------ tests/tools/test_pylint_works.py | 1 + tests/tools/test_ruff_works.py | 12 ++++++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ee972d99..8eff792f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -8,7 +8,7 @@ repos: - id: trailing-whitespace - id: debug-statements - repo: https://github.com/pre-commit/pre-commit - rev: v3.7.0 + rev: v3.8.0 hooks: - id: validate_manifest - repo: https://github.com/hauntsaninja/black-pre-commit-mirror @@ -17,13 +17,13 @@ repos: hooks: - id: black - repo: https://github.com/PyCQA/pylint - rev: v3.1.0 + rev: v3.2.6 hooks: - id: pylint files: ^(nbqa|tests)/ exclude: ^tests/data/ - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.1.0 hooks: - id: flake8 additional_dependencies: [flake8-typing-imports==1.14.0] @@ -38,13 +38,13 @@ repos: - id: pydocstyle files: ^nbqa/ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.10.0 + rev: v1.11.0 hooks: - id: mypy exclude: ^docs/ additional_dependencies: [types-setuptools, types-toml] - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 + rev: v3.17.0 hooks: - id: pyupgrade args: [--py38-plus] @@ -53,7 +53,7 @@ repos: hooks: - id: auto-walrus - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell files: \.(py|rst|md)$ diff --git a/tests/tools/test_pylint_works.py b/tests/tools/test_pylint_works.py index 513b2838..2c0d5748 100644 --- a/tests/tools/test_pylint_works.py +++ b/tests/tools/test_pylint_works.py @@ -34,6 +34,7 @@ def test_pylint_works(capsys: "CaptureFixture") -> None: f'{notebook1}:cell_4:1:0: C0413: Import "from random import randint" should be placed at the top of the module (wrong-import-position)\n' # noqa: E501 f'{notebook1}:cell_5:1:0: C0413: Import "import pprint" should be placed at the top of the module (wrong-import-position)\n' # noqa: E501 f'{notebook1}:cell_5:2:0: C0413: Import "import sys" should be placed at the top of the module (wrong-import-position)\n' # noqa: E501 + f"{notebook1}:cell_5:9:0: E0606: Possibly using variable 'pretty_print_object' before assignment (possibly-used-before-assignment)\n" # noqa: E501 f'{notebook1}:cell_4:1:0: C0411: standard import "random.randint" should be placed before first party import "nbqa" (wrong-import-order)\n' # noqa: E501 f'{notebook1}:cell_5:1:0: C0411: standard import "pprint" should be placed before first party import "nbqa" (wrong-import-order)\n' # noqa: E501 f'{notebook1}:cell_5:2:0: C0411: standard import "sys" should be placed before first party import "nbqa" (wrong-import-order)\n' # noqa: E501 diff --git a/tests/tools/test_ruff_works.py b/tests/tools/test_ruff_works.py index 4b44b07b..659dc287 100644 --- a/tests/tools/test_ruff_works.py +++ b/tests/tools/test_ruff_works.py @@ -53,9 +53,12 @@ def test_ruff_works( expected_path_2 = os.path.join("tests", "data", "notebook_starting_with_md.ipynb") out, err = capsys.readouterr() + # ignore ruff's suggestions + out = "\n".join([x for x in out.splitlines() if "cell_" in x]) expected_out = ( - "Found 13 errors.\n" - "[*] 10 fixable with the `--fix` option.\n" + f"{expected_path_1}:cell_1:1:8: F401 [*] `os` imported but unused\n" + f"{expected_path_1}:cell_1:3:8: F401 [*] `glob` imported but unused\n" + f"{expected_path_1}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n" f"{expected_path_0}:cell_1:1:8: F401 [*] `os` imported but unused\n" f"{expected_path_0}:cell_1:3:8: F401 [*] `glob` imported but unused\n" f"{expected_path_0}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n" @@ -63,12 +66,9 @@ def test_ruff_works( f"{expected_path_0}:cell_4:1:20: F401 [*] `random.randint` imported but unused\n" f"{expected_path_0}:cell_5:1:1: E402 Module level import not at top of file\n" f"{expected_path_0}:cell_5:2:1: E402 Module level import not at top of file\n" - f"{expected_path_1}:cell_1:1:8: F401 [*] `os` imported but unused\n" - f"{expected_path_1}:cell_1:3:8: F401 [*] `glob` imported but unused\n" - f"{expected_path_1}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n" f"{expected_path_2}:cell_1:1:8: F401 [*] `os` imported but unused\n" f"{expected_path_2}:cell_1:3:8: F401 [*] `glob` imported but unused\n" - f"{expected_path_2}:cell_1:5:8: F401 [*] `nbqa` imported but unused" + f"{expected_path_2}:cell_1:5:8: F401 [*] `nbqa` imported but unused\n" ) assert "\n".join(sorted(out.replace("\r\n", "\n").splitlines())) == "\n".join( sorted(expected_out.splitlines())