feat(cli): add ruff linter (Google style + C4) and apply-sensors target#11
Merged
Conversation
Configure ruff in app/cli/ with Google Python Style Guide conventions plus the C4 (flake8-comprehensions) rule family. Activates check + format with line-length=100, pydocstyle Google convention, and per-file-ignores that exempt tests from docstring and unused-arg rules. Adds a new `apply-sensors` Makefile target that runs lint, unit tests, and the mutation-testing gate (without acceptance, by design). Fixes all findings: renames `vars` → `make_vars` (7 sites), adds module/package/function docstrings, sorts imports, and collapses nested `with` statements via the parenthesized context manager. Documents the Google rules that ruff cannot enforce in the root CLAUDE.md. Mutation score after the change: 98.6% (71/72). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
app/cli/pyproject.tomlto enforce the Google Python Style Guide (pydocstyle convention) plus the C4 rule family. Active rule groups: E/W/F/I/N/D/UP/B/C4/SIM/RET/PTH/ARG/ERA/A/TID. Line length 100, per-file-ignores carve tests out of docstring + unused-arg rules.apply-sensors(lint + unit tests + mutation gate, no acceptance) plus reusable sub-targetslintandunit-test.vars→make_varsin 7 sites, adds module/package/function docstrings, sorts imports, and collapses nestedwithstatements via the parenthesized context manager.ruff formatapplied acrossapp/cli/.CLAUDE.mdunder a new section "Python code conventions (app/cli/)" (Google docstring sections,TODO(@user):,TYPE_CHECKING,assertboundaries, exception specificity,typer.echovslogging, naming, etc.).Test plan
cd app/cli && uv run ruff check .— exits 0, "All checks passed!"uv run ruff format --check .— exits 0, no pending changesuv run pytest tests --ignore=tests/acceptance— 70/70 passedmake apply-sensors— lint clean, unit tests green, mutation 98.6% (71/72) ≥ 70% gateuv run q --helpsmoke test still renders all commandsmake acceptance-teststill passes (independent of this change — should be verified once before merge)🤖 Generated with Claude Code