java sona 插件 提示 整理

                                    java sona 插件 提示 整理

Refactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed
重构此方法以将其认知复杂度从17降低到15

Remove this assignment of "dataSource".

Rename this field "format_insert_error" to match the regular expression '^[a-z][a-zA-Z0-9]*$'.


Remove this expression which always evaluates to "true"
删除该表达式,该表达式总是求值为“true”。

Merge this if statement with the enclosing one.
将此if语句与封闭语句合并。

Invoke method(s) only conditionally.
仅条件地调用方法。

Add a private constructor to hide the implicit public one.
添加一个私有构造函数来隐藏隐含的公共构造函数

Format specifiers should be used instead of string concatenation.
应该使用格式说明符来代替字符串连接。

Replace the type specification in this constructor call with the diamond operator ("<>").
用菱形运算符(“< >”)替换此构造函数调用中的类型规范。

Extract this nested try block into a separate method.
将这个嵌套的试块提取成一个单独的方法。

Remove this redundant jump.
删除此冗余跳转。

Replace this lambda with a method reference.
用方法引用替换这个lambda。

Define a constant instead of duplicating this literal "SendBatchNo" 3 times.
定义一个常量,而不是复制这个字面“StBaBeNeNo”3次。

Rename field "SENDBATCHNO" to prevent any misunderstanding/clash with field "sendBatchNo" defined on line 22
重命名字段“SENDBATCHNO”以防止与第22行定义的字段“sendBatchNo”发生任何误解/冲突

Replace this if-then-else statement by a single return statement.
用一个返回语句替换这个IF THEAR语句。

Either re-interrupt this method or rethrow the "InterruptedException".


Use "java.nio.Files#delete" here for better messages on error conditions.

Use isEmpty() to check whether the collection is empty or not.

A "NullPointerException" could be thrown; "columns" is nullable here.

Reduce the total number of break and continue statements in this loop to use at most one.
在这个循环中减少break和continue语句的总数,最多使用一个。

Merge this if statement with the enclosing one.
将该if语句与附带的if语句合并。

Remove useless curly braces around statement
删除语句周围无用的花括号

Lower the visibility of this setter or remove it altogether.
降低此setter的可见性或将其完全删除。

Make this final field static too.

Remove the "connector" field and declare it as a local variable in the relevant methods.

Immediately return this expression instead of assigning it to the temporary variable "ss".
立即返回此表达式,而不是将其分配给临时变量“ss”。

Use isEmpty() to check whether the collection is empty or not.
使用isEmpty()检查集合是否为空。

Use a variable binding mechanism to construct this query instead of concatenation.
使用变量绑定机制来构造此查询,而不是连接

String sql = "select column_name from user_col_comments where table_name='" + tableName + "'";
修改成
String sql = "select column_name from user_col_comments where table_name=?";
pstm = conn.prepareStatement(sql);
pstm.setString(1, tableName);

Remove this hard-coded password.
移除代码里硬编码的密码信息。

Remove this hard-coded path-delimiter.
删除此硬编码路径分隔符。

Remove useless curly braces around statement and then remove useless return keyword
移除语句周围无用的花括号,然后移除无用的返回

不符合代码示例
x -> {System.out.println(x+1);}
(a, b) -> { return a+b; }
解决方案
x -> System.out.println(x+1)
(a, b) -> a+b 

Reorder the modifiers to comply with the Java Language Specification.

问题代码
public final static String BOOLEAN = "Boolean";
解决方案
public static final String BOOLEAN = "Boolean";

Add a call to "setComplete()" on the SessionStatus object in a "@RequestMapping" method.
提示添加sessionStatus.setComplete();
解决方案
@PostMapping
public String processOrder(Taco taco, SessionStatus sessionStatus) {
    ...
    sessionStatus.setComplete();
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章