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

Spotless formatting #92

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pbaumard
Copy link

@pbaumard pbaumard commented Jan 6, 2025

See green-code-initiative/creedengo-common#56

Since this is just about introducing a common format defined by Spotless, a way to check the PR is:

  1. including the spotless configuration in pom.xml from main
  2. running mvn spotless:apply
  3. checking that there is no difference with this branch

@dedece35
Copy link
Member

Hi @pbaumard,
thank you for your PR but I'm not very comfortable with it.

We used to use the default configuration of our IDEs (IntelliJ and Visual Studio Code) that for example, 1 tabulation = 4 characters.
But for your plugin, 1 tabulation = 2 characters.

Thus the IDE standard configurations aren't the same as the plugin configuration.

The problem is that each developer have to change its configuration to be compliant with plugin configuration not to see a lot of formatting modifications in his small PR (for example).

What do you think @utarwyn about it ?

@utarwyn
Copy link
Member

utarwyn commented Jan 12, 2025

@dedece35
Hi pbaumard, thank you for your PR but I'm not very comfortable with it.
What do you think utarwyn about it ?

It's a simple subject, but one that needs to be discussed if we want to standardize the Java style of our Creedengo plugins.

I like the use of a tool like Spotless to apply a common formatting and check when submitting if everything is compliant. But I have the impression that here we're applying the Google style for Java, which is very opinionated. I don't agree with 100% of their rules, but here we have to use them all. Well.

I propose to provide configuration files for VSCode/Intellij to automatically rearrange files when saving with the editor's style. This could be a small 1st step, like you said.

@pbaumard
Copy link
Author

pbaumard commented Jan 13, 2025

I added the VSCode/Intellij configuration files for google-java-format. Some other IDEs are also supported, see google-java-format README. For Java sources, there is no other automated code formatting tool with as many IDEs supported.

About 2 chars vs 4 chars for tabs for example, one of the main points of Opinionated and automated code formatting is to stop discussing about individual preferences. This is also explained in google-java-format Wiki.

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

Successfully merging this pull request may close these issues.

3 participants