Skip to content

tooling: Lower Pylint complexity thresholds in ruff.#297

Merged
nedseb merged 1 commit into
mainfrom
tooling/ruff-pylint-thresholds
Mar 28, 2026
Merged

tooling: Lower Pylint complexity thresholds in ruff.#297
nedseb merged 1 commit into
mainfrom
tooling/ruff-pylint-thresholds

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 28, 2026

Summary

Lower the Pylint complexity thresholds from their current permissive values to just above the worst existing violations. This prevents new complex code from being introduced while accepting the existing codebase.

Setting Before After Worst violation
max-complexity (McCabe) 61 25 22 (apds9960 process_gesture_data)
max-args 14 10 8 (steami_config mag calibration)
max-branches 58 25 24 (apds9960 process_gesture_data)
max-returns 13 8 7 (ism330dl orientation)
max-statements 166 65 64 (apds9960 process_gesture_data)

Test infrastructure files (tests/) are exempt from PLR0911/PLR0912/PLR0915 as the test runner and report plugin inherently have complex control flow.

The main offender is apds9960.process_gesture_data which is a ported driver with inherently complex gesture recognition logic. Refactoring it is out of scope for this PR.

Closes #291

Test plan

  • make ci passes
  • No new code can exceed these thresholds without explicit review

Copilot AI review requested due to automatic review settings March 28, 2026 19:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts Ruff’s Pylint-equivalent complexity thresholds to be much less permissive (but still above current worst offenders) so new code can’t add additional complexity without explicit review, while keeping the current codebase passing lint.

Changes:

  • Lower McCabe max-complexity to 25.
  • Lower Pylint thresholds (max-args, max-branches, max-returns, max-statements) to tighter values aligned with current violations.
  • Exempt tests/**/*.py from PLR0911/PLR0912/PLR0915 to avoid test infrastructure/control-flow lint churn.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nedseb nedseb merged commit 72c4a9f into main Mar 28, 2026
14 checks passed
@nedseb nedseb deleted the tooling/ruff-pylint-thresholds branch March 28, 2026 19:57
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tooling: Lower Pylint complexity thresholds in ruff.

2 participants