Skip to content

docs: Update CONTRIBUTING.md linting section to match current ruff configuration #310

@nedseb

Description

@nedseb

Context

The ruff configuration has evolved significantly over recent PRs (#294, #295, #297, #298), but the CONTRIBUTING.md linting section was not updated to reflect these changes. Several statements in the documentation now contradict or omit the active rules.

Issues found

1. Missing linting rules summary

The "Linting" section only shows make lint / make lint-fix commands but does not list which rule groups are active. Contributors have no visibility into what ruff enforces without reading pyproject.toml.

2. Obsolete wildcard import convention

The coding conventions section does not mention imports explicitly, but the CLAUDE.md previously referenced from <module>.const import * as the project convention. Since PR #298, all wildcard imports have been replaced with explicit imports. The documentation should clarify this.

3. Missing daplink_bridge scope

The "Scopes" list in the commit message section includes daplink_flash but omits daplink_bridge, which exists as a driver in lib/daplink_bridge/. The commitlint.config.js also lacks this scope.

4. Bare except: convention vs E722

The coding conventions state: "use except Exception: instead of bare except:". This is correct and aligns with E722 being active (no longer ignored). However, the phrasing "when possible" (in CLAUDE.md) could be misleading — E722 now enforces this unconditionally.

5. No mention of MicroPython-specific ignore rationale

Several ignored rules (SIM105, PIE810, SIM101) are specifically due to MicroPython limitations (no contextlib.suppress, no tuple startswith/endswith, no merged isinstance). This rationale is not documented anywhere for contributors.

Proposed changes

  • Add a "Ruff rules" subsection to the Linting section listing active rule groups
  • Add a note about explicit imports being required (no wildcard import *)
  • Add daplink_bridge to the scopes list in CONTRIBUTING.md and commitlint.config.js
  • Document MicroPython-specific rule exceptions with rationale
  • Ensure coding conventions align with enforced rules (no ambiguous "when possible")

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions