Skip to content

Fix SonarCloud violations#136

Merged
Takishima merged 1 commit intomainfrom
claude/fix-sonarcloud-violations-ZUF8Q
Jan 7, 2026
Merged

Fix SonarCloud violations#136
Takishima merged 1 commit intomainfrom
claude/fix-sonarcloud-violations-ZUF8Q

Conversation

@Takishima
Copy link
Copy Markdown
Owner

Summary

This PR fixes multiple SonarCloud violations across the codebase:

Python Code Fixes

  • cmake_pc_hooks/_argparse.py: Fixed return type annotation for _load_from_toml method (was None, now correctly argparse.Namespace)
  • cmake_pc_hooks/_cmake.py: Reduced cognitive complexity by extracting helper methods (_process_keyword_cmake_args, _process_flag_cmake_args, _process_platform_cmake_args)
  • tests/python/_cmake_test.py:
    • Reduced cognitive complexity by extracting test helper functions
    • Renamed InterProcessReaderWriterLockmock_rw_lock and FileLockmock_file_lock to follow naming conventions

GitHub Actions Security Fixes

  • .github/workflows/pull_request.yml: Use environment variable for PR body instead of direct interpolation to prevent command injection
  • .github/workflows/format.yml: Use environment variables for branch names in run commands
  • .github/workflows/publish_release.yml: Use environment variables for branch names in run commands
  • .github/workflows/draft_release.yml: Added tag format validation step and use environment variable for run commands

Shell Script Fixes

  • tests/run_tests.sh:
    • Replaced [ ] with [[ ]] for safer conditional tests
    • Added explicit return statements at end of functions
    • Merged nested if conditions where applicable

Test plan

  • All 91 Python tests pass
  • CI pipeline passes

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Jan 7, 2026

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -0.10%) 100.00% (target: 70.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (31f4f29) 604 604 100.00%
Head commit (0668084) 610 (+6) 610 (+6) 100.00% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#136) 19 19 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Python fixes:
- Fix _argparse.py: Change return type of _load_from_toml from None to
  argparse.Namespace to match actual return value
- Fix _cmake.py: Reduce cognitive complexity by extracting helper methods
  (_process_keyword_cmake_args, _process_flag_cmake_args,
  _process_platform_cmake_args)
- Fix _cmake_test.py: Reduce cognitive complexity by extracting test helpers
  and rename InterProcessReaderWriterLock variables to follow naming conventions

GitHub Actions security fixes:
- Use environment variables instead of direct interpolation for user-controlled
  data in run commands (pull_request.yml, format.yml, publish_release.yml)
- Add input validation for workflow_dispatch tag parameter (draft_release.yml)

Shell script fixes (run_tests.sh):
- Replace [ ] with [[ ]] for safer conditional tests
- Add explicit return statements at end of functions
- Merge nested if conditions where applicable
@Takishima Takishima force-pushed the claude/fix-sonarcloud-violations-ZUF8Q branch from 64360c6 to 0668084 Compare January 7, 2026 16:49
@Takishima Takishima merged commit f9cc048 into main Jan 7, 2026
37 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (31f4f29) to head (0668084).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #136   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          604       610    +6     
  Branches       101       101           
=========================================
+ Hits           604       610    +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants