SONARJAVA-6119 S3078 report on compact source files#5456
SONARJAVA-6119 S3078 report on compact source files#5456tomasz-tylenda-sonarsource merged 2 commits intomasterfrom
Conversation
rombirli
left a comment
There was a problem hiding this comment.
This PR looks good. just small comments about initial implementation of this rule
| CLASS, | ||
| IMPLICIT_CLASS: |
There was a problem hiding this comment.
I think that interfaces (with default implementation) and records should also be checked here
There was a problem hiding this comment.
Fixed.
| private void checkBooleanToggling(Tree tree, Symbol identifierSymbol) { | ||
| Tree parent = tree.parent(); | ||
| if (parent.is(Tree.Kind.PARENTHESIZED_EXPRESSION)) { | ||
| checkBooleanToggling(parent, identifierSymbol); | ||
| } else if (parent.is(Tree.Kind.ASSIGNMENT)) { | ||
| IdentifierTree variableIdentifier = getVariableIdentifier(((AssignmentExpressionTree) parent).variable()); | ||
| if (variableIdentifier != null && identifierSymbol.equals(variableIdentifier.symbol())) { | ||
| reportIssueIfNotInExcludedContext(tree, "AtomicBoolean"); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
I know you didn't write it, but i dont see why boolean toggling is a specific case and I believe that any assignation should be checked (instead of only boolean togglings)
There was a problem hiding this comment.
Discussed offline: this is out of scope for this PR, but I created https://sonarsource.atlassian.net/browse/SONARJAVA-6125.
|




No description provided.