You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enforce ruff in CI and pre-commit, and clear the existing violations
Ruff already ran in CI, but only as a job inside the Unit Tests workflow,
so it inherited that workflow's path filter and never saw .hooks/,
benchmarks/, or tests/e2e/. Move it to its own unconditional Lint
workflow, which also keeps it usable as a required status check.
Add ruff to pre-commit so violations surface before CI. The hook runs
ruff out of the project environment rather than the upstream mirror, so
the version stays pinned in one place; Dependabot has no pre-commit
ecosystem and would never update a mirror's rev.
Expand the rule set beyond E/F/I to cover bug classes that matter for a
CLI other people run in their pipelines, and fix every resulting
violation so the baseline is clean rather than suppressed.
Behaviour changes worth calling out:
- Package.created_at used str.strip(" (Coordinated Universal Time)"),
which treats its argument as a set of characters, not a suffix. It ate
a leading "T" from "Tue ..." and a trailing "T" from timestamps that
carried no suffix at all. Now uses removesuffix.
- Every requests call in the plugins and the GitLab client now passes an
explicit timeout. requests blocks forever by default, so a hung
notification could wedge the pipeline the CLI reports into.
- Two asserts became real checks. assert is stripped under python -O, so
neither guard survived an optimised interpreter.
- config.py logs through the socketcli logger instead of the root
logger, so its messages honour the configured level and format.
- A stray debug print in the SBOM artifact loop became a log.debug call;
it was writing to stdout, which carries machine-readable output.
- Closures defined inside loops in alert_selection and messages were
hoisted and now take their inputs explicitly.
Complexity is bounded by C901 (max 12) and PLR0913 (max 8). The 20
functions over the limit today carry an explicit noqa; RUF100 fails the
build once a suppression goes stale, so the list can only shrink.
E501 and W291/W293 are left to ruff format rather than duplicated in the
linter: everything the formatter cannot reflow is a string literal, and
the PR-comment markup depends on trailing double-spaces as Markdown
hard line breaks.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments