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

戏子无情 提交于 2019-12-06 07:43:38

问题


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.



来源:https://stackoverflow.com/questions/39507485/make-this-line-start-at-column-9-sonar-violation-fixsource-code-should-be-inden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!