chore(project): adopt the recommended ruff thresholds and enforce them in CI#74
Merged
devill merged 1 commit intoJul 6, 2026
Conversation
…m in CI habit-hooks recommends max-complexity=10, max-args=3, max-statements=12 (the python plugin's ruff.toml) but did not apply them to its own code. Add them to the project's own ruff config and lint src in CI so the project follows its own recommendation. extend-select enables C901/PLR0913/PLR0915; without it the thresholds are inert. The CI step is scoped to src because a repo-wide `ruff check .` currently fails: ruff tries to parse the python plugin's sensor ruff.toml (a sensor definition, not ruff config) as configuration. Adopting the thresholds surfaced one violation in the project's own code: render_markdown took four arguments. It only needed plugins+resolver to build a jinja Environment, so pass the Environment instead (three args, behaviour unchanged). The mapper's own tests still pass.
Collaborator
|
Thanks for the PR! Merged |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
habit-hooks recommends
max-complexity = 10,max-args = 3,max-statements = 12(the python plugin'sruff.toml), but the project did not apply them to its own code. This makes the project follow its own recommendation and enforces it in CI.Changes
[tool.ruff.lint.*], plusextend-select = ["C901", "PLR0913", "PLR0915"]. Theextend-selectis required. Without it the thresholds are inert, because those checks are off by ruff's defaults.uv run ruff check srcstep so the values are actually enforced on pushes to main and on pull requests.render_markdownhad four arguments. It only usedplugins+resolverto build a jinjaEnvironment, so it now takes theEnvironment(three args). Behaviour unchanged, mapper tests green.Notes
srcon purpose. A repo-wideruff check .currently fails, because ruff tries to parse the python plugin's sensorruff.toml(a sensor definition,command = """...""") as a ruff config. Widening the lint to the plugins would need that handled first (rename, or exclude it from config discovery). Happy to follow up separately.ruff check srcCI step is a suggestion, to keep the values from sitting decorative. If you would rather carry the config without enforcing it in CI yet, say the word and I will drop that step.Verified
uv run ruff check srcpasses.PLR0913, 4 > 3), then removed.uv run pytest plugins/python testsgreen (37 passed, 1 skipped); mapper tests green (15 passed).