GeezerVison is showing github.com — Merge pull request #29762 from dstansby/change-flake8-to-ruff · spha-code/matplotlib@f80038c
File treeExpand file treeCollapse file tree Open diff view settings lib/mpl_toolkits/mplot3d/tests
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .flake8 -91Lines changed: 0 additions & 91 deletions Collapse file Copy file name to clipboardExpand all lines: .github/workflows/reviewdog.yml +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,8 +6,8 @@ permissions: | 6 | 6 | contents: read | 7 | 7 |
| 8 | 8 | jobs: | 9 | | - flake8: | 10 | | - name: flake8 | | 9 | + ruff: | | 10 | + name: ruff | 11 | 11 | runs-on: ubuntu-latest | 12 | 12 | permissions: | 13 | 13 | checks: write | @@ -21,19 +21,19 @@ jobs: | 21 | 21 | with: | 22 | 22 | python-version: '3.10' | 23 | 23 |
| 24 | | - - name: Install flake8 | 25 | | - run: pip3 install -r requirements/testing/flake8.txt | | 24 | + - name: Install ruff | | 25 | + run: pip3 install ruff | 26 | 26 |
| 27 | 27 | - name: Set up reviewdog | 28 | 28 | uses: reviewdog/action-setup@e04ffabe3898a0af8d0fb1af00c188831c4b5893 # v1.3.9 | 29 | 29 |
| 30 | | - - name: Run flake8 | | 30 | + - name: Run ruff | 31 | 31 | env: | 32 | 32 | REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | 33 | 33 | run: | | 34 | 34 | set -o pipefail | 35 | | - flake8 --docstring-convention=all | \ | 36 | | - reviewdog -f=pep8 -name=flake8 \ | | 35 | + ruff check --output-format rdjson | \ | | 36 | + reviewdog -f=rdjson \ | 37 | 37 | -tee -reporter=github-check -filter-mode nofilter | 38 | 38 | mypy: | 39 | 39 | name: mypy | |
Collapse file Copy file name to clipboardExpand all lines: .pre-commit-config.yaml +7-8Lines changed: 7 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -41,15 +41,14 @@ repos: | 41 | 41 | args: ["--config-file=pyproject.toml", "lib/matplotlib"] | 42 | 42 | files: lib/matplotlib # Only run when files in lib/matplotlib are changed. | 43 | 43 | pass_filenames: false | 44 | | - - repo: https://github.com/pycqa/flake8 | 45 | | - rev: 7.1.1 | | 44 | + | | 45 | + - repo: https://github.com/astral-sh/ruff-pre-commit | | 46 | + # Ruff version. | | 47 | + rev: v0.11.0 | 46 | 48 | hooks: | 47 | | - - id: flake8 | 48 | | - additional_dependencies: | 49 | | - - pydocstyle>5.1.0 | 50 | | - - flake8-docstrings>1.4.0 | 51 | | - - flake8-force | 52 | | - args: ["--docstring-convention=all"] | | 49 | + # Run the linter. | | 50 | + - id: ruff | | 51 | + args: [--fix, --show-fixes] | 53 | 52 | - repo: https://github.com/codespell-project/codespell | 54 | 53 | rev: v2.3.0 | 55 | 54 | hooks: | |
Collapse file Copy file name to clipboardExpand all lines: doc/devel/coding_guide.rst +16-10Lines changed: 16 additions & 10 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,22 +15,28 @@ consistency, and maintainability of the code base. | 15 | 15 |
| 16 | 16 | .. _code-style: | 17 | 17 |
| 18 | | -PEP8, as enforced by flake8 | 19 | | -=========================== | | 18 | +PEP8, as enforced by ruff | | 19 | +========================= | 20 | 20 |
| 21 | | -Formatting should follow the recommendations of PEP8_, as enforced by flake8_. | | 21 | +Formatting should follow the recommendations of PEP8_, as enforced by ruff_. | 22 | 22 | Matplotlib modifies PEP8 to extend the maximum line length to 88 | 23 | | -characters. You can check flake8 compliance from the command line with :: | | 23 | +characters. You can check PEP8 compliance from the command line with :: | | 24 | + | | 25 | + python -m pip install ruff | | 26 | + ruff check /path/to/module.py | | 27 | + | | 28 | +or your editor may provide integration with it. To check all files, | | 29 | +and fix any errors in-place (where possible) run :: | | 30 | + | | 31 | + ruff check --fix | 24 | 32 |
| 25 | | - python -m pip install flake8 | 26 | | - flake8 /path/to/module.py | 27 | 33 |
| 28 | | -or your editor may provide integration with it. Note that Matplotlib intentionally | 29 | | -does not use the black_ auto-formatter (1__), in particular due to its inability | 30 | | -to understand the semantics of mathematical expressions (2__, 3__). | | 34 | +Matplotlib intentionally does not use the black_ auto-formatter (1__), | | 35 | +in particular due to its inability to understand the semantics of | | 36 | +mathematical expressions (2__, 3__). | 31 | 37 |
| 32 | 38 | .. _PEP8: https://www.python.org/dev/peps/pep-0008/ | 33 | | -.. _flake8: https://flake8.pycqa.org/ | | 39 | +.. _ruff: https://docs.astral.sh/ruff/ | 34 | 40 | .. _black: https://black.readthedocs.io/ | 35 | 41 | .. __: https://github.com/matplotlib/matplotlib/issues/18796 | 36 | 42 | .. __: https://github.com/psf/black/issues/148 | |
Collapse file Copy file name to clipboardExpand all lines: doc/install/dependencies.rst -3Lines changed: 0 additions & 3 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -346,7 +346,6 @@ otherwise they must be installed manually: | 346 | 346 | - pikepdf_ used in some tests for the pgf and pdf backends | 347 | 347 | - psutil_ used in testing the interactive backends | 348 | 348 | - pytest-cov_ (>= 2.3.1) to collect coverage information | 349 | | -- pytest-flake8_ to test coding standards using flake8_ | 350 | 349 | - pytest-timeout_ to limit runtime in case of stuck tests | 351 | 350 | - pytest-xdist_ to run tests in parallel | 352 | 351 | - pytest-xvfb_ to run tests without windows popping up (Linux) | @@ -373,15 +372,13 @@ them will be skipped by pytest. | 373 | 372 | .. _Ghostscript: https://ghostscript.com/ | 374 | 373 | .. _Inkscape: https://inkscape.org | 375 | 374 | .. _WenQuanYi Zen Hei: http://wenq.org/en/ | 376 | | -.. _flake8: https://pypi.org/project/flake8/ | 377 | 375 | .. _nbconvert: https://pypi.org/project/nbconvert/ | 378 | 376 | .. _nbformat: https://pypi.org/project/nbformat/ | 379 | 377 | .. _pandas: https://pypi.org/project/pandas/ | 380 | 378 | .. _pikepdf: https://pypi.org/project/pikepdf/ | 381 | 379 | .. _psutil: https://pypi.org/project/psutil/ | 382 | 380 | .. _pytz: https://fonts.google.com/noto/use#faq | 383 | 381 | .. _pytest-cov: https://pytest-cov.readthedocs.io/en/latest/ | 384 | | -.. _pytest-flake8: https://pypi.org/project/pytest-flake8/ | 385 | 382 | .. _pytest-timeout: https://pypi.org/project/pytest-timeout/ | 386 | 383 | .. _pytest-xdist: https://pypi.org/project/pytest-xdist/ | 387 | 384 | .. _pytest-xvfb: https://pypi.org/project/pytest-xvfb/ | |
Collapse file Copy file name to clipboardExpand all lines: environment.yml +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -55,8 +55,6 @@ dependencies: | 55 | 55 | # testing | 56 | 56 | - black<24 | 57 | 57 | - coverage | 58 | | - - flake8>=3.8,<7.2 | 59 | | - - flake8-docstrings>=1.4.0 | 60 | 58 | - gtk4 | 61 | 59 | - ipykernel | 62 | 60 | - nbconvert[execute]!=6.0.0,!=6.0.1,!=7.3.0,!=7.3.1 | @@ -72,4 +70,5 @@ dependencies: | 72 | 70 | - pytest-xdist | 73 | 71 | - tornado | 74 | 72 | - pytz | | 73 | + - ruff | 75 | 74 | - tox |
Collapse file Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/tests/test_axes3d.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -2021,7 +2021,7 @@ def test_rotate(style): | 2021 | 2021 |
| 2022 | 2022 | c = np.sqrt(3)/2 | 2023 | 2023 | expectations = { | 2024 | | - ('azel', 0, 1, 0): (0, -45, 0), | | 2024 | + ('azel', 0, 1, 0): (0, -45, 0), | 2025 | 2025 | ('azel', 0, 0, 1): (-45, 0, 0), | 2026 | 2026 | ('azel', 0, 0.5, c): (-38.971143, -22.5, 0), | 2027 | 2027 | ('azel', 0, 2, 0): (0, -90, 0), | |
Collapse file Copy file name to clipboardExpand all lines: pyproject.toml +19Lines changed: 19 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -99,6 +99,10 @@ exclude = [ | 99 | 99 | "tools/gh_api.py", | 100 | 100 | ".tox", | 101 | 101 | ".eggs", | | 102 | + # TODO: fix .pyi files | | 103 | + "*.pyi", | | 104 | + # TODO: fix .ipynb files | | 105 | + "*.ipynb" | 102 | 106 | ] | 103 | 107 | line-length = 88 | 104 | 108 | target-version = "py310" | @@ -112,15 +116,28 @@ ignore = [ | 112 | 116 | "D104", | 113 | 117 | "D105", | 114 | 118 | "D106", | | 119 | + "D107", | 115 | 120 | "D200", | 116 | 121 | "D202", | | 122 | + "D203", | 117 | 123 | "D204", | 118 | 124 | "D205", | | 125 | + "D212", | 119 | 126 | "D301", | 120 | 127 | "D400", | 121 | 128 | "D401", | | 129 | + "D402", | 122 | 130 | "D403", | 123 | 131 | "D404", | | 132 | + "D413", | | 133 | + "D415", | | 134 | + "D416", | | 135 | + "D417", | | 136 | + "E24", | | 137 | + "E266", | | 138 | + "E305", | | 139 | + "E306", | | 140 | + "E721", | 124 | 141 | "E741", | 125 | 142 | "F841", | 126 | 143 | ] | @@ -180,6 +197,7 @@ convention = "numpy" | 180 | 197 | "galleries/examples/user_interfaces/pylab_with_gtk4_sgskip.py" = ["E402"] | 181 | 198 | "galleries/examples/userdemo/pgf_preamble_sgskip.py" = ["E402"] | 182 | 199 |
| | 200 | +"lib/matplotlib/__init__.py" = ["F822"] | 183 | 201 | "lib/matplotlib/_cm.py" = ["E202", "E203"] | 184 | 202 | "lib/matplotlib/_mathtext.py" = ["E221"] | 185 | 203 | "lib/matplotlib/_mathtext_data.py" = ["E203"] | @@ -194,6 +212,7 @@ convention = "numpy" | 194 | 212 | "lib/mpl_toolkits/mplot3d/proj3d.py" = ["E201"] | 195 | 213 |
| 196 | 214 | "galleries/users_explain/artists/paths.py" = ["E402"] | | 215 | +"galleries/users_explain/quick_start.py" = ["E402"] | 197 | 216 | "galleries/users_explain/artists/patheffects_guide.py" = ["E402"] | 198 | 217 | "galleries/users_explain/artists/transforms_tutorial.py" = ["E402", "E501"] | 199 | 218 | "galleries/users_explain/colors/colormaps.py" = ["E501"] | |
Collapse file Copy file name to clipboardExpand all lines: requirements/dev/dev-requirements.txt +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | -r ../doc/doc-requirements.txt | 3 | 3 | -r ../testing/all.txt | 4 | 4 | -r ../testing/extra.txt | 5 | | --r ../testing/flake8.txt | | 5 | +ruff |
Collapse file Copy file name to clipboardExpand all lines: requirements/testing/flake8.txt -9Lines changed: 0 additions & 9 deletions
|