checkstyle对检查代码规范问题的总结,虽然还不够只能,但已经比较强大。
1.Cyclomatic Complexity is X (max allowed is X).
2.Nested if-else depth is X (max allowed is X).
3.Line matches the illegal pattern 'X'.
4.Must have at least one statement
5.Empty statement
6.Literal Strings should be compared using equals(), not 'X'.
7.switch without "default" clause.
8.Found duplicate of X lines in X, starting from line X
9.Assignment of parameter 'X' is not allowed.
10.'X' is a magic number.
11.Missing a Javadoc comment.
12.Expected X tag for 'X'.
13.Name 'X' must match pattern 'X'.
14.其他的都比较好理解。对于类,方法长度的控制,注释中各参数的说明等。
而对于圈复杂度过高,判断较复杂(if -elseif -elseif ...,switch case较多的判断)修改时还没有合适的方式。
本文总结了Checkstyle在代码规范检查中发现的常见问题及其修改建议,包括圈复杂度过高、if-else嵌套、非法字符使用、空语句、字符串比较错误、switch语句缺失default等情况,并提供了相应的解决策略。
1783

被折叠的 条评论
为什么被折叠?



