Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Java files from default Maven Groovy formatting #1051

Merged
merged 4 commits into from
Jan 3, 2022

Conversation

lutovich
Copy link
Contributor

@lutovich lutovich commented Dec 27, 2021

All Groovy formatters will default to formatting only the following files:

  • src/main/groovy/**/*.groovy
  • src/test/groovy/**/*.groovy

They will not touch any .*java files.

Fixes #902.

@lutovich
Copy link
Contributor Author

It feels like Groovy formatters should not touch Java files by default. However, I do not know much about the groovy-eclipse formatter. This might be a backward-incompatible change. Any input is much appreciated!

@lutovich
Copy link
Contributor Author

Hi @bitwiseman, could you please take a look at this PR and the associated issue? Thanks!

@lutovich lutovich marked this pull request as ready for review December 27, 2021 10:51
All Groovy formatters will default to formatting only the following files:
 * src/main/groovy/**/*.groovy
 * src/test/groovy/**/*.groovy

They will not touch any .*java files.

Fixes diffplug#902.
* Before `3.0.0`, the default target of groovy was
* `src/main/groovy/**/*.groovy`
* `src/test/groovy/**/*.groovy`
* `src/main/groovy/**/*.java`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a small correction. I removed the following file masks:

  • src/main/java/**/*.java
  • src/test/java/**/*.java

The Groovy formatter tried to format Java sources that live under the Java sources root. I think it is weird and perhaps even undesirable to format such source files with a Groovy formatter. This PR changes the default behavior, but it is more like a fix in my opinion.

Copy link
Member

Choose a reason for hiding this comment

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

Oh man that is super weird! It's so weird my brain couldn't read it the first time, thanks for pointing that out! I always agreed that it was a fix, but now I also agree that it is not a "breaking fix".

@lutovich
Copy link
Contributor Author

lutovich commented Jan 3, 2022

Thank you @nedtwigg! I'll merge this PR.

@lutovich lutovich merged commit a749928 into diffplug:main Jan 3, 2022
@lutovich lutovich deleted the maven-groovy-no-format-java branch January 3, 2022 08:49
@lutovich
Copy link
Contributor Author

lutovich commented Jan 4, 2022

main branch build is failing after the merge. I will investigate.

@nedtwigg
Copy link
Member

nedtwigg commented Jan 6, 2022

Released in 2.19.0.

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.

Remove *.java files from default Maven Groovy formatting
3 participants