Skip to content

Commit

Permalink
ci(ruff): Enforce a lower C901 limit
Browse files Browse the repository at this point in the history
https://docs.astral.sh/ruff/settings/#lint_mccabe_max-complexity
Previously 18, the default is 10.

As this rule was not in `[tool.ruff.lint.select]`, it was not used.

Setting such a high limit hides opportunities to simplify large, complex functions.
Many cases were resolved/improved in vega#3431.
The remainder can use the *# noqa: C901* comment to serve as a TODO
  • Loading branch information
dangotbanned committed Aug 9, 2024
1 parent f0c1e0a commit 2aa7797
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ select = [
"ANN",
# unsorted-imports
"I001",
# complex-structure
"C901",
]
ignore = [
# Whitespace before ':'
Expand Down Expand Up @@ -360,7 +362,7 @@ ignore = [
]
# https://docs.astral.sh/ruff/settings/#lintpydocstyle
pydocstyle={ convention="numpy" }
mccabe={ max-complexity=18 }
mccabe={ max-complexity=10 }

[tool.ruff.lint.isort]
classes = ["expr", "datum"]
Expand All @@ -386,6 +388,7 @@ See https://github.com/vega/altair/pull/3449
[tool.ruff.lint.per-file-ignores]
# Only enforce type annotation rules on public api
"!altair/vegalite/v5/api.py" = ["ANN"]
"tests/**/*.py"= ["C901"]


[tool.ruff.format]
Expand Down

0 comments on commit 2aa7797

Please sign in to comment.