-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CI/CD parameters to scan creation API and CLI #857
Add CI/CD parameters to scan creation API and CLI #857
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review Summary
Total Issues Found: 4
Critical Issues: 1
Suggestions: 3
Key Findings:
The code review identified several issues and suggestions across multiple files. Key themes include the need for better handling of default values, modernizing type hints, and improving code readability. The most critical issue is the potential runtime error due to the unhandled None
value for ci_cd_params
. Overall, the code quality is good but could benefit from some improvements in type hinting and error handling.
Overall Assessment:
The code quality is needs improvement. The code review identified several issues and suggestions across multiple files. Key themes include the need for better handling of default values, modernizing type hints, and improving code readability. The most critical issue is the potential runtime error due to the unhandled None
value for ci_cd_params
. Overall, the code quality is good but could benefit from some improvements in type hinting and error handling.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #857 +/- ##
==========================================
+ Coverage 62.27% 62.87% +0.59%
==========================================
Files 342 342
Lines 14566 14596 +30
==========================================
+ Hits 9071 9177 +106
+ Misses 5495 5419 -76 ☔ View full report in Codecov by Sentry. |
Co-authored-by: Mohamed Elyousfi <144013278+elyousfi5@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming is the main thing to fix.
The changes introduce
CI/CD
context tracking for scans initiated fromGitHub Actions
by incorporating support forCI/CD
parameters throughout the scan creation process. A newScanSource
data class has been created to hold CI/CD-related information, including the source, repository, and pull request ID. Additionally, the mobile scan API request has been updated to accept and include these parameters in theGraphQL
query and its variables.Changed files
scan_create.py:
• Added ScanSource dataclass to hold CI/CD related parameters (source, repository, pr_id)
• Updated CreateMobileScanAPIRequest to:
• Accept ci_cd_params parameter
• Include CI/CD parameters in GraphQL query and variables
• Pass CI/CD params to API request data
run.py:
• Added new CLI options for CI/CD parameters:
• --source: CI/CD source name
• --repository: Repository name
• --pr-number: Pull request number
• Stored CI/CD parameters in context object for passing to scan creation
mobile.py:
• Updated run_mobile_scan to:
• Get CI/CD params from context
• Create ScanSource instance if source is provided
• Pass CI/CD params to _create_scan
• Updated _create_scan to:
• Accept ci_cd_params parameter
• Pass CI/CD params to API request