Skip to content

Conversation

@Pankraz76
Copy link

@Pankraz76 Pankraz76 commented Jan 8, 2026

@github-actions github-actions bot added triage PRs from the community streams core Kafka Broker producer consumer tools connect kraft storage Pull requests that target the storage module build Gradle build or GitHub Actions clients group-coordinator labels Jan 8, 2026
displayName: Apply all common best practices
description: Comprehensive code quality recipe combining modernization, security, and best practices.
recipeList:
- org.openrewrite.staticanalysis.InlineVariable
Copy link
Author

Choose a reason for hiding this comment

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

kindly asking, if this is any good?

@AndrewJSchofield

Copy link
Member

Choose a reason for hiding this comment

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

I do not have any experience of this. My view is that a PR which makes changes to the build should contain just those changes and you would need to convince a committer familiar with the build process that it was a worthwhile change.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, that's also a simple way to merge: activating the recipes after the merge.

Still, it's hard for me to believe that this will be merged without knowing upfront what it's doing and what the benefits are. This is the same task all the SCA tools have, so there are many ways to integrate. Of course, a small and simple approach is in my favor as well.

- org.openrewrite.staticanalysis.InlineVariable
# - org.openrewrite.staticanalysis.CommonStaticAnalysis # composition for -> NoDoubleBraceInitialization
# - org.openrewrite.staticanalysis.EqualsAvoidsNull
# - org.openrewrite.staticanalysis.NoDoubleBraceInitialization
Copy link
Author

Choose a reason for hiding this comment

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

also this could be handled next as also encountered in:

@mjsax

@Pankraz76 Pankraz76 marked this pull request as ready for review January 8, 2026 10:45
./gradlew spotlessApply

#### Rewrite
The build system incorporates [Moderne](https://moderne.io/) rewrite capabilities for automated code transformations.
Copy link
Member

@mjsax mjsax Jan 8, 2026

Choose a reason for hiding this comment

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

No idea what "Moderne" is. Do we want to depend on it? \cc @ijuma @chia7712

In general, I am a big supported to add checks and fail the build if we detect issue. but "automated code transformations" sounds not desirable to me personally

Copy link
Author

@Pankraz76 Pankraz76 Jan 9, 2026

Choose a reason for hiding this comment

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

Actually, it's not fully automated—it just fails the build when it detects problematic code, which is exactly what everyone wants to see.

Just like Error Prone offers patching, Rewrite does too. That's a good thing, because it saves time on trivial fixes that the tool can handle automatically.

Still, it's up to each developer to apply and verify the changes themselves. It's simply an optional tool (run), not a requirement.

As long as the code is complain in the end, Rewrite is satisfied. How you get there is up to each individual.

sounds not desirable to me personally

Also im wondering about this argument in the presents of spotless. This tool is all about automating stuff and patching. So its actually nothing new, just covers the most issues as well, but can got beyond as well, making it some consideration.

@github-actions github-actions bot removed the triage PRs from the community label Jan 9, 2026
@github-actions github-actions bot added the small Small PRs label Jan 9, 2026
@Pankraz76
Copy link
Author

adjusted to RemoveUnusedPrivateMethods. Here the value should be very simple to comprehend and rely on. Fortunately there is only 1 finding making it the ideal intro.

@Pankraz76 Pankraz76 changed the title MINOR: Add InlineVariable #21165 #21168 #21149 [RSPEC-S1488] MINOR: Add RemoveUnusedPrivateMethods #21165 #21168 #21149 [RSPEC-S1488] Jan 9, 2026
@squah-confluent
Copy link
Contributor

#21168's checks already exist as checkstyle's AvoidDoubleBraceInitialization and spotbugs' UPM_UNCALLED_PRIVATE_METHOD. It looks like your goal here is to introduce openrewrite as a whole rather than add any particular check.

The project already runs checkstyle for linting and spotbugs for static analysis. I do not think it makes sense to add a second linting and static analysis pass because of the overlap in functionality. If the proposal is to replace checkstyle and spotbugs with openrewrite, we should discuss that.

@chia7712
Copy link
Member

chia7712 commented Jan 9, 2026

If the proposal is to replace checkstyle and spotbugs with openrewrite, we should discuss that.

Spot on. +1.

@Pankraz76
Copy link
Author

Pankraz76 commented Jan 9, 2026

If the proposal is to replace checkstyle and spotbugs with openrewrite, we should discuss that.

No, that's not the goal. All the tools have their individual benefit. Even on one and the same issue like this, having a layered stack of Checkstyle, Spotless, SpotBugs, PMD, and Error Prone, Rewrite still finds some methods that all other tools don't. (That's actually the Checkstyle stack, so this is a real-world example.)

So it's about having redundancy in critical infrastructure.

BTW: Thats something Germany seems not been capable of, like recently seen.
Maybe this could be valuable example and lesson for others, to do better.

Also, each tool has its dedicated features, like Java migration as an example:

It's not about talking good or bad about any other tool. It's just about getting the job done on the unused method stuff, then considering that—beyond recipes—each offers individual benefit again.

So the discussion should be simple in this regard, as it's "only" a new tool solving an already applied convention.

@Pankraz76 Pankraz76 changed the title MINOR: Add RemoveUnusedPrivateMethods #21165 #21168 #21149 [RSPEC-S1488] MINOR: Add RemoveUnusedPrivateMethods #21165 #21168 #21149 Jan 9, 2026
@Pankraz76
Copy link
Author

Pankraz76 commented Jan 10, 2026

We can learn from Spotless that it seems acceptable to have this tool, as they asked to put an accidentally deleted rule back in.

From Checkstyle, we can learn that redundancy alone may not be enough — over time, surprising issues can arise, as usually expected.
For instance, a check might turn out not to be active in reality. Therefore, it’s better to have stronger safeguards in gatekeeping rather than weaker ones, to gather diverse perspectives and feedback.


Relying on a single point of failure — putting all your eggs in one basket — goes against common system design principles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Gradle build or GitHub Actions clients connect consumer core Kafka Broker group-coordinator kraft producer small Small PRs storage Pull requests that target the storage module streams tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants