-
Notifications
You must be signed in to change notification settings - Fork 688
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
SONARJAVA-5232 S1192: Do not consider arguments in Throwables when checking for duplicated strings #4984
Conversation
|
This PR is stale because it has been open 7 days with no activity. If there is no activity in the next 7 days it will be closed automatically |
java-checks/src/main/java/org/sonar/java/checks/StringLiteralDuplicatedCheck.java
Outdated
Show resolved
Hide resolved
java-checks-test-sources/default/src/main/java/checks/StringLiteralDuplicatedCheckSample.java
Outdated
Show resolved
Hide resolved
java-checks-test-sources/default/src/main/java/checks/StringLiteralDuplicatedCheckSample.java
Outdated
Show resolved
Hide resolved
.filter(t -> t.is(Tree.Kind.ARGUMENTS)) | ||
.map(Tree::parent) | ||
.filter(t -> t.is(Tree.Kind.NEW_CLASS)) | ||
.map(Tree::parent) | ||
.filter(t -> t.is(Tree.Kind.THROW_STATEMENT)) | ||
.isPresent(); |
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.
The approach should be robust enough to work with broken semantics.
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 added a test with .withoutSemantic()
. Please reopen if you meant something else. We don't need any external dependencies for this rule, but the file should complile.
java-checks/src/main/java/org/sonar/java/checks/StringLiteralDuplicatedCheck.java
Show resolved
Hide resolved
…uplicatedCheck.java Co-authored-by: Dorian Burihabwa <[email protected]>
…teralDuplicatedCheckSample.java Co-authored-by: Dorian Burihabwa <[email protected]>
…teralDuplicatedCheckSample.java Co-authored-by: Dorian Burihabwa <[email protected]>
|
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.
LGTM 👍🏿
SONARJAVA-5232