Skip to content

SONARJAVA-4935 S1192 should not report on individual lines of multi line string literal#4767

Merged
leonardo-pilastri-sonarsource merged 4 commits intomasterfrom
marco/SONARJAVA-4935
Apr 15, 2024
Merged

SONARJAVA-4935 S1192 should not report on individual lines of multi line string literal#4767
leonardo-pilastri-sonarsource merged 4 commits intomasterfrom
marco/SONARJAVA-4935

Conversation

@kaufco
Copy link
Copy Markdown
Contributor

@kaufco kaufco commented Apr 12, 2024

No description provided.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me! Just a simplification on a method.
Also I didn't want to mark multiple lines for formatting issues, can you reformat the code with the next commit?

Comment on lines +143 to +144
private static BinaryExpressionTree asBinaryExpression(Tree tree, Tree.Kind kind) {
return tree.is(kind)? (BinaryExpressionTree) tree: null;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since we are only dealing with strings here, we will never need to use other kinds than PLUS, so we can remove the method's argument and adapt the other method calls in the check

Suggested change
private static BinaryExpressionTree asBinaryExpression(Tree tree, Tree.Kind kind) {
return tree.is(kind)? (BinaryExpressionTree) tree: null;
private static BinaryExpressionTree asBinaryExpression(Tree tree) {
return tree.is(Tree.Kind.PLUS) ? (BinaryExpressionTree) tree: null;

@sonarqube-next
Copy link
Copy Markdown

@leonardo-pilastri-sonarsource leonardo-pilastri-sonarsource deleted the marco/SONARJAVA-4935 branch April 15, 2024 15:35
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