使这一行开始于第 9 列声纳违规修复(源代码应一致缩进)
我正在修复所有声纳违规问题,我有将近 6k 的问题,例如 Make this line start at column 9"
问题.我尝试添加 java 格式化程序,但它并没有解决问题将我的声纳违规增加到 9k.请告诉我要使用哪种 java 格式化程序,以便它会投诉.
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.
推荐答案
所以这有点老了,但我想我会继续回答未来.列是
So this is a little old but I thought I would go ahead and answer for the future. the columns are
12345
为此,我相信将缩进设置为 2 并重新格式化应该可以解决所有问题.
For this I believe setting your indentation to 2 and reformatting should fix everything.
相关文章