Skip to content
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

Closed
wants to merge 13 commits into from

Conversation

tomasz-tylenda-sonarsource
Copy link
Contributor

@tomasz-tylenda-sonarsource tomasz-tylenda-sonarsource commented Jan 21, 2025

@tomasz-tylenda-sonarsource tomasz-tylenda-sonarsource changed the title SONARJAVA-5232 S1192: Do not consider arguments in Throwables when checking for dupl… SONARJAVA-5232 S1192: Do not consider arguments in Throwables when checking for duplicated strings Jan 21, 2025
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
1 New issue
89.7% Coverage on New Code (required ≥ 95%)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube IDE SonarQube IDE

Copy link

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

@github-actions github-actions bot added the stale label Jan 29, 2025
@github-actions github-actions bot removed the stale label Jan 30, 2025
Comment on lines +108 to +113
.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();

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏿

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants