36 lines
1.7 KiB
TOML
36 lines
1.7 KiB
TOML
[tool.ruff]
|
|
line-length = 120
|
|
target-version = "py311"
|
|
|
|
[tool.ruff.lint]
|
|
select = ["E", "F", "I", "W"]
|
|
ignore = [
|
|
"E501", # symbolic-math expressions routinely exceed a "normal" line length
|
|
]
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
# *.sage.py is generated by `sage --preparse` from *.sage sources.
|
|
# - F403/F405/F821/E741: Sage's runtime injects hundreds of globals (ZZ, var,
|
|
# matrix, LatticePolytope, ...) via `from sage.all import *` before
|
|
# executing these files, so plain static analysis can't see where names
|
|
# come from.
|
|
# - E402/E702/I001: Sage's preparser itself emits an import-then-semicolon-
|
|
# joined-constants preamble (e.g. `_sage_const_1 = Integer(1); ...`) ahead
|
|
# of the file's own imports; that's Sage's boilerplate, not this project's
|
|
# code style.
|
|
# - W291/W293: the preparser replaces every integer literal with
|
|
# `_sage_const_N ` (trailing space included) to preserve token boundaries,
|
|
# so trailing-whitespace warnings fire mechanically on almost every line
|
|
# with a number in it -- not something `ruff format` could fix anyway,
|
|
# since it wouldn't change the .sage source that generated it.
|
|
# - W292: whether the reconstructed file ends in a real trailing newline
|
|
# depends on how many blank lines the preparser appends, which varies by
|
|
# Sage version -- not something worth pinning tool versions over.
|
|
"*.sage.py" = ["F403", "F405", "F821", "E741", "E402", "E702", "I001", "W291", "W293", "W292"]
|
|
|
|
# tests/test_smoke.py does `from sage.all import *` and `load(...)` a .sage
|
|
# file to get at its classes -- the same dynamic-namespace situation as
|
|
# *.sage.py above, just in a hand-written file: ruff can't see that
|
|
# Polytope/ToricPolytope/etc. come from the loaded file.
|
|
"tests/test_smoke.py" = ["F403", "F405"]
|