Repository navigation
Fix #34: add CI static code quality tests for this project - #43
Conversation
…detection The project had no static quality gate, so lint, formatting and typing drift went unnoticed. A new single-platform `quality` CI job runs ruff lint, ruff format --check, strict mypy and jscpd (threshold 0, see .jscpd.json), and the issues these tools found are fixed: zip() now uses strict=True, rich narrowing in pretty.py is type-safe, test helpers are fully annotated, and make_context takes a typed Options value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #43 +/- ##
==========================================
- Coverage 96.85% 96.75% -0.10%
==========================================
Files 29 29
Lines 1017 1018 +1
Branches 80 80
==========================================
Hits 985 985
- Misses 27 28 +1
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@leftibot resolve merge conflicts |
|
✅ leftibot finished addressing the review feedback. |
Requested by @lefticus in PR cpp-best-practices#43 review. Resolved conflicts in core.py, tests/support.py, test_checks.py, test_plugins.py and test_runner.py, keeping main's new behaviour (project exclusions, layout-parametrised tests, new checks). make_context, run_in_every_layout and run_as keep this PR's typed `options: Options | None` parameter instead of main's `**options: object`, which strict mypy rejects. Code merged from main is also brought up to the new quality gate: ruff formatting, a ClassVar annotation (RUF012), Mapping parameters, return annotations and typed JSON access in tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed review feedback from @lefticus. New commits: |
|
@leftibot fix merge conflicts and make sure this PR matches current standards for how tests should be organized to reduce merge conflicts |
|
✅ leftibot finished addressing the review feedback. |
…files Merged upstream main, which split tests/test_checks.py into tests/checks/test_<check>.py (cpp-best-practices#48). The conflicting test_checks.py edits are now applied to the per-check files instead: _run helpers return Result, make_context/run_as take a typed Options value instead of **options, matrix parameters take a covariant Mapping, and an over-long line is wrapped. ruff, ruff format, strict mypy and jscpd (threshold 0) all pass on the merged tree. Requested by @lefticus in PR cpp-best-practices#43 review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Addressed review feedback from @lefticus. New commits: |
|
@leftibot can you explain the decline in coverage that coveralls is reporting? |
|
✅ leftibot finished looking into this — see reply below. |
|
The drop doesn't mean test coverage got worse. (The report on this PR is from Codecov, not Coveralls; the numbers below are from its comment.) The cause is a gap that already existed in the Where the −0.10% comes fromThe whole change is one new line in text = _rich.textTo make mypy's strict mode happy, the PR passes the narrowed Why
|
| Coverage run | Skipped tests | pretty.py |
Total misses |
|---|---|---|---|
without rich (same as CI) |
7 | 52% (17 missed) | 28 |
with rich installed |
0 | 96% (only the ImportError fallback) |
11 |
Suggested fix
Install rich in the coverage job:
- name: Install tools
run: python -m pip install "coverage>=7.10" "PyYAML>=6.0" "rich>=13.0"This would remove the 7 skips and take overall coverage from about 97% to about 99%. The ImportError fallback (lines 22–23) would then be the only uncovered part, and the tests already exercise that path by patching pretty._rich to None. I'd recommend a separate small PR, since it changes how coverage is measured rather than anything this PR is about. I can also add it here if you'd like.
Also worth noting
The PR branch is now behind main. The Dependabot bumps (#50, #51, #53) moved the workflows to actions/checkout@v7, actions/setup-python@v7 and actions/setup-node@v7. The new quality job still uses @v4/@v5, so it should be updated on the next merge to match.
Automated fix by @leftibot.
What changed
Files
Closes #34
Triggered by @lefticus.