Skip to content

SONARJAVA-5494 Add rule for redundant new class name argument in transformClass call#5220

Merged
romainbrenguier merged 6 commits intomasterfrom
romain/S7477
Jul 1, 2025
Merged

SONARJAVA-5494 Add rule for redundant new class name argument in transformClass call#5220
romainbrenguier merged 6 commits intomasterfrom
romain/S7477

Conversation

@romainbrenguier
Copy link
Copy Markdown
Contributor

@romainbrenguier romainbrenguier commented Jun 30, 2025

@romainbrenguier romainbrenguier force-pushed the romain/S7477 branch 4 times, most recently from 1c89d31 to 3d2f157 Compare June 30, 2025 12:21
.withCheck(new ClassNameInClassTransformCheck())
.verifyIssues();
}

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.

let's test without semantics


static class ExpressionMatcher {
@Nullable
ExpressionTree expressionTree;
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.

I think we can add private final

ClassFile classFile = ClassFile.of();
ClassModel classModel = classFile.parse(path);
return classFile.transformClass(classModel,
classModel.thisClass(), // Noncompliant
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.

I think it would be good to test the message name at some point

@sonarqube-next
Copy link
Copy Markdown

sonarqube-next Bot commented Jul 1, 2025

@romainbrenguier romainbrenguier merged commit ae437c3 into master Jul 1, 2025
15 of 16 checks passed
@romainbrenguier romainbrenguier deleted the romain/S7477 branch July 1, 2025 08:48
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