Skip to content

apply pmd-eclipse-code-formatter.xml via spotless#5925

Closed
Pankraz76 wants to merge 1 commit into
pmd:mainfrom
Pankraz76:eclipse-Spotless-pr
Closed

apply pmd-eclipse-code-formatter.xml via spotless#5925
Pankraz76 wants to merge 1 commit into
pmd:mainfrom
Pankraz76:eclipse-Spotless-pr

Conversation

@Pankraz76

@Pankraz76 Pankraz76 commented Jul 20, 2025

Copy link
Copy Markdown
Contributor

apply pmd-eclipse-code-formatter.xml via spotless

as the convention are now fully taken care by spot, the broken harmony on the config between the imposed eclipse format and enrolled check config require the need for action.

This is one variant improving the dev exp.

following the contribution guide this again seems to be outdated, at least when applying the config the code changes and checkstyle violates:

Related issues

  • Fix #

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@Pankraz76

Copy link
Copy Markdown
Contributor Author

[INFO] --- checkstyle:3.6.0:check (checkstyle-check) @ pmd-core ---
[INFO] There are 10 errors reported by Checkstyle 10.26.1 with /net/sourceforge/pmd/pmd-checkstyle-config.xml ruleset.
[ERROR] src/main/java/net/sourceforge/pmd/cache/internal/ClasspathFingerprinter.java:[25,107] (indentation) CommentsIndentation: Comment has incorrect indentation level 106, expected is 12, indentation should be the same level as line 26.
[ERROR] src/main/java/net/sourceforge/pmd/lang/document/SourceCodePositioner.java:[224,32] (indentation) CommentsIndentation: Comment has incorrect indentation level 31, expected is 8, indentation should be the same level as line 225.
[ERROR] src/main/java/net/sourceforge/pmd/lang/ast/impl/javacc/CharStream.java:[121,11] (indentation) CommentsIndentation: Comment has incorrect indentation level 10, expected is 8, indentation should be the same level as line 117.
[ERROR] src/main/java/net/sourceforge/pmd/lang/PlainTextLanguage.java:[43,26] (indentation) CommentsIndentation: Comment has incorrect indentation level 25, expected is 8, indentation should be the same level as line 42.
[ERROR] src/main/java/net/sourceforge/pmd/properties/internal/PropertyTypeId.java:[59,105] (indentation) CommentsIndentation: Comment has incorrect indentation level 104, expected is 4, indentation should be the same level as line 61.
[ERROR] src/test/java/net/sourceforge/pmd/renderers/XMLRendererTest.java:[154,61] (indentation) CommentsIndentation: Comment has incorrect indentation level 60, expected is 12, indentation should be the same level as line 155.
[ERROR] src/test/java/net/sourceforge/pmd/util/IOUtilTest.java:[211,27] (indentation) CommentsIndentation: Comment has incorrect indentation level 26, expected is 8, indentation should be the same level as line 213.
[ERROR] src/test/java/net/sourceforge/pmd/lang/rule/RuleSetFactoryTest.java:[638,115] (indentation) CommentsIndentation: Comment has incorrect indentation level 114, expected is 8, indentation should be the same level as line 639.
[ERROR] src/test/java/net/sourceforge/pmd/lang/rule/xpath/internal/SaxonXPathRuleQueryTest.java:[67,9] (indentation) CommentsIndentation: Comment has incorrect indentation level 8, expected is 16, indentation should be the same level as line 68.
[ERROR] src/test/java/net/sourceforge/pmd/properties/PropertyDescriptorTest.java:[53,106] (indentation) CommentsIndentation: Comment has incorrect indentation level 105, expected is 24, indentation should be the same level as line 54.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for PMD 7.16.0-SNAPSHOT:
[INFO]
[INFO] PMD ................................................ SUCCESS [ 4.466 s]
[INFO] PMD Core ........................................... FAILURE [ 14.274 s]
[INFO] PMD Test Schema .................................... SKIPPED
[INFO] PMD Ant Integration ................................ SKIPPED
[INFO] PMD Test Framework ................................. SKIPPED
[INFO] PMD language module testing utilities .............. SKIPPED
[INFO] PMD Apex ........................................... SKIPPED

@Pankraz76

Copy link
Copy Markdown
Contributor Author

have i choose the wrong config or is it like the imports just outdated?

@adangel

@Pankraz76 Pankraz76 changed the title apply pmd-eclipse-code-formatter.xml ## apply pmd-eclipse-code-formatter.xml via spotless Jul 21, 2025
@Pankraz76 Pankraz76 changed the title ## apply pmd-eclipse-code-formatter.xml via spotless apply pmd-eclipse-code-formatter.xml via spotless Jul 21, 2025
@Pankraz76 Pankraz76 force-pushed the eclipse-Spotless-pr branch from e9dc6f8 to 499a71e Compare July 21, 2025 18:46
@Pankraz76 Pankraz76 marked this pull request as ready for review July 21, 2025 18:46
@Pankraz76

Copy link
Copy Markdown
Contributor Author

kindly request your feedback. @oowekyala

plugin support as well:

image

@Pankraz76

Copy link
Copy Markdown
Contributor Author

just need to run apply goal then its good to go, fully applying your convention hardly configured twice but not fully lived twice therefore only one could remain until you ether merge them or go with the working one which is eclipse controlled by spot.

@oowekyala

Copy link
Copy Markdown
Member

We are still discussing #5875 and, like your other PRs, you do not explain how your change makes things better. So I think you should start by engaging in #5875 and describe a solution that we can agree on before trying to open a PR.

@oowekyala oowekyala closed this Jul 28, 2025
@Pankraz76

Copy link
Copy Markdown
Contributor Author

have i choose the wrong config or is it like the imports just outdated?

@adangel

plz try to consider. its still a topic non a improvement but maybe broken config. thats two different kind.

@adangel

adangel commented Aug 2, 2025

Copy link
Copy Markdown
Member

maybe broken config

have you tried to confirm this?

Step by step:

  1. install intellij and configure a local dev environment according to https://docs.pmd-code.org/latest/pmd_devdocs_building_intellij.html
  2. install eclipse and configure a local dev environment according to https://docs.pmd-code.org/latest/pmd_devdocs_building_eclipse.html
  3. compare the code formatter configurations
  4. present your findings

@Pankraz76

Copy link
Copy Markdown
Contributor Author

done. I did not configure idea, but the maven plugin. Both will refer to some eclipse jar applying the format.

The only issue could be a version diff, but this is very unlikely according to the 7 years its not been updated, just like the config before.

@Pankraz76

This comment was marked as resolved.

@Pankraz76

Copy link
Copy Markdown
Contributor Author

Lets start with real errors and then fix the broken format.

@Pankraz76

Copy link
Copy Markdown
Contributor Author

have you tried to confirm this?

Yes the whole PR is just about this.

See what two different eclipse parsers do with the same config:

@Pankraz76

Copy link
Copy Markdown
Contributor Author

Yes the whole PR is just about this.

the PR is idempotent.

Step by step:

  1. install intellij and configure a local dev environment according to https://docs.pmd-code.org/latest/pmd_devdocs_building_intellij.html
  2. install eclipse and configure a local dev environment according to https://docs.pmd-code.org/latest/pmd_devdocs_building_eclipse.html
  3. compare the code formatter configurations
  4. present your findings

This setup is not.

@Pankraz76

Copy link
Copy Markdown
Contributor Author

have really tried to config this but again thats why i dont use some crazy gui and spend effort on endless config over and over.

Using the maven plugin is easy. The gui is to high end for me.

image

@Pankraz76

Copy link
Copy Markdown
Contributor Author
  1. present your findings

if you want i can make another one with this plugin:

Assuming you have the IDE ready. Can you (re)format the whole project without any changed? This would be the expectation and the status quo after plugin installation.

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.

3 participants