-
Notifications
You must be signed in to change notification settings - Fork 9
Add support for suppression criteria #25
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
Conversation
| ./gradlew properties -q | grep "version:" | ||
| ./gradlew properties -q | grep "version:" | awk '{print $2}' |
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.
Do we need both lines?
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.
Maybe you need neither and this is a left-over. Looks like the one below is the one that matters.
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.
will remove
| # CodeGuru Reviewer CLI Wrapper | ||
| Simple CLI wrapper for CodeGuru reviewer that provides a one-line command to scan a local clone of a repository and | ||
| receive results. This CLI wraps the [AWS CLI](https://aws.amazon.com/cli/) commands to communicated with | ||
| [AWS CodeGuru Reviewer](https://aws.amazon.com/codeguru/). Using CodeGuru Reviewer may generate metering fees |
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.
[not from this PR] Typo in "communicated" in the line above
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.
thx
README.md
Outdated
|
|
||
| ### Prerequisites | ||
|
|
||
| To run the CLI, we need to have a version of git, Java (e.g., [Amazon Corretto](https://aws.amazon.com/corretto/?filtered-posts.sort-by=item.additionalFields.createdDate&filtered-posts.sort-order=desc)) and the [AWS Command Line interface](https://aws.amazon.com/cli/) installed. Verify that both application are installed on our machine by running: |
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.
both applications
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.
thx
README.md
Outdated
|
|
||
| ### Scan an Example | ||
|
|
||
| Now, lets download an example project (requires Maven): |
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.
let's
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.
thx
README.md
Outdated
|
|
||
| You can use this CLI to run CodeGuru from inside your CI/CD pipeline. See [this action](.github/workflows/self-test-and-release.yml#L30-L41) as an example. First, you need credentials for a role with the permissions mentioned above. If you already scanned | ||
| the repository once with the CLI, the S3 bucket has been created, and the you do not need the `s3:CreateBucket*` permission anymore. | ||
| # We can tell the CLI to exclude all recommendations below a certain severity. This can be useful in CICD integration. |
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.
nit: CI/CD for consistency
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.
thx
| } | ||
| } | ||
|
|
||
| // try load the |
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.
complete or remove comment
| Log.info("Analysis finished."); | ||
| if (main.failOnRecommendations && !results.isEmpty()) { | ||
| RecommendationPrinter.print(results); | ||
| System.exit(5); |
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.
Log a message explaining why we are exiting with an error code?
The person who debugs why this is returning errcode 5 may not be the same one who decided to enable the flag.
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.
Good point
|
|
||
| public class CodeInsightReport { | ||
|
|
||
| /* |
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.
remove dead code
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.
will do
| sb.append(recommendation.description()); | ||
| sb.append("\n"); | ||
| if (severityToInt(recommendation) < 2) { | ||
| Log.error(sb.toString()); |
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.
This may look like that CLI wrapper itself hit an error. Aren't INFO messages with Severity: FOOBAR enough? Otherwise you're saying the same thing twice in different ways. I know this may allow loglevel-based filtering, but seems like it could also be a bit confusing.
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.
Yeah, you're probably right ... I'll log everything at info
| continue; | ||
| } | ||
| if (rec.ruleMetadata() == null || rec.filePath().equals(".")) { | ||
| continue; // Always drop rules without metadata or the stats recomendation |
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.
Could we add an option to keep the recommendations that don't have any metadata? I think it's great to drop them, but until a better mechanism exists, this will hide the problem under the rug. With such an option we can still enable it in end-to-end regression testing and alert.
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.
I'd rather fix this by making sure all rules have metadata. If there is no metadata, we don't know what rule it is, so we can't filter it. Usually, these are low severity, so customers who want to block pipelines using the CLI would likely suppress them anyway.
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.
Oh, and this only happens when you filter. So we can still get these by running without filter. OK, that's good enough.
Adds support for cli-specific suppression mechanisms in
.codeguru-ignore.ymland bumps the version to 0.1.0:By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.