chore: fix 27 SonarQube issues across source and test files - #436
Conversation
✅ Deploy Preview for commit-check ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
More reviews will be available in 55 minutes and 12 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. 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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughAdds Changescommit-check schema, config fixes, engine/main refactoring, and test cleanup
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Fixes the following SonarQube findings:
Source code fixes:
- S8707 (VULN): Path traversal - use .resolve() on config path
- S5713: Remove redundant Exception subclass in except clause
- S3776: Reduce cognitive complexity of _should_skip_commit_validation
- S3776: Reduce cognitive complexity of main() by extracting helpers
- S1172: Unused parameter _subject in base SubjectValidator
- S6019: Reluctant quantifier -> greedy in co-author regex
- S1871: Merge duplicate branches in SubjectLengthValidator
- S1871: Merge duplicate return None branches in _build_boolean_rule
- S1192: Remove redundant {1} in conventional commit regex
- S7498: dict() -> {} literal in docs/conf.py (x2)
Test file fixes:
- S1192: Define constants for duplicated string literals (16 issues across
5 test files)
All 377 existing tests pass.
acf9336 to
a0858ef
Compare
Merging this PR will improve performance by ×2.4
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #436 +/- ##
==========================================
+ Coverage 95.95% 95.97% +0.01%
==========================================
Files 10 10
Lines 1162 1167 +5
==========================================
+ Hits 1115 1120 +5
Misses 47 47 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|



Summary
Fixes 27 SonarQube issues reported on the project dashboard across source code and test files.
Source Code Fixes (11 issues)
config.py.resolve()on config path to normalize user-supplied inputconfig.pyHTTPError(subclass ofURLError) andExceptionfrom except clauseengine.py_should_skip_commit_validation— extract_author_in_ignore_list()and_get_commit_body()helpersmain.pymain()— extract_get_requested_checks(),_resolve_commit_message_source(),_resolve_stdin_for_non_message(),_run_json_output()engine.pysubject→_subjectinSubjectValidator._validate_subject()engine.py[^<\n]+?→ greedy[^<\n]+in co-author regexengine.pyreturn PASSbranches inSubjectLengthValidatorrule_builder.pyreturn Nonebranches in_build_boolean_rulerule_builder.py{1}in conventional commit regexdocs/conf.pydict()→{}literals (×2)Test File Fixes (16 issues)
String literal duplications replaced with module-level constants across
tests/engine_test.py,tests/config_test.py,tests/util_test.py,tests/main_test.py, andtests/rule_builder_test.py.All 377 existing tests pass. ✅
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Chores