Add a parser for AWS CodeGuru Security JSON output#1515
Conversation
…d improve suggested fix formatting
…s and improve formatting for suggested fixes and code snippets
uhafner
left a comment
There was a problem hiding this comment.
Thanks, just some minor comments...
| var filePath = vulnerability == null ? null : vulnerability.optJSONObject(FILE_PATH); | ||
|
|
||
| issueBuilder | ||
| .setFileName(firstNonBlank(filePath, PATH, NAME)) |
There was a problem hiding this comment.
This looks strange, it would make sense to replace it with:
| var filePath = vulnerability == null ? null : vulnerability.optJSONObject(FILE_PATH); | |
| issueBuilder | |
| .setFileName(firstNonBlank(filePath, PATH, NAME)) | |
| if (vulnerability != null) { | |
| var fileName = firstNonBlank(vulnerability.optJSONObject(FILE_PATH), PATH, NAME); | |
| issueBuilder.setFileName(fileName); | |
| if (!fileName.isEmpty()) { | |
| issueBuilder.setLineStart(filePath.optInt(START_LINE, 0)) | |
| .setLineEnd(filePath.optInt(END_LINE, 0)); | |
| } | |
| } |
| if (filePath != null) { | ||
| issueBuilder.setLineStart(filePath.optInt(START_LINE, 0)) | ||
| .setLineEnd(filePath.optInt(END_LINE, 0)); | ||
| } |
| } | ||
|
|
||
| @CheckForNull | ||
| private String formatSuggestedFix(final JSONObject suggestedFix) { |
There was a problem hiding this comment.
| private String formatSuggestedFix(final JSONObject suggestedFix) { | |
| private String formatSuggestedFix(@CheckForNull final JSONObject suggestedFix) { |
| } | ||
| } | ||
|
|
||
| private void appendSuggestedFixes(final List<String> sections, final JSONArray suggestedFixes) { |
There was a problem hiding this comment.
| private void appendSuggestedFixes(final List<String> sections, final JSONArray suggestedFixes) { | |
| private void appendSuggestedFixes(final List<String> sections, @CheckForNull final JSONArray suggestedFixes) { |
…file paths and enhance suggested fix formatting
| else { | ||
| issueBuilder.setFileName(""); | ||
| } |
There was a problem hiding this comment.
Sorry! now I removed the redundant else block to keep it default.
☀️ Quality MonitorTests Coverage for New Code 〰️ Line Coverage: 100.00% — perfect 🎉 Coverage for Whole Project 〰️ Line Coverage: 94.23% — 504 missed lines Style Bugs API Problems🚫 Revapi: No warnings Vulnerabilities🛡️ OWASP Dependency Check: No vulnerabilities Software Metrics 🌀 Cyclomatic Complexity: 3247 (total) 🚦 Quality GatesOverall Status: ✅ SUCCESS✅ Passed Gates
Created by Quality Monitor v4.11.0 (#484bbba). More details are shown in the GitHub Checks Result. |
|
Thanks! |
Add a parser for
AWS CodeGuruSecurity JSON outputSee : https://docs.aws.amazon.com/cli/latest/reference/codeguru-security/get-findings.html
Testing done
Submitter checklist