Skip to content

Ensure consistent rules across IDEs and maven plugins #5

Open

Description

@imagejan

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.

Activity

  1. maarzt commented on Jan 23, 2023

    @maarzt
    Collaborator

    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)

  2. maarzt commented on Jan 23, 2023

    @maarzt
    Collaborator

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

  3. maarzt commented on Jan 23, 2023

    @maarzt
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions