Add tests, coverage, line-count hooks, and pip-audit - #2
Conversation
Gate complexity with Ruff C901 and keep runtime stdlib-only while expanding optional [dev] tooling. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 49 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe project adds file-size checks, pytest coverage, Ruff complexity enforcement, dependency auditing, Semgrep scanning, SonarCloud configuration, expanded tests, and version 0.1.3 release documentation. ChangesProject quality gates
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Use .sonarcloud.properties so SonarCloud can analyze via the GitHub App without a CI token. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Follow-up on this PR:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
hooks/check_file_size.py (1)
116-154: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd unit tests for the line-count checker logic.
_check_filehas several branches: byte-size limits, doc vs. source cap selection, per-file override parsing, and ignore rules. None of this logic has tests. Sincehooks/is outside thesource = ["dislocker_ui"]coverage scope, this gap will not surface in the coverage report.Add a
tests/test_check_file_size.pycovering: override cap parsing, hard vs. soft threshold boundaries, and_ignoredpath matching.
Do you want me to generate this test file?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@hooks/check_file_size.py` around lines 116 - 154, The line-count checker lacks unit coverage for its key branching behavior. Add tests in tests/test_check_file_size.py covering _override_cap parsing, _check_file hard and soft threshold boundaries for source and documentation files, and _ignored path matching, including relevant byte-size and override cases exposed by the implementation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 46-63: Update the actions/checkout@v4 steps in the audit job and
every other checkout step in this workflow to set persist-credentials to false,
while preserving their existing checkout behavior.
In @.sonarcloud.properties:
- Line 11: Update the sonar.exclusions configuration in .sonarcloud.properties
to remove the unsupported wildcard exclusions for Automatic Analysis. Configure
these paths through SonarQube Cloud Analysis Scope or its API instead, or
migrate to CI-based analysis if retaining wildcard patterns is required.
In `@CHANGELOG.dev.md`:
- Around line 13-14: Correct only the pytest suite entry in CHANGELOG.dev.md by
adding the full tests/ prefix to test_deps.py and test_disks.py, matching
tests/test_session.py; leave the Ruff C90 entry unchanged.
In `@hooks/check_file_size.py`:
- Around line 48-49: Update the extension classification used by _check_file so
.toml files, including pyproject.toml, use SOFT_LINE_CAP and HARD_LINE_CAP
rather than the DOC_* caps. Move .toml from DOC_EXTS to SOURCE_EXTS, preserving
the existing handling for other documentation extensions.
---
Nitpick comments:
In `@hooks/check_file_size.py`:
- Around line 116-154: The line-count checker lacks unit coverage for its key
branching behavior. Add tests in tests/test_check_file_size.py covering
_override_cap parsing, _check_file hard and soft threshold boundaries for source
and documentation files, and _ignored path matching, including relevant
byte-size and override cases exposed by the implementation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 5faec74a-ca98-46e8-883a-3551af9aaaa6
📒 Files selected for processing (14)
.github/workflows/ci.yml.pre-commit-config.yaml.sonarcloud.propertiesAGENTS.mdCHANGELOG.dev.mdCHANGELOG.mdREADME.mdVERSIONhooks/check_file_size.pypyproject.tomltests/.gitkeeptests/test_deps.pytests/test_disks.pytests/test_session.py
💤 Files with no reviewable changes (1)
- tests/.gitkeep
Disable checkout credential persistence, drop unsupported Sonar wildcard exclusions, treat .toml as source for line caps, and cover the size hook. Co-authored-by: Cursor <cursoragent@cursor.com>
Local Semgrep flagged mutable Action tags; SHA pins clear that and harden CI. Also split a Sonar composite assert in the file-size hook test. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/ci.yml:
- Around line 72-73: Update the container image in the workflow’s container
configuration to use the intended Semgrep version pinned by its immutable digest
instead of the untagged semgrep/semgrep reference, and add a readable comment
identifying the pinned version.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 18e8dd8b-fa08-434a-b945-ec53f742b421
📒 Files selected for processing (9)
.github/workflows/ci.yml.semgrepignore.sonarcloud.propertiesAGENTS.mdCHANGELOG.dev.mdCHANGELOG.mdREADME.mdhooks/check_file_size.pytests/test_check_file_size.py
🚧 Files skipped from review as they are similar to previous changes (6)
- .sonarcloud.properties
- AGENTS.md
- CHANGELOG.md
- CHANGELOG.dev.md
- README.md
- hooks/check_file_size.py
Addresses CodeRabbit/zizmor unpinned-images on the mutable semgrep/semgrep tag. Co-authored-by: Cursor <cursoragent@cursor.com>
|



Summary
session,deps, anddisks(13 cases); coverage fail-under 70% on core modules (gui/runner/__main__omitted)hooks/check_file_size.pyon pre-commit + pre-push[dev]install, existing Ruff/path/gitleaks checksTest plan
pip install -e ".[dev]" && pytest --cov && pip-audit(no vulns)pre-commit run --all-fileslint + test + coverage,pip-audit,gitleaks)Made with Cursor
Summary by CodeRabbit
New Features
Documentation
Chores