-
-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tox.ini: Add environments ruff
, ruff-minimal
; GH Actions: run ruff-minimal
#37453
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b166c3a
tox.ini, src/tox.ini: New environments ruff, ruff-minimal
mkoeppe be9e5da
src/tox.ini (ruff-minimal): Add --ignore. This is taken from https://…
tobiasdiez 3154f60
src/doc/en/developer/tools.rst: Update for ruff
mkoeppe ab4b330
.github/workflows/lint.yml: Run tox -e ruff-minimal
mkoeppe d25607f
src/ruff.toml: Update according to 'warning: The top-level linter set…
mkoeppe 9be8c40
src/tox.ini (ruff-minimal): Document command to obtain statistics, up…
mkoeppe bfb3842
tox.ini, src/tox.ini: Passenv RUFF_OUTPUT_FORMAT in both rust envs
mkoeppe e41b10c
src/tox.ini: Use 'ruff check' instead of 'ruff' to avoid warning
mkoeppe c97451d
src/tox.ini (ruff-minimal): Order the ignore list in the same way as …
mkoeppe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
## in a virtual environment. | ||
## | ||
[tox] | ||
envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell, rst | ||
envlist = doctest, coverage, startuptime, pycodestyle-minimal, relint, codespell, rst, ruff-minimal | ||
# When adding environments above, also update the delegations in SAGE_ROOT/tox.ini | ||
skipsdist = true | ||
|
||
|
@@ -259,6 +259,66 @@ description = | |
deps = cython-lint | ||
commands = cython-lint --no-pycodestyle {posargs:{toxinidir}/sage/} | ||
|
||
[testenv:ruff] | ||
description = | ||
check against Python style conventions | ||
deps = ruff | ||
passenv = RUFF_OUTPUT_FORMAT | ||
commands = ruff check {posargs:{toxinidir}/sage/} | ||
|
||
[testenv:ruff-minimal] | ||
description = | ||
check against Sage's minimal style conventions | ||
deps = ruff | ||
# https://github.com/ChartBoost/ruff-action/issues/7#issuecomment-1887780308 | ||
passenv = RUFF_OUTPUT_FORMAT | ||
# Output of currently failing, from "./sage -tox -e ruff -- --statistics": | ||
# | ||
# 3579 PLR2004 [ ] Magic value used in comparison, consider replacing `- 0.5` with a constant variable | ||
# 3498 I001 [*] Import block is un-sorted or un-formatted | ||
# 2146 F401 [*] `.PyPolyBoRi.Monomial` imported but unused | ||
# 1964 E741 [ ] Ambiguous variable name: `I` | ||
# 1676 F821 [ ] Undefined name `AA` | ||
# 1513 PLR0912 [ ] Too many branches (102 > 12) | ||
# 1159 PLR0913 [ ] Too many arguments in function definition (10 > 5) | ||
# 815 E402 [ ] Module level import not at top of file | ||
# 671 PLR0915 [ ] Too many statements (100 > 50) | ||
# 483 PLW2901 [ ] Outer `for` loop variable `ext` overwritten by inner `for` loop target | ||
# 433 PLR5501 [*] Use `elif` instead of `else` then `if`, to reduce indentation | ||
# 428 PLR0911 [ ] Too many return statements (10 > 6) | ||
# 404 E731 [*] Do not assign a `lambda` expression, use a `def` | ||
# 351 F405 [ ] `ComplexField` may be undefined, or defined from star imports | ||
# 306 PLR1714 [*] Consider merging multiple comparisons. Use a `set` if the elements are hashable. | ||
# 236 F403 [ ] `from .abelian_gps.all import *` used; unable to detect undefined names | ||
# 116 PLR0402 [*] Use `from matplotlib import cm` in lieu of alias | ||
# 111 PLW0603 [ ] Using the global statement to update `AA_0` is discouraged | ||
# 78 F841 [*] Local variable `B` is assigned to but never used | ||
# 64 E713 [*] Test for membership should be `not in` | ||
# 48 PLW0602 [ ] Using global for `D` but no assignment is done | ||
# 33 PLR1711 [*] Useless `return` statement at end of function | ||
# 24 E714 [*] Test for object identity should be `is not` | ||
# 20 PLR1701 [*] Merge `isinstance` calls | ||
# 17 PLW3301 [ ] Nested `max` calls can be flattened | ||
# 16 PLW1510 [*] `subprocess.run` without explicit `check` argument | ||
# 14 E721 [ ] Do not compare types, use `isinstance()` | ||
# 14 PLW0120 [*] `else` clause on loop without a `break` statement; remove the `else` and dedent its contents | ||
# 12 F811 [*] Redefinition of unused `CompleteDiscreteValuationRings` from line 49 | ||
# 8 PLC0414 [*] Import alias does not rename original package | ||
# 7 E743 [ ] Ambiguous function name: `I` | ||
# 7 PLE0101 [ ] Explicit return in `__init__` | ||
# 7 PLR0124 [ ] Name compared with itself, consider replacing `a == a` | ||
# 5 PLW0127 [ ] Self-assignment of variable `a` | ||
# 4 F541 [*] f-string without any placeholders | ||
# 4 PLW1508 [ ] Invalid type for environment variable default; expected `str` or `None` | ||
# 3 PLC3002 [ ] Lambda expression called directly. Execute the expression inline instead. | ||
# 2 E742 [ ] Ambiguous class name: `I` | ||
# 2 PLE0302 [ ] The special method `__len__` expects 1 parameter, 3 were given | ||
# 2 PLW0129 [ ] Asserting on a non-empty string literal will always pass | ||
# 1 F402 [ ] Import `factor` from line 259 shadowed by loop variable | ||
# 1 PLC0208 [*] Use a sequence type instead of a `set` when iterating over values | ||
# | ||
commands = ruff check --ignore PLR2004,I001,F401,E741,F821,PLR0912,PLR0913,E402,PLR0915,PLW2901,PLR5501,PLR0911,E731,F405,PLR1714,F403,PLR0402,PLW0603,F841,E713,PLW0602,PLR1711,E714,PLR1701,PLW3301,PLW1510,E721,PLW0120,F811,PLC0414,E743,PLE0101,PLR0124,PLW0127,F541,PLW1508,PLC3002,E742,PLE0302,PLW0129,F402,PLC0208 {posargs:{toxinidir}/sage/} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about making the list in line 300 is ordered the same with the list above, for easy maintenance? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, done in c97451d |
||
[flake8] | ||
rst-roles = | ||
# Sphinx | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does
[*]
mean?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tobiasdiez ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the star usually means auto-fixable