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();
}

 

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