You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Vincent Potucek <vp...@me.com.INVALID> on 2025/05/16 08:42:10 UTC

Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Dear colleagues,

It’s great to see our codebase seriously embracing functional programming, leveraging higher-order functions and avoiding boilerplate. This is a fantastic achievement and a testament to the progress discussed in recent PRs.

I'd like to propose enhancing our code quality tooling by introducing OpenRewrite, which would complement our existing Spotless and Checkstyle setup.

Current Situation:

Spotless handles formatting (cosmetic changes)

Checkstyle performs basic static analysis (file-level parsing)

Both have limited capabilities in detecting and automatically fixing deeper code quality issues

The Problem:

We’re missing type-aware static analysis that can:

Detect more sophisticated issues in the codebase

Automatically fix them (reducing manual effort)

Catch patterns typically handled by PMD or SpotBugs

Why OpenRewrite?

Goes beyond formatting to fix real code issues

Can automatically remediate many common problems

Integrates well with existing tools

Offers recipes for security best practices, removing unused code, and more

Example Benefits:

Fix wildcard imports (not currently handled by Spotless)
→ GitHub Issue #5413 <https://github.com/openrewrite/rewrite/issues/5413#issuecomment-2885362961>
Remove unused parameters, variables, and methods

Apply secure coding practices (e.g., secure temp file creation)

Automate JUnit migrations

Covers 400+ bug patterns with ready-to-use and extensible recipes

Notable Recipes:

RemoveUnusedParams
→ PR #560 <https://github.com/openrewrite/rewrite-static-analysis/pull/560>
→ Maven PR #2338 <https://github.com/apache/maven/pull/2338>
ReplaceCollectToListWithToList
→ PR #558 <https://github.com/openrewrite/rewrite-static-analysis/pull/558>
→ Maven PR #2277 <https://github.com/apache/maven/pull/2277>
Implementation Approach:

Add as an optional profile, similar to Spotless

Supports dry-run mode to preview changes before applying

Can be automated to run in full auto-fix mode, like Spotless

Optionally fail builds on detected issues, like Checkstyle

This wouldn’t replace our current tools but would add another layer of quality control, while reducing maintenance overhead through automated fixes.

Before moving forward, I’d love to hear your thoughts:

Does this direction make sense?

Any concerns about adding another tool?

Any specific recipes you’d like to include or exclude?

I believe this could greatly enhance our code quality and maintainability with minimal overhead. The extra CPU cycles are likely worth the long-term savings in manual review and rework.

POC: Apache Maven PR #2322 <https://github.com/apache/maven/pull/2322>
Looking forward to your feedback.

Best regards,
Vincent



Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by Vincent Potucek <vp...@me.com.INVALID>.
Yes, thanks—I'll investigate this. It’s kind of funny, you must have seen, that we already delivered POC for exact case. Seems to work this time, as it’s mostly renaming. https://github.com/apache/maven/pull/2330

Of course, this is within the scope of recipes and will evolve over time. It's true that all software has bugs, and Rewrite is no exception. I've already fixed several bugs myself, such as those in the RemoveUnusedPrivateMethods recipe and others.  

Common recipes, like detecting unused code (despite occasional false positives), are generally stable. If a recipe doesn’t work, we can either disable it or fix it ourselves.

While having bugs is an unfortunate reality, using that as an argument against implementing any quality gate seems counterproductive.

Adding PMD as a complement to Rewrite seems like a good idea. Rewrite has bugs too and isn’t perfect—like everything else.  

PMD is a proven tool and would provide similar coverage to Rewrite, though without the auto-fix capability.

The main difference is convenience, which impacts adoption. For Checkstyle developers, passing PMD, even Spotbugs, is mandatory—applying best practices should be standard.  


> On 16. May 2025, at 21:36, Jeremy Landis <je...@hotmail.com> wrote:
> 
> Open rewrite is very buggy.  It's typically a one-shot effort and not worth being in direct builds.  I've used it for years and have it in direct builds both on github and at my job.  I'm not impressed.  Half of it just copied what IDEs do and more often than not it fails to do it correctly.  Try migrating junit 4 to 5 on a multi module build then you will get an eye full of its issues.  For a helper tool on the side it helps get you started but generally fails to do a complete job.  I think only things that fully work should be in standard build cycles.
> 
> Sent from my Verizon, Samsung Galaxy smartphone
> Get Outlook for Android<https://aka.ms/AAb9ysg>
> ________________________________
> From: Romain Manni-Bucau <rm...@gmail.com>
> Sent: Friday, May 16, 2025 5:42:19 AM
> To: vpotucek@me.com.invalid <vp...@me.com.invalid>
> Cc: dev@maven.apache.org <de...@maven.apache.org>
> Subject: Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle
> 
> Hi,
> 
> I'd love to move to a single tool, we can already drop checkstyle in favor
> of spotless and the issue spotless has will likely be fixed.
> For the automated fixes, I think we are all using IDE but it can be good to
> get it at build time if the cost is not more than spotless (max a few sec),
> if it is more - sonar style ;) - the cost of the extra CPU cycles will be a
> killer for contribution IMHO and not worth regarding the added value.
> 
> Just my 2 cts.
> 
> Romain Manni-Bucau
> @rmannibucau <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fx.com%2Frmannibucau&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737144394%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=V6Bk9N42fpV67lqFzJR28YxYM71Zqg5hhx99hl0HZi0%3D&reserved=0<https://x.com/rmannibucau>> | .NET Blog
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdotnetbirdie.github.io%2F&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737168881%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=UCvgIokmSbHoTG4xkiwWxeDYXDdNTt06ME3wKTZ%2BwLs%3D&reserved=0<https://dotnetbirdie.github.io/>> | Blog <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Frmannibucau.github.io%2F&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737191582%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Gbb2iV3CTApDzWn2hhskWSIwcdn0OT8O7krJnU6m%2B%2F8%3D&reserved=0<https://rmannibucau.github.io/>> | Old
> Blog <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Frmannibucau.wordpress.com%2F&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737211415%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Dtn0VOIubUxr7FYl4Kw2dn3%2Fa%2F1VnN6GGJrYjYUaEc4%3D&reserved=0<http://rmannibucau.wordpress.com/>> | Github
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frmannibucau&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737231253%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aqNnn2bWl3m9hOj4WE6q1w1CWyrgIFtjnaxbWwTxXWM%3D&reserved=0<https://github.com/rmannibucau>> | LinkedIn
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Frmannibucau&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737586555%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=%2BXg%2FlM70mlanVnMEdIKaHcWFpyfbgp%2F%2BCL1zRye9oEU%3D&reserved=0<https://www.linkedin.com/in/rmannibucau>> | Book
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.packtpub.com%2Fen-us%2Fproduct%2Fjava-ee-8-high-performance-9781788473064&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737605360%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=eyz6St28BsOt1UInkISy7veYyptwQyRerXylW8XiADU%3D&reserved=0<https://www.packtpub.com/en-us/product/java-ee-8-high-performance-9781788473064>>
> 
> 
> Le ven. 16 mai 2025 à 10:42, Vincent Potucek <vp...@me.com.invalid> a
> écrit :
> 
>> Dear colleagues,
>> 
>> It’s great to see our codebase seriously embracing functional programming,
>> leveraging higher-order functions and avoiding boilerplate. This is a
>> fantastic achievement and a testament to the progress discussed in recent
>> PRs.
>> 
>> I'd like to propose enhancing our code quality tooling by introducing
>> OpenRewrite, which would complement our existing Spotless and Checkstyle
>> setup.
>> 
>> Current Situation:
>> 
>> Spotless handles formatting (cosmetic changes)
>> 
>> Checkstyle performs basic static analysis (file-level parsing)
>> 
>> Both have limited capabilities in detecting and automatically fixing
>> deeper code quality issues
>> 
>> The Problem:
>> 
>> We’re missing type-aware static analysis that can:
>> 
>> Detect more sophisticated issues in the codebase
>> 
>> Automatically fix them (reducing manual effort)
>> 
>> Catch patterns typically handled by PMD or SpotBugs
>> 
>> Why OpenRewrite?
>> 
>> Goes beyond formatting to fix real code issues
>> 
>> Can automatically remediate many common problems
>> 
>> Integrates well with existing tools
>> 
>> Offers recipes for security best practices, removing unused code, and more
>> 
>> Example Benefits:
>> 
>> Fix wildcard imports (not currently handled by Spotless)
>> → GitHub Issue #5413 <
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenrewrite%2Frewrite%2Fissues%2F5413%23issuecomment-2885362961&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737620775%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ZRo6i6Ruu8ps9kDpkcd9ZDl3CzVRRAsScbyeHVbyRYU%3D&reserved=0<https://github.com/openrewrite/rewrite/issues/5413#issuecomment-2885362961>
>>> 
>> Remove unused parameters, variables, and methods
>> 
>> Apply secure coding practices (e.g., secure temp file creation)
>> 
>> Automate JUnit migrations
>> 
>> Covers 400+ bug patterns with ready-to-use and extensible recipes
>> 
>> Notable Recipes:
>> 
>> RemoveUnusedParams
>> → PR #560 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenrewrite%2Frewrite-static-analysis%2Fpull%2F560&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737635727%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=platJCBvLqwUuZzMb05Y45tj0W9DeEMbwodY59fcZig%3D&reserved=0
>>> 
>> → Maven PR #2338 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fmaven%2Fpull%2F2338&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737650793%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ox5mp63YBTHCETVtE3kTJxh751XMHYltvMTThy%2BCklE%3D&reserved=0<https://github.com/apache/maven/pull/2338>>
>> ReplaceCollectToListWithToList
>> → PR #558 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenrewrite%2Frewrite-static-analysis%2Fpull%2F558&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737666949%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=b7gU6IS3YX%2BeIFsBHiALpwTsZLr9fezqxRBCZ%2Fl2gwQ%3D&reserved=0
>>> 
>> → Maven PR #2277 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fmaven%2Fpull%2F2277&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737682091%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=1ncxgFW5L5nzluj2PM4ORPEugKCE%2F1Vx%2FsgxH3MXu3s%3D&reserved=0<https://github.com/apache/maven/pull/2277>>
>> Implementation Approach:
>> 
>> Add as an optional profile, similar to Spotless
>> 
>> Supports dry-run mode to preview changes before applying
>> 
>> Can be automated to run in full auto-fix mode, like Spotless
>> 
>> Optionally fail builds on detected issues, like Checkstyle
>> 
>> This wouldn’t replace our current tools but would add another layer of
>> quality control, while reducing maintenance overhead through automated
>> fixes.
>> 
>> Before moving forward, I’d love to hear your thoughts:
>> 
>> Does this direction make sense?
>> 
>> Any concerns about adding another tool?
>> 
>> Any specific recipes you’d like to include or exclude?
>> 
>> I believe this could greatly enhance our code quality and maintainability
>> with minimal overhead. The extra CPU cycles are likely worth the long-term
>> savings in manual review and rework.
>> 
>> POC: Apache Maven PR #2322 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fmaven%2Fpull%2F2322&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737697144%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=q1sebRe56s8l1Ahl92ZbJ9R7qBQ1EtpT%2BYSIwxbwZao%3D&reserved=0<https://github.com/apache/maven/pull/2322>>
>> Looking forward to your feedback.
>> 
>> Best regards,
>> Vincent
>> 
>> 
>> 


Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by Jeremy Landis <je...@hotmail.com>.
Open rewrite is very buggy.  It's typically a one-shot effort and not worth being in direct builds.  I've used it for years and have it in direct builds both on github and at my job.  I'm not impressed.  Half of it just copied what IDEs do and more often than not it fails to do it correctly.  Try migrating junit 4 to 5 on a multi module build then you will get an eye full of its issues.  For a helper tool on the side it helps get you started but generally fails to do a complete job.  I think only things that fully work should be in standard build cycles.

Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Romain Manni-Bucau <rm...@gmail.com>
Sent: Friday, May 16, 2025 5:42:19 AM
To: vpotucek@me.com.invalid <vp...@me.com.invalid>
Cc: dev@maven.apache.org <de...@maven.apache.org>
Subject: Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Hi,

I'd love to move to a single tool, we can already drop checkstyle in favor
of spotless and the issue spotless has will likely be fixed.
For the automated fixes, I think we are all using IDE but it can be good to
get it at build time if the cost is not more than spotless (max a few sec),
if it is more - sonar style ;) - the cost of the extra CPU cycles will be a
killer for contribution IMHO and not worth regarding the added value.

Just my 2 cts.

Romain Manni-Bucau
@rmannibucau <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fx.com%2Frmannibucau&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737144394%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=V6Bk9N42fpV67lqFzJR28YxYM71Zqg5hhx99hl0HZi0%3D&reserved=0<https://x.com/rmannibucau>> | .NET Blog
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdotnetbirdie.github.io%2F&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737168881%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=UCvgIokmSbHoTG4xkiwWxeDYXDdNTt06ME3wKTZ%2BwLs%3D&reserved=0<https://dotnetbirdie.github.io/>> | Blog <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Frmannibucau.github.io%2F&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737191582%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Gbb2iV3CTApDzWn2hhskWSIwcdn0OT8O7krJnU6m%2B%2F8%3D&reserved=0<https://rmannibucau.github.io/>> | Old
Blog <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Frmannibucau.wordpress.com%2F&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737211415%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Dtn0VOIubUxr7FYl4Kw2dn3%2Fa%2F1VnN6GGJrYjYUaEc4%3D&reserved=0<http://rmannibucau.wordpress.com/>> | Github
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frmannibucau&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737231253%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=aqNnn2bWl3m9hOj4WE6q1w1CWyrgIFtjnaxbWwTxXWM%3D&reserved=0<https://github.com/rmannibucau>> | LinkedIn
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Frmannibucau&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737586555%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=%2BXg%2FlM70mlanVnMEdIKaHcWFpyfbgp%2F%2BCL1zRye9oEU%3D&reserved=0<https://www.linkedin.com/in/rmannibucau>> | Book
<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.packtpub.com%2Fen-us%2Fproduct%2Fjava-ee-8-high-performance-9781788473064&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737605360%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=eyz6St28BsOt1UInkISy7veYyptwQyRerXylW8XiADU%3D&reserved=0<https://www.packtpub.com/en-us/product/java-ee-8-high-performance-9781788473064>>


Le ven. 16 mai 2025 à 10:42, Vincent Potucek <vp...@me.com.invalid> a
écrit :

> Dear colleagues,
>
> It’s great to see our codebase seriously embracing functional programming,
> leveraging higher-order functions and avoiding boilerplate. This is a
> fantastic achievement and a testament to the progress discussed in recent
> PRs.
>
> I'd like to propose enhancing our code quality tooling by introducing
> OpenRewrite, which would complement our existing Spotless and Checkstyle
> setup.
>
> Current Situation:
>
> Spotless handles formatting (cosmetic changes)
>
> Checkstyle performs basic static analysis (file-level parsing)
>
> Both have limited capabilities in detecting and automatically fixing
> deeper code quality issues
>
> The Problem:
>
> We’re missing type-aware static analysis that can:
>
> Detect more sophisticated issues in the codebase
>
> Automatically fix them (reducing manual effort)
>
> Catch patterns typically handled by PMD or SpotBugs
>
> Why OpenRewrite?
>
> Goes beyond formatting to fix real code issues
>
> Can automatically remediate many common problems
>
> Integrates well with existing tools
>
> Offers recipes for security best practices, removing unused code, and more
>
> Example Benefits:
>
> Fix wildcard imports (not currently handled by Spotless)
> → GitHub Issue #5413 <
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenrewrite%2Frewrite%2Fissues%2F5413%23issuecomment-2885362961&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737620775%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ZRo6i6Ruu8ps9kDpkcd9ZDl3CzVRRAsScbyeHVbyRYU%3D&reserved=0<https://github.com/openrewrite/rewrite/issues/5413#issuecomment-2885362961>
> >
> Remove unused parameters, variables, and methods
>
> Apply secure coding practices (e.g., secure temp file creation)
>
> Automate JUnit migrations
>
> Covers 400+ bug patterns with ready-to-use and extensible recipes
>
> Notable Recipes:
>
> RemoveUnusedParams
> → PR #560 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenrewrite%2Frewrite-static-analysis%2Fpull%2F560&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737635727%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=platJCBvLqwUuZzMb05Y45tj0W9DeEMbwodY59fcZig%3D&reserved=0
> >
> → Maven PR #2338 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fmaven%2Fpull%2F2338&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737650793%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ox5mp63YBTHCETVtE3kTJxh751XMHYltvMTThy%2BCklE%3D&reserved=0<https://github.com/apache/maven/pull/2338>>
> ReplaceCollectToListWithToList
> → PR #558 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenrewrite%2Frewrite-static-analysis%2Fpull%2F558&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737666949%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=b7gU6IS3YX%2BeIFsBHiALpwTsZLr9fezqxRBCZ%2Fl2gwQ%3D&reserved=0
> >
> → Maven PR #2277 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fmaven%2Fpull%2F2277&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737682091%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=1ncxgFW5L5nzluj2PM4ORPEugKCE%2F1Vx%2FsgxH3MXu3s%3D&reserved=0<https://github.com/apache/maven/pull/2277>>
> Implementation Approach:
>
> Add as an optional profile, similar to Spotless
>
> Supports dry-run mode to preview changes before applying
>
> Can be automated to run in full auto-fix mode, like Spotless
>
> Optionally fail builds on detected issues, like Checkstyle
>
> This wouldn’t replace our current tools but would add another layer of
> quality control, while reducing maintenance overhead through automated
> fixes.
>
> Before moving forward, I’d love to hear your thoughts:
>
> Does this direction make sense?
>
> Any concerns about adding another tool?
>
> Any specific recipes you’d like to include or exclude?
>
> I believe this could greatly enhance our code quality and maintainability
> with minimal overhead. The extra CPU cycles are likely worth the long-term
> savings in manual review and rework.
>
> POC: Apache Maven PR #2322 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Fmaven%2Fpull%2F2322&data=05%7C02%7C%7C8c63a15cfac94429e1b208dd945e418d%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638829855737697144%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=q1sebRe56s8l1Ahl92ZbJ9R7qBQ1EtpT%2BYSIwxbwZao%3D&reserved=0<https://github.com/apache/maven/pull/2322>>
> Looking forward to your feedback.
>
> Best regards,
> Vincent
>
>
>

Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by Vincent Potucek <vp...@me.com.INVALID>.
Thanks for ideation. We’re aligned on consolidating tooling long-term. Spotless alone isn’t sufficient, facing real bugs and hundreds PMD violations.

It’s great for local dev ergonomics, but seems to miss out on being type-aware like PMD, SpotBugs, and Rewrite. Overlapping such tools seems reasonable, as nobody’s perfect—each obtain its blind spots.

This applies to SpotBugs as well. While developing in Checkstyle itself, it's rare to see SpotBugs break the build, since it runs after PMD. Yet even SpotBugs and PMD aren’t consistent with each other. No single tool, covers all issues.

For example, we currently can’t meet PMD’s best practices because:

Spotless doesn’t go deep enough, or

It’s misconfigured assuming the convention-over-configuration principle.

Following PR show the extent of suppressions that would otherwise be needed:

https://github.com/apache/maven/pull/2331

We could suppress all ~200 PMD issues—but that defeats the purpose. Rewrite is capable of auto-fixing these. For instance:

PMD violation: UnnecessaryFullyQualifiedName <https://pmd.github.io/pmd/pmd_rules_java_codestyle.html#unnecessaryfullyqualifiedname>
Rewrite fix: ShortenFullyQualifiedTypeReferences <https://docs.openrewrite.org/recipes/java/shortenfullyqualifiedtypereferences>
Rewrite takes about ~2 minutes. Yes, that’s more than Spotless—but it finds real, preventable issues:

Bug: https://github.com/apache/maven/pull/2312

Overhead: https://github.com/apache/maven/pull/2310

The full build time (clean install -DskipTests) increases (from 1:31 to 3:55 with Rewrite), but is ment to live in could anyway.

Once we go several months without any meaningful findings from PMD or Rewrite, we can revisit simplification. As Rewrite evolve, its seems to naturally outsmart its rivals, as they lack auto-fix.

Proposed setup:

✅ Spotless/Checkstyle: local-only (fast formatting)

✅ Rewrite (and might even consider PMD): CI/cloud (deeper checks (strong quality gate) + auto-fix-checks)

When CI fails, due to corrupt coding, simply give: mvn rewrite:run. It’ll fix issues automatically—just like Spotless does for formatting, but with much broader scope.

Thanks for considering, kindly request your feedback.

PS:

See dedicated projects (wondering why there’s non linked in repo for spot, might be kind of a statement, framing the whole topic.) - No offence against spot, it's nifty and convenient.


https://pmd.github.io/

https://spotbugs.github.io/

https://docs.openrewrite.org/


> On 16. May 2025, at 11:42, Romain Manni-Bucau <rm...@gmail.com> wrote:
> 
> Hi,
> 
> I'd love to move to a single tool, we can already drop checkstyle in favor
> of spotless and the issue spotless has will likely be fixed.
> For the automated fixes, I think we are all using IDE but it can be good to
> get it at build time if the cost is not more than spotless (max a few sec),
> if it is more - sonar style ;) - the cost of the extra CPU cycles will be a
> killer for contribution IMHO and not worth regarding the added value.
> 
> Just my 2 cts.
> 
> Romain Manni-Bucau
> @rmannibucau <https://x.com/rmannibucau> | .NET Blog
> <https://dotnetbirdie.github.io/> | Blog <https://rmannibucau.github.io/> | Old
> Blog <http://rmannibucau.wordpress.com <http://rmannibucau.wordpress.com/>> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Book
> <https://www.packtpub.com/en-us/product/java-ee-8-high-performance-9781788473064>
> 
> 
> Le ven. 16 mai 2025 à 10:42, Vincent Potucek <vpotucek@me.com.invalid <ma...@me.com.invalid>> a
> écrit :
> 
>> Dear colleagues,
>> 
>> It’s great to see our codebase seriously embracing functional programming,
>> leveraging higher-order functions and avoiding boilerplate. This is a
>> fantastic achievement and a testament to the progress discussed in recent
>> PRs.
>> 
>> I'd like to propose enhancing our code quality tooling by introducing
>> OpenRewrite, which would complement our existing Spotless and Checkstyle
>> setup.
>> 
>> Current Situation:
>> 
>> Spotless handles formatting (cosmetic changes)
>> 
>> Checkstyle performs basic static analysis (file-level parsing)
>> 
>> Both have limited capabilities in detecting and automatically fixing
>> deeper code quality issues
>> 
>> The Problem:
>> 
>> We’re missing type-aware static analysis that can:
>> 
>> Detect more sophisticated issues in the codebase
>> 
>> Automatically fix them (reducing manual effort)
>> 
>> Catch patterns typically handled by PMD or SpotBugs
>> 
>> Why OpenRewrite?
>> 
>> Goes beyond formatting to fix real code issues
>> 
>> Can automatically remediate many common problems
>> 
>> Integrates well with existing tools
>> 
>> Offers recipes for security best practices, removing unused code, and more
>> 
>> Example Benefits:
>> 
>> Fix wildcard imports (not currently handled by Spotless)
>> → GitHub Issue #5413 <
>> https://github.com/openrewrite/rewrite/issues/5413#issuecomment-2885362961
>>> 
>> Remove unused parameters, variables, and methods
>> 
>> Apply secure coding practices (e.g., secure temp file creation)
>> 
>> Automate JUnit migrations
>> 
>> Covers 400+ bug patterns with ready-to-use and extensible recipes
>> 
>> Notable Recipes:
>> 
>> RemoveUnusedParams
>> → PR #560 <https://github.com/openrewrite/rewrite-static-analysis/pull/560
>>> 
>> → Maven PR #2338 <https://github.com/apache/maven/pull/2338>
>> ReplaceCollectToListWithToList
>> → PR #558 <https://github.com/openrewrite/rewrite-static-analysis/pull/558
>>> 
>> → Maven PR #2277 <https://github.com/apache/maven/pull/2277>
>> Implementation Approach:
>> 
>> Add as an optional profile, similar to Spotless
>> 
>> Supports dry-run mode to preview changes before applying
>> 
>> Can be automated to run in full auto-fix mode, like Spotless
>> 
>> Optionally fail builds on detected issues, like Checkstyle
>> 
>> This wouldn’t replace our current tools but would add another layer of
>> quality control, while reducing maintenance overhead through automated
>> fixes.
>> 
>> Before moving forward, I’d love to hear your thoughts:
>> 
>> Does this direction make sense?
>> 
>> Any concerns about adding another tool?
>> 
>> Any specific recipes you’d like to include or exclude?
>> 
>> I believe this could greatly enhance our code quality and maintainability
>> with minimal overhead. The extra CPU cycles are likely worth the long-term
>> savings in manual review and rework.
>> 
>> POC: Apache Maven PR #2322 <https://github.com/apache/maven/pull/2322>
>> Looking forward to your feedback.
>> 
>> Best regards,
>> Vincent


Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

I'd love to move to a single tool, we can already drop checkstyle in favor
of spotless and the issue spotless has will likely be fixed.
For the automated fixes, I think we are all using IDE but it can be good to
get it at build time if the cost is not more than spotless (max a few sec),
if it is more - sonar style ;) - the cost of the extra CPU cycles will be a
killer for contribution IMHO and not worth regarding the added value.

Just my 2 cts.

Romain Manni-Bucau
@rmannibucau <https://x.com/rmannibucau> | .NET Blog
<https://dotnetbirdie.github.io/> | Blog <https://rmannibucau.github.io/> | Old
Blog <http://rmannibucau.wordpress.com> | Github
<https://github.com/rmannibucau> | LinkedIn
<https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/en-us/product/java-ee-8-high-performance-9781788473064>


Le ven. 16 mai 2025 à 10:42, Vincent Potucek <vp...@me.com.invalid> a
écrit :

> Dear colleagues,
>
> It’s great to see our codebase seriously embracing functional programming,
> leveraging higher-order functions and avoiding boilerplate. This is a
> fantastic achievement and a testament to the progress discussed in recent
> PRs.
>
> I'd like to propose enhancing our code quality tooling by introducing
> OpenRewrite, which would complement our existing Spotless and Checkstyle
> setup.
>
> Current Situation:
>
> Spotless handles formatting (cosmetic changes)
>
> Checkstyle performs basic static analysis (file-level parsing)
>
> Both have limited capabilities in detecting and automatically fixing
> deeper code quality issues
>
> The Problem:
>
> We’re missing type-aware static analysis that can:
>
> Detect more sophisticated issues in the codebase
>
> Automatically fix them (reducing manual effort)
>
> Catch patterns typically handled by PMD or SpotBugs
>
> Why OpenRewrite?
>
> Goes beyond formatting to fix real code issues
>
> Can automatically remediate many common problems
>
> Integrates well with existing tools
>
> Offers recipes for security best practices, removing unused code, and more
>
> Example Benefits:
>
> Fix wildcard imports (not currently handled by Spotless)
> → GitHub Issue #5413 <
> https://github.com/openrewrite/rewrite/issues/5413#issuecomment-2885362961
> >
> Remove unused parameters, variables, and methods
>
> Apply secure coding practices (e.g., secure temp file creation)
>
> Automate JUnit migrations
>
> Covers 400+ bug patterns with ready-to-use and extensible recipes
>
> Notable Recipes:
>
> RemoveUnusedParams
> → PR #560 <https://github.com/openrewrite/rewrite-static-analysis/pull/560
> >
> → Maven PR #2338 <https://github.com/apache/maven/pull/2338>
> ReplaceCollectToListWithToList
> → PR #558 <https://github.com/openrewrite/rewrite-static-analysis/pull/558
> >
> → Maven PR #2277 <https://github.com/apache/maven/pull/2277>
> Implementation Approach:
>
> Add as an optional profile, similar to Spotless
>
> Supports dry-run mode to preview changes before applying
>
> Can be automated to run in full auto-fix mode, like Spotless
>
> Optionally fail builds on detected issues, like Checkstyle
>
> This wouldn’t replace our current tools but would add another layer of
> quality control, while reducing maintenance overhead through automated
> fixes.
>
> Before moving forward, I’d love to hear your thoughts:
>
> Does this direction make sense?
>
> Any concerns about adding another tool?
>
> Any specific recipes you’d like to include or exclude?
>
> I believe this could greatly enhance our code quality and maintainability
> with minimal overhead. The extra CPU cycles are likely worth the long-term
> savings in manual review and rework.
>
> POC: Apache Maven PR #2322 <https://github.com/apache/maven/pull/2322>
> Looking forward to your feedback.
>
> Best regards,
> Vincent
>
>
>

Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by "Piotr P. Karwasz" <pi...@mailing.copernik.eu>.
Hi all,

In Log4j we have used OpenRewrite to fix several inconsistencies between
our 2.x and 3.x branches and to remove Java 8 patterns from our Java 17
code. I can sincerely recommend it.

While it is still work in progress, our migration guide from Log4j 1 to
Log4j 2 will contain OpenRewrite recipes at each step:

https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html

And of course there are recipes to migrate from foreign logging APIs to
Log4j API (I wonder how they ended up there ;-) ).

On 16.05.2025 10:42, Vincent Potucek wrote:
> Goes beyond formatting to fix real code issues

Unless something changed recently, OpenRewrite does not format code and
Spotless is required to fix code formatting.

> Covers 400+ bug patterns with ready-to-use and extensible recipes

A little gotcha: not all these recipes are Open Source. Many of them are
under a source-available license, which is something to take into
account before contributing.

Piotr

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by Vincent Potucek <vp...@me.com.INVALID>.
Yes, thanks for discussion. Seems closed, as PMD the new rewrite then. Might use old version to fix legacy, as it was open source.

Will give new mail on PMD/spotbugs.

Happy coding.

> On 17. May 2025, at 13:01, Slawomir Jaranowski <s....@gmail.com> wrote:
> 
> We should be aware and take care about the license of openwrite and single
> rules.
> 
> https://docs.openrewrite.org/reference/latest-versions-of-every-openrewrite-module
> 
> On Fri, 16 May 2025 at 10:42, Vincent Potucek <vp...@me.com.invalid>
> wrote:
> 
>> Dear colleagues,
>> 
>> It’s great to see our codebase seriously embracing functional programming,
>> leveraging higher-order functions and avoiding boilerplate. This is a
>> fantastic achievement and a testament to the progress discussed in recent
>> PRs.
>> 
>> I'd like to propose enhancing our code quality tooling by introducing
>> OpenRewrite, which would complement our existing Spotless and Checkstyle
>> setup.
>> 
>> Current Situation:
>> 
>> Spotless handles formatting (cosmetic changes)
>> 
>> Checkstyle performs basic static analysis (file-level parsing)
>> 
>> Both have limited capabilities in detecting and automatically fixing
>> deeper code quality issues
>> 
>> The Problem:
>> 
>> We’re missing type-aware static analysis that can:
>> 
>> Detect more sophisticated issues in the codebase
>> 
>> Automatically fix them (reducing manual effort)
>> 
>> Catch patterns typically handled by PMD or SpotBugs
>> 
>> Why OpenRewrite?
>> 
>> Goes beyond formatting to fix real code issues
>> 
>> Can automatically remediate many common problems
>> 
>> Integrates well with existing tools
>> 
>> Offers recipes for security best practices, removing unused code, and more
>> 
>> Example Benefits:
>> 
>> Fix wildcard imports (not currently handled by Spotless)
>> → GitHub Issue #5413 <
>> https://github.com/openrewrite/rewrite/issues/5413#issuecomment-2885362961
>>> 
>> Remove unused parameters, variables, and methods
>> 
>> Apply secure coding practices (e.g., secure temp file creation)
>> 
>> Automate JUnit migrations
>> 
>> Covers 400+ bug patterns with ready-to-use and extensible recipes
>> 
>> Notable Recipes:
>> 
>> RemoveUnusedParams
>> → PR #560 <https://github.com/openrewrite/rewrite-static-analysis/pull/560
>>> 
>> → Maven PR #2338 <https://github.com/apache/maven/pull/2338>
>> ReplaceCollectToListWithToList
>> → PR #558 <https://github.com/openrewrite/rewrite-static-analysis/pull/558
>>> 
>> → Maven PR #2277 <https://github.com/apache/maven/pull/2277>
>> Implementation Approach:
>> 
>> Add as an optional profile, similar to Spotless
>> 
>> Supports dry-run mode to preview changes before applying
>> 
>> Can be automated to run in full auto-fix mode, like Spotless
>> 
>> Optionally fail builds on detected issues, like Checkstyle
>> 
>> This wouldn’t replace our current tools but would add another layer of
>> quality control, while reducing maintenance overhead through automated
>> fixes.
>> 
>> Before moving forward, I’d love to hear your thoughts:
>> 
>> Does this direction make sense?
>> 
>> Any concerns about adding another tool?
>> 
>> Any specific recipes you’d like to include or exclude?
>> 
>> I believe this could greatly enhance our code quality and maintainability
>> with minimal overhead. The extra CPU cycles are likely worth the long-term
>> savings in manual review and rework.
>> 
>> POC: Apache Maven PR #2322 <https://github.com/apache/maven/pull/2322>
>> Looking forward to your feedback.
>> 
>> Best regards,
>> Vincent
>> 
>> 
>> 
> 
> -- 
> Sławomir Jaranowski


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by Slawomir Jaranowski <s....@gmail.com>.
We should be aware and take care about the license of openwrite and single
rules.

https://docs.openrewrite.org/reference/latest-versions-of-every-openrewrite-module

On Fri, 16 May 2025 at 10:42, Vincent Potucek <vp...@me.com.invalid>
wrote:

> Dear colleagues,
>
> It’s great to see our codebase seriously embracing functional programming,
> leveraging higher-order functions and avoiding boilerplate. This is a
> fantastic achievement and a testament to the progress discussed in recent
> PRs.
>
> I'd like to propose enhancing our code quality tooling by introducing
> OpenRewrite, which would complement our existing Spotless and Checkstyle
> setup.
>
> Current Situation:
>
> Spotless handles formatting (cosmetic changes)
>
> Checkstyle performs basic static analysis (file-level parsing)
>
> Both have limited capabilities in detecting and automatically fixing
> deeper code quality issues
>
> The Problem:
>
> We’re missing type-aware static analysis that can:
>
> Detect more sophisticated issues in the codebase
>
> Automatically fix them (reducing manual effort)
>
> Catch patterns typically handled by PMD or SpotBugs
>
> Why OpenRewrite?
>
> Goes beyond formatting to fix real code issues
>
> Can automatically remediate many common problems
>
> Integrates well with existing tools
>
> Offers recipes for security best practices, removing unused code, and more
>
> Example Benefits:
>
> Fix wildcard imports (not currently handled by Spotless)
> → GitHub Issue #5413 <
> https://github.com/openrewrite/rewrite/issues/5413#issuecomment-2885362961
> >
> Remove unused parameters, variables, and methods
>
> Apply secure coding practices (e.g., secure temp file creation)
>
> Automate JUnit migrations
>
> Covers 400+ bug patterns with ready-to-use and extensible recipes
>
> Notable Recipes:
>
> RemoveUnusedParams
> → PR #560 <https://github.com/openrewrite/rewrite-static-analysis/pull/560
> >
> → Maven PR #2338 <https://github.com/apache/maven/pull/2338>
> ReplaceCollectToListWithToList
> → PR #558 <https://github.com/openrewrite/rewrite-static-analysis/pull/558
> >
> → Maven PR #2277 <https://github.com/apache/maven/pull/2277>
> Implementation Approach:
>
> Add as an optional profile, similar to Spotless
>
> Supports dry-run mode to preview changes before applying
>
> Can be automated to run in full auto-fix mode, like Spotless
>
> Optionally fail builds on detected issues, like Checkstyle
>
> This wouldn’t replace our current tools but would add another layer of
> quality control, while reducing maintenance overhead through automated
> fixes.
>
> Before moving forward, I’d love to hear your thoughts:
>
> Does this direction make sense?
>
> Any concerns about adding another tool?
>
> Any specific recipes you’d like to include or exclude?
>
> I believe this could greatly enhance our code quality and maintainability
> with minimal overhead. The extra CPU cycles are likely worth the long-term
> savings in manual review and rework.
>
> POC: Apache Maven PR #2322 <https://github.com/apache/maven/pull/2322>
> Looking forward to your feedback.
>
> Best regards,
> Vincent
>
>
>

-- 
Sławomir Jaranowski

Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by Vincent Potucek <vp...@me.com.INVALID>.
> On 16. May 2025, at 22:36, Henning Schmiedehausen <he...@schmiedehausen.org.INVALID> wrote:
> 
> On Fri, May 16, 2025 at 1:43 AM Vincent Potucek <vpotucek@me.com.invalid <ma...@me.com.invalid>>
> wrote:
> 
>> Dear colleagues,
>> 
> 
> I am not your colleague.
> 
> Frankly, posting with a mail address of "me.com.invalid" makes me press
> "Spam" usually right away. As this message has received some replies from
> other developers, here is my take:
> 
> "Vendor spam".
> 
> This is a pretty questionable way to engage with this group. Based on last
> year's license change for part of the code base (see
> https://medium.com/@jonathan.leitschuh/when-open-source-isnt-how-openrewrite-lost-its-way-642053be287d)
> I am not sure that such an engagement is in good faith. I would stay away
> from that tool.

Good point.

Then consider PMD. Use rewrite once to fix existing violations, melt down suppression.

Integration is possible either way, to prevent any further!

Then the auto fix is very questionable, as its personal choice to code complain or being “informed”.

> 
> -h
> 
> 
> 
>> It’s great to see our codebase seriously embracing functional programming,
>> leveraging higher-order functions and avoiding boilerplate. This is a
>> fantastic achievement and a testament to the progress discussed in recent
>> PRs.
>> 
>> I'd like to propose enhancing our code quality tooling by introducing
>> OpenRewrite, which would complement our existing Spotless and Checkstyle
>> setup.
>> 
>> Current Situation:
>> 
>> Spotless handles formatting (cosmetic changes)
>> 
>> Checkstyle performs basic static analysis (file-level parsing)
>> 
>> Both have limited capabilities in detecting and automatically fixing
>> deeper code quality issues
>> 
>> The Problem:
>> 
>> We’re missing type-aware static analysis that can:
>> 
>> Detect more sophisticated issues in the codebase
>> 
>> Automatically fix them (reducing manual effort)
>> 
>> Catch patterns typically handled by PMD or SpotBugs
>> 
>> Why OpenRewrite?
>> 
>> Goes beyond formatting to fix real code issues
>> 
>> Can automatically remediate many common problems
>> 
>> Integrates well with existing tools
>> 
>> Offers recipes for security best practices, removing unused code, and more
>> 
>> Example Benefits:
>> 
>> Fix wildcard imports (not currently handled by Spotless)
>> → GitHub Issue #5413 <
>> https://github.com/openrewrite/rewrite/issues/5413#issuecomment-2885362961
>>> 
>> Remove unused parameters, variables, and methods
>> 
>> Apply secure coding practices (e.g., secure temp file creation)
>> 
>> Automate JUnit migrations
>> 
>> Covers 400+ bug patterns with ready-to-use and extensible recipes
>> 
>> Notable Recipes:
>> 
>> RemoveUnusedParams
>> → PR #560 <https://github.com/openrewrite/rewrite-static-analysis/pull/560
>>> 
>> → Maven PR #2338 <https://github.com/apache/maven/pull/2338>
>> ReplaceCollectToListWithToList
>> → PR #558 <https://github.com/openrewrite/rewrite-static-analysis/pull/558
>>> 
>> → Maven PR #2277 <https://github.com/apache/maven/pull/2277>
>> Implementation Approach:
>> 
>> Add as an optional profile, similar to Spotless
>> 
>> Supports dry-run mode to preview changes before applying
>> 
>> Can be automated to run in full auto-fix mode, like Spotless
>> 
>> Optionally fail builds on detected issues, like Checkstyle
>> 
>> This wouldn’t replace our current tools but would add another layer of
>> quality control, while reducing maintenance overhead through automated
>> fixes.
>> 
>> Before moving forward, I’d love to hear your thoughts:
>> 
>> Does this direction make sense?
>> 
>> Any concerns about adding another tool?
>> 
>> Any specific recipes you’d like to include or exclude?
>> 
>> I believe this could greatly enhance our code quality and maintainability
>> with minimal overhead. The extra CPU cycles are likely worth the long-term
>> savings in manual review and rework.
>> 
>> POC: Apache Maven PR #2322 <https://github.com/apache/maven/pull/2322>
>> Looking forward to your feedback.
>> 
>> Best regards,
>> Vincent


Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by "Piotr P. Karwasz" <pi...@mailing.copernik.eu>.
Hi,

On 16.05.2025 22:48, Piotr Żygieło wrote:
> On Fri, 16 May 2025 at 22:37, Henning Schmiedehausen
> <he...@schmiedehausen.org.invalid> wrote:
>> Frankly, posting with a mail address of "me.com.invalid" makes me press
> 
> schmiedehausen.org.invalid
> 
> (https://lists.apache.org/api/source.lua?id=kf906zch8lho65q70s92gnw2p1wbt3o7)

This might be due to `ezmlm`: `schmiedehausen.org` has a DMARC policy of
`quarantine`, so the From: header is changed to prevent DMARC failures
on delivery.

My DMARC record on the e-mail I use for MLs is `none`, so nothing needs
to be rewritten.

Piotr


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by Piotr Żygieło <pi...@gmail.com>.
On Fri, 16 May 2025 at 22:37, Henning Schmiedehausen
<he...@schmiedehausen.org.invalid> wrote:
> Frankly, posting with a mail address of "me.com.invalid" makes me press

schmiedehausen.org.invalid

(https://lists.apache.org/api/source.lua?id=kf906zch8lho65q70s92gnw2p1wbt3o7)

-- 
Piotrek

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Proposal: Enhance code quality checks with OpenRewrite in addition to Spotless/Checkstyle

Posted by Henning Schmiedehausen <he...@schmiedehausen.org.INVALID>.
On Fri, May 16, 2025 at 1:43 AM Vincent Potucek <vp...@me.com.invalid>
wrote:

> Dear colleagues,
>

I am not your colleague.

Frankly, posting with a mail address of "me.com.invalid" makes me press
"Spam" usually right away. As this message has received some replies from
other developers, here is my take:

"Vendor spam".

This is a pretty questionable way to engage with this group. Based on last
year's license change for part of the code base (see
https://medium.com/@jonathan.leitschuh/when-open-source-isnt-how-openrewrite-lost-its-way-642053be287d)
I am not sure that such an engagement is in good faith. I would stay away
from that tool.

-h



> It’s great to see our codebase seriously embracing functional programming,
> leveraging higher-order functions and avoiding boilerplate. This is a
> fantastic achievement and a testament to the progress discussed in recent
> PRs.
>
> I'd like to propose enhancing our code quality tooling by introducing
> OpenRewrite, which would complement our existing Spotless and Checkstyle
> setup.
>
> Current Situation:
>
> Spotless handles formatting (cosmetic changes)
>
> Checkstyle performs basic static analysis (file-level parsing)
>
> Both have limited capabilities in detecting and automatically fixing
> deeper code quality issues
>
> The Problem:
>
> We’re missing type-aware static analysis that can:
>
> Detect more sophisticated issues in the codebase
>
> Automatically fix them (reducing manual effort)
>
> Catch patterns typically handled by PMD or SpotBugs
>
> Why OpenRewrite?
>
> Goes beyond formatting to fix real code issues
>
> Can automatically remediate many common problems
>
> Integrates well with existing tools
>
> Offers recipes for security best practices, removing unused code, and more
>
> Example Benefits:
>
> Fix wildcard imports (not currently handled by Spotless)
> → GitHub Issue #5413 <
> https://github.com/openrewrite/rewrite/issues/5413#issuecomment-2885362961
> >
> Remove unused parameters, variables, and methods
>
> Apply secure coding practices (e.g., secure temp file creation)
>
> Automate JUnit migrations
>
> Covers 400+ bug patterns with ready-to-use and extensible recipes
>
> Notable Recipes:
>
> RemoveUnusedParams
> → PR #560 <https://github.com/openrewrite/rewrite-static-analysis/pull/560
> >
> → Maven PR #2338 <https://github.com/apache/maven/pull/2338>
> ReplaceCollectToListWithToList
> → PR #558 <https://github.com/openrewrite/rewrite-static-analysis/pull/558
> >
> → Maven PR #2277 <https://github.com/apache/maven/pull/2277>
> Implementation Approach:
>
> Add as an optional profile, similar to Spotless
>
> Supports dry-run mode to preview changes before applying
>
> Can be automated to run in full auto-fix mode, like Spotless
>
> Optionally fail builds on detected issues, like Checkstyle
>
> This wouldn’t replace our current tools but would add another layer of
> quality control, while reducing maintenance overhead through automated
> fixes.
>
> Before moving forward, I’d love to hear your thoughts:
>
> Does this direction make sense?
>
> Any concerns about adding another tool?
>
> Any specific recipes you’d like to include or exclude?
>
> I believe this could greatly enhance our code quality and maintainability
> with minimal overhead. The extra CPU cycles are likely worth the long-term
> savings in manual review and rework.
>
> POC: Apache Maven PR #2322 <https://github.com/apache/maven/pull/2322>
> Looking forward to your feedback.
>
> Best regards,
> Vincent
>
>
>