Make this line start at column 9 sonar violation f

2019-04-10 21:43发布

问题:

I am fixing all the sonar violation fix and I have nearly 6k issue like Make this line start at column 9" issues. I tried adding the java formatter, but it did not resolve the issue instead increase my sonar violation to 9k. Can you please let me know which java formatter to use so it will complaint.

           <plugin>
                <groupId>net.revelc.code</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <version>0.5.2</version>
            <executions>
                <execution>
                    <goals>
                        <goal>format</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
          or 
<!--Plugin for formatting the code base -->
        <plugin>
            <groupId>com.coveo</groupId>
            <artifactId>fmt-maven-plugin</artifactId>
            <version>1.0.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>format</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

I have tried both of these formaters, both did not resolve the issue instead increased the issue. The rule for this says Source code should be indented consistently. The formatter is taking care of this already not sure why this violation is happening. The rules says the indent should be consistent and it is consistent.

回答1:

So this is a little old but I thought I would go ahead and answer for the future. the columns are

12345

For this I believe setting your indentation to 2 and reformatting should fix everything.