Skip to content

SONARJAVA-6113 : implement rule S8444 : Excessive logic before super() should not bloat constructor#5452

Merged
rombirli merged 21 commits intomasterfrom
rombirli/SONARJAVA-6113-presuper-logic-shouldnt-bloat-constructor
Feb 13, 2026
Merged

SONARJAVA-6113 : implement rule S8444 : Excessive logic before super() should not bloat constructor#5452
rombirli merged 21 commits intomasterfrom
rombirli/SONARJAVA-6113-presuper-logic-shouldnt-bloat-constructor

Conversation

@rombirli
Copy link
Copy Markdown
Contributor

@rombirli rombirli commented Feb 10, 2026

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title SONARJAVA- 6113 presuper logic shouldnt bloat constructor SONARJAVA-6115 SONARJAVA- 6113 presuper logic shouldnt bloat constructor Feb 10, 2026
@hashicorp-vault-sonar-prod
Copy link
Copy Markdown
Contributor

hashicorp-vault-sonar-prod Bot commented Feb 10, 2026

SONARJAVA-6115

@rombirli rombirli changed the title SONARJAVA-6115 SONARJAVA- 6113 presuper logic shouldnt bloat constructor SONARJAVA-6113 : implement rule S8444 : Validation and transformation logic before super() should not bloat constructor Feb 10, 2026

@Rule(key = "S8444")
public class PresuperLogicBloatsConstructorCheck extends FlexibleConstructorCheck {
private static final int MAX_STATEMENTS_BEFORE_CONSTRUCTOR_CALL = 3;
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.

We've decided about initial threshold = 5 AFAIR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes thank you, I didn't remember, applied it

.onFile(nonCompilingTestSourcesPath("checks/PresuperLogicShoudntBloatConstructorSample.java"))
.withCheck(new PresuperLogicBloatsConstructorCheck())
.withJavaVersion(25)
.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.

Add the test to check that there are no issues for JDK24.

@rombirli rombirli changed the title SONARJAVA-6113 : implement rule S8444 : Validation and transformation logic before super() should not bloat constructor SONARJAVA-6113 : implement rule S8444 : Excessive logic before super() should not bloat constructor Feb 11, 2026
@rombirli rombirli force-pushed the rombirli/SONARJAVA-6113-presuper-logic-shouldnt-bloat-constructor branch from 6d6430a to 493d4c1 Compare February 11, 2026 15:49
@sonarqube-next
Copy link
Copy Markdown

@rombirli rombirli marked this pull request as ready for review February 12, 2026 10:48
Copy link
Copy Markdown
Contributor

@asya-vorobeva asya-vorobeva left a comment

Choose a reason for hiding this comment

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

💯

@rombirli rombirli merged commit ad56ce1 into master Feb 13, 2026
17 checks passed
@rombirli rombirli deleted the rombirli/SONARJAVA-6113-presuper-logic-shouldnt-bloat-constructor branch February 13, 2026 07:29
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