使这一行开始于第 9 列声纳违规修复(源代码应一致缩进)

2024-05-09Java开发问题
3

本文介绍了使这一行开始于第 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.

这篇关于使这一行开始于第 9 列声纳违规修复(源代码应一致缩进)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何使用 JAVA 向 COM PORT 发送数据?
How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)...
2024-08-25 Java开发问题
21

如何使报表页面方向更改为“rtl"?
How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)...
2024-08-25 Java开发问题
19

在 Eclipse 项目中使用西里尔文 .properties 文件
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)...
2024-08-25 Java开发问题
18

有没有办法在 Java 中检测 RTL 语言?
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)...
2024-08-25 Java开发问题
11

如何在 Java 中从 DB 加载资源包消息?
How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)...
2024-08-25 Java开发问题
13

如何更改 Java 中的默认语言环境设置以使其保持一致?
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)...
2024-08-25 Java开发问题
13