Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make this line start at column 9 sonar violation fix(Source code should be indented consistently)

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.

like image 357
Harry Avatar asked Feb 02 '26 18:02

Harry


1 Answers

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.

like image 148
iCode4Fun Avatar answered Feb 04 '26 10:02

iCode4Fun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!