fix: sonar issues: Get SCM.py compliant with Sonar#1613
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe SCM executor now reads Ansible runner events to extract git versions and failure messages, while repository tests cover proxy restoration, credential setup, key handling, destination creation, and executor outcomes. ChangesSCM event handling and repository setup
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GitAnsibleRunnerExecutor
participant ansible_runner
participant EventRecords
participant SCMExceptions
GitAnsibleRunnerExecutor->>ansible_runner: run SCM operation
ansible_runner-->>EventRecords: return runner_on_ok or runner_on_failed events
GitAnsibleRunnerExecutor->>EventRecords: extract scm_version or failure msg
GitAnsibleRunnerExecutor->>SCMExceptions: raise mapped SCM error when needed
🚥 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1613 +/- ##
==========================================
+ Coverage 92.75% 93.17% +0.41%
==========================================
Files 244 244
Lines 11346 11362 +16
==========================================
+ Hits 10524 10586 +62
+ Misses 822 776 -46
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/run-e2e |
|
/run-atf-tests |
✅ Test Results - PASSEDSummary
Pass Rate: 75.4% |
ptoscano
left a comment
There was a problem hiding this comment.
Rather than "fix the regexp", I think the code needs to use better the ansible_runner module; in particular, the Runner object returned by ansible_runner.run() seem to provide already all the needed pieces, without any need to manual parsing:
https://docs.ansible.com/projects/runner/en/latest/python_interface/
My suggestion here is to create a different PR with the better usage of the ansible_runner API.
|
/run-e2e |
|
/run-atf-tests |
❌ Test Results - FAILEDSummary
Pass Rate: 74.2% ❌ Failed Tests
|
ptoscano
left a comment
There was a problem hiding this comment.
Thanks for the updates, in general it is a good improvement. I left some more notes, I should had reviewed it fully previously, sorry.
In addition to the notes, this PR needs:
- to be rebased
- a PR description that explains better what is being done, and why
Signed-off-by: Jacob Craiglow <[email protected]>
Signed-off-by: Jacob Craiglow <[email protected]>
Signed-off-by: Jacob Craiglow <[email protected]>
Signed-off-by: Jacob Craiglow <[email protected]>
2dc8bf2 to
cc5468f
Compare
Signed-off-by: Jacob Craiglow <[email protected]>
|



Sonarcloud is complaining about a regex in a different PR. This PR gets rid of that regex in favor of utilizing the ansible runner API. Sonar has since scanned this file and determined that the tests only cover 83% of code in this file and is gating. So this PR will also add test cases to the rest of the file.
Assisted-By: Claude
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Tests