Checkstyle adjustments

Hi devs,

Indentation

I know we already voted this but since it was a long time ago, I’d like to make sure we’re all in agreement.

We used the Checkstyle <module name="Indentation"/> check (see https://checkstyle.sourceforge.io/config_misc.html#Indentation).

However until Checkstyle 6.3 we couldn’t enforce the indentation for line wrapping (that we defined at a strict 4 in the past).

So I’m proposing to:

  1. Configure it in checkstyle.xml
  2. Reformat our files accordingly

Left Curly

Right now we have:

    <module name="LeftCurly">
      <property name="option" value="nl"/>
      <property name="tokens" value="CLASS_DEF,INTERFACE_DEF"/>
    </module>

I’m proposing to add the following missing ones which correspond to our usage:

WDYT?

+1

I’m fine with those.

But there is an actually more important one missing: https://checkstyle.sourceforge.io/apidocs/com/puppycrawl/tools/checkstyle/api/TokenTypes.html#METHOD_DEF

Right, it was too big a miss and I missed it :wink:

To be clear this means using:

getLog().warn(String.format("Invalid project model for artifact [%s:%s:%s]. It will be ignored by "
    + "the remote resources Mojo.", artifact.getGroupId(), artifact.getArtifactId(),
    artifact.getVersion()));

instead of:

getLog().warn(String.format("Invalid project model for artifact [%s:%s:%s]. It will be ignored by "
    + "the remote resources Mojo.", artifact.getGroupId(), artifact.getArtifactId(),
        artifact.getVersion()));

Side note: I don’t think it’s possible to enforce having 4 spaces more at each indentation line with Checkstyle.

+1. We need to make sure that the Eclipse and IDEA code style configuration files are consistent.

Done. I’ve fixed commons, rendering and platform.

Regarding the indentation, I’ve opened https://youtrack.jetbrains.com/issue/IDEA-237404 for IntelliJ IDEA

So https://youtrack.jetbrains.com/issue/IDEA-237404 is now fixed and I’m able to implement the rule. See upcoming thread.