| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…gv usage - Remove unnecessary non-capturing subpattern in regex (engine.py:296) - Add match parameter to broad pytest.raises(Exception) in config_test.py - Replace sys.argv = ... with monkeypatch.setattr() in main_test.py (55 instances) to avoid modifying global state, following SonarQube recommendation
✅ Deploy Preview for commit-check ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Sorry, something went wrong.
📝 Walkthrough
WalkthroughThe subject capitalization regex now extracts conventional-commit descriptions differently. Tests tighten invalid TOML assertions and standardize CLI argument setup with monkeypatch, covering validation, output formats, configuration, positional arguments, and force-push behavior. ChangesValidation and CLI tests
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: developer 🚥 Pre-merge checks | ✅ 5 ✅ Passed checks (5 passed)
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. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #480 +/- ##
==========================================
+ Coverage 97.20% 97.28% +0.08%
==========================================
Files 12 12
Lines 1179 1179
==========================================
+ Hits 1146 1147 +1
+ Misses 33 32 -1 ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)tests/config_test.py (1)🤖 Prompt for all review comments with AI agents311-313: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Use a raw string for the pytest regex.
Ruff reports RUF043 because the match= pattern contains regex metacharacters but is not written as a raw string. Use match=r"[Ee]xpected" to preserve behavior and clear the warning.
🤖 Prompt for AI AgentsVerify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/config_test.py` around lines 311 - 313, Update the pytest.raises assertion in the TOML parsing test to pass the regex pattern as a raw string, using the existing "[Ee]xpected" pattern and preserving its matching behavior.Source: Linters/SAST tools
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 `@commit_check/engine.py`: - Line 296: Update the subject-matching regex in the relevant validation flow to treat `!:` as a single breaking-commit delimiter, requiring the colon after an optional exclamation mark so `feat!: Add feature` captures the message correctly while preserving existing type and scope formats. Add a regression case in the tests around the engine validation to confirm this notation with a capitalized subject is accepted. --- Nitpick comments: In `@tests/config_test.py`: - Around line 311-313: Update the pytest.raises assertion in the TOML parsing test to pass the regex pattern as a raw string, using the existing "[Ee]xpected" pattern and preserving its matching behavior.
Fix all unresolved CodeRabbit comments on this PR:
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 51b646c5-b97e-48a8-81ec-bc0f103206d7
📥 CommitsReviewing files that changed from the base of the PR and between 911de5e and 9d534cb.
📒 Files selected for processing (3)
Sorry, something went wrong.
Merging this PR will improve performance by ×2.8⚠️ Different runtime environments detected
⚡ 1 improved benchmark Performance Changes
Tip Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent. Comparing chore/fix-sonarqube-code-smells (acf0266) with main (911de5e) Footnotes
|
Sorry, something went wrong.
Co-authored-by: Xianpeng Shen <xianpeng.shen@gmail.com>
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Fixes 3 categories of SonarQube-reported code smells (58 total issues → expect ~54/58 to resolve after this PR).
Changes
commit_check/engine.py:296 — Remove unnecessary outer non-capturing group in regex. The (?:...) wrapper had no quantifier or alternation — purely decorative. Same behavior, cleaner pattern.
tests/config_test.py:311 — Add match="[Ee]xpected" to pytest.raises(Exception) so the assertion verifies we caught the right TOML parsing error, not any random Exception.
tests/main_test.py (55 lines) — Replace all sys.argv = ... direct assignments with monkeypatch.setattr("sys.argv", ...). This prevents global state leaking between tests and automatically restores the original value after each test.
Verification
SonarQube Impact
Summary by CodeRabbit
Bug Fixes
Tests