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

Ensure consistent rules across IDEs and maven plugins #5

Open
imagejan opened this issue Jan 4, 2023 · 3 comments
Open

Ensure consistent rules across IDEs and maven plugins #5

imagejan opened this issue Jan 4, 2023 · 3 comments

Comments

@imagejan
Copy link
Member

imagejan commented Jan 4, 2023

From this discussion on zulip:

@ctrueden said:

make Eclipse and IntelliJ code formatting rules consistent, such that when you have auto-format-on-save turned on with those rules, it produces the same thing that mvn formatter:format + mvn impsort:sort does.

@maarzt
Copy link
Collaborator

maarzt commented Jan 23, 2023

I tried to configure IntelliJ in a way, that it formats code the same way as Eclipse with the imglib2 coding style does.

I learned this is impossible. First of all importing Eclipse formatter settings into IntelliJ doesn't work very well. Many of the settings are ignored. Second, there are some things, that the IntelliJ code formatter does always different than Eclipse. Most notably, Eclipse always adds a space character at the end of an empty javadoc line. IntelliJ always removes it. But there are other differences still I wasn't able to configure the Eclipse and IntelliJ formatter to indent loop labels the same way, etc...

These are minor differences but they remain.
There is a simple solution: Use the eclipse formatter plugin for IntelliJ.

(mvn formatter:format and Eclipse produce the same result anyway)

@maarzt
Copy link
Collaborator

maarzt commented Jan 23, 2023

Here is screenshot on how to configure Eclipse to sort imports the same way as mvn impsort:sort does:
image

@maarzt
Copy link
Collaborator

maarzt commented Jan 23, 2023

IntelliJ stores the import sorting settings together with the code formatting. We should have an IntelliJ code formatter setting for the scijava coding style. Here is the IntelliJ formatter settings file for the imglib2 / mastodon coding style

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

No branches or pull requests

2 participants