Skip to content

fix and automate importOrder with Maven Spotless Plugin#5776

Closed
Pankraz76 wants to merge 2 commits into
pmd:mainfrom
Pankraz76:Spotless
Closed

fix and automate importOrder with Maven Spotless Plugin#5776
Pankraz76 wants to merge 2 commits into
pmd:mainfrom
Pankraz76:Spotless

Conversation

@Pankraz76

@Pankraz76 Pankraz76 commented Jun 1, 2025

Copy link
Copy Markdown
Contributor

.extensions("cls", "trigger")
.addVersion("52")
.addVersion("53")
.addVersion("54")

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.

consider palantir block style like seen in spring:

spring-projects/spring-framework#34978

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.

@Pankraz76

Copy link
Copy Markdown
Contributor Author

now its up to you how to continue:

  • update custom formation config which seems outdated
  • or simply go with some big players default like google or palantir. Spotless offers it all.

@Pankraz76

Copy link
Copy Markdown
Contributor Author

@adangel @oowekyala what do you think? is pmd build already fixing itself like in maven?

@github-actions

github-actions Bot commented Jun 1, 2025

Copy link
Copy Markdown

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.

Regression Tester Report

(comment created at 2025-06-20 14:13:41+00:00 for 757a818)

@oowekyala oowekyala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This causes countless conflicts with main and with other in-flight PRs. Please adapt the formatter config to minimize changes.

@Pankraz76

Copy link
Copy Markdown
Contributor Author

adapt

yes we on the same page. This is kind of an issue itself, as new dev´s should use this config as setup.

Is there any chance to simple apply convention cover configuration and go with palantir block style? This would make things easy as relying on big players.

https://github.com/palantir/palantir-java-format

Adapting the config to checkstyle can be intense.

@Pankraz76 Pankraz76 changed the title PoC: integrate Eclipse Formatter Profile into Maven Spotless Plugin PoC: integrate Maven Spotless Plugin palantir-java-format: A modern, lambda-friendly, 120 character Java formatter. Jun 1, 2025
@Pankraz76

Copy link
Copy Markdown
Contributor Author

This causes countless conflicts with main and with other in-flight PRs. Please adapt the formatter config to minimize changes.

if config is updated it should be no problem. thats a good example why migration is useful. Replace 5 years ago cost of carry and apply once.

https://docs.pmd-code.org/latest/pmd_devdocs_contributing.html#code-style
https://github.com/pmd/build-tools/tree/main/eclipse

Comment thread pom.xml Outdated
@Pankraz76

Copy link
Copy Markdown
Contributor Author

please check on your system and give format on your behalf.

Current checkstyle config is pretty huge demanding cost of carry.

Might be simple to apply convention over configuration what PMD itself is about. Giving end on discussion and opinion, just going with common default crafted by community.

Only effort is to choose which one.

googleJavaFormat and palantirJavaFormat seem both justiciable. At the end its like everything a random implementation detail when aligned on some norm.

@Pankraz76 Pankraz76 requested a review from oowekyala June 2, 2025 20:04
@Pankraz76 Pankraz76 changed the title PoC: integrate Maven Spotless Plugin palantir-java-format: A modern, lambda-friendly, 120 character Java formatter. PoC: Replace checkstyle with Spotless & palantir-java-format: A modern, lambda-friendly, 120 character Java formatter. Jun 2, 2025
@Pankraz76

Pankraz76 commented Jun 11, 2025

Copy link
Copy Markdown
Contributor Author

@Pankraz76

Pankraz76 commented Jun 11, 2025

Copy link
Copy Markdown
Contributor Author

current flaws:

inconsistent (double) white lines:

image

why 2 lines? where is checkstyle?

image

@Pankraz76

Pankraz76 commented Jun 11, 2025

Copy link
Copy Markdown
Contributor Author

@Pankraz76

Pankraz76 commented Jun 11, 2025

Copy link
Copy Markdown
Contributor Author

no need to maintain limited tool check, imho. i like check very much, but spot is obviously superior.

facing all the issues, is thre any chance to really consider migration? @adangel

@Pankraz76 Pankraz76 changed the title PoC: Replace checkstyle with Spotless & palantir-java-format: A modern, lambda-friendly, 120 character Java formatter. fix unused imports and whitespaces with Maven Spotless Plugin Jun 19, 2025
Comment thread pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/ast/ASTBlockStatement.java Outdated
Comment thread .spotless/eclipse.importorder
@Pankraz76 Pankraz76 force-pushed the Spotless branch 2 times, most recently from ccc89ca to a2daa1a Compare June 19, 2025 19:19
@Pankraz76

Copy link
Copy Markdown
Contributor Author
[INFO] PMD Distribution Packages .......................... SUCCESS [ 10.023 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  04:34 min
[INFO] Finished at: 2025-06-19T21:32:30+02:00
[INFO] ------------------------------------------------------------------------
➜  pmd git:(Spotless) 

@Pankraz76

Copy link
Copy Markdown
Contributor Author

build pass 👍 thank you.

@Pankraz76 Pankraz76 changed the title fix unused imports and whitespaces with Maven Spotless Plugin automate import correction with Maven Spotless Plugin Jun 20, 2025
@Pankraz76 Pankraz76 changed the title automate import correction with Maven Spotless Plugin automate checkstyle import burden with Maven Spotless Plugin Jun 23, 2025
@Pankraz76 Pankraz76 changed the title automate checkstyle import burden with Maven Spotless Plugin automate checkstyle burden imposed on trimTrailingWhitespace and removeUnusedImports with Maven Spotless Plugin Jun 23, 2025
@oowekyala

Copy link
Copy Markdown
Member

Please discuss these changes in #5651.

@oowekyala oowekyala closed this Jun 23, 2025
@Pankraz76

Copy link
Copy Markdown
Contributor Author

@Pankraz76

Pankraz76 commented Jun 29, 2025

Copy link
Copy Markdown
Contributor Author

Please discuss these changes in #5651.

assuming approach is complain, as not contradiction encountered, we could reopen this to fix import burden and focus on features instead of being blocked by automatable cosmetics.

@Pankraz76 Pankraz76 changed the title automate checkstyle burden imposed on trimTrailingWhitespace and removeUnusedImports with Maven Spotless Plugin fix and automate importOrder with Maven Spotless Plugin Jun 30, 2025
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