Cosium / git-code-format-maven-plugin

A maven plugin that automatically deploys code formatters as pre-commit git hook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AOSP indents 8 instead of 4

ngomichael opened this issue · comments

Hi,

I'm having an issue with the plugin indenting 8 spaces instead of 4 in some parts of my code.

Here is my plugin config:

<plugin>
    <groupId>com.cosium.code</groupId>
    <artifactId>git-code-format-maven-plugin</artifactId>
    <version>2.4</version>
    <dependencies>
        <dependency>
            <groupId>com.cosium.code</groupId>
            <artifactId>git-code-format-maven-plugin</artifactId>
            <version>2.4</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <id>install-formatter-hook</id>
            <goals>
                <goal>install-hooks</goal>
            </goals>
        </execution>
        <execution>
            <id>validate-code-format</id>
             <goals>
                <goal>validate-code-format</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <googleJavaFormatOptions>
            <aosp>true</aosp>
            <fixImportsOnly>false</fixImportsOnly>
            <skipSortingImports>false</skipSortingImports>
            <skipRemovingUnusedImports>false</skipRemovingUnusedImports>
        </googleJavaFormatOptions>
    </configuration>
</plugin>

Here is an example:

public String method() {
      return something
              .method(argument)
              .map(y -> y.toUpperCase());
}
public String method() {
  |-4-|return something
          |-8-|.method(argument)
          |-8-|.map(y -> y.toUpperCase());
}

I would expect:

public String method() {
      return something
          .method(argument)
          .map(y -> y.toUpperCase());
}
public String method() {
  |-4-|return something
         |-4-|.method(argument)
         |-4-|.map(y -> y.toUpperCase());
}

Is there a reason why not all indentation is 4 spaces? I gave a basic example, but when things are nested deeper the 8 space indentation becomes an issue.

Thank you!

Hello,

Is the result different when you use google java format without this plugin?

Hey,

It looks like using AOSP style results in 8 space indents.