1、Abbreviation As Word In Name (默认 关闭)
坏味道 主要
检查验证标识符名称中的缩写(连续大写字母)长度,还允许执行骆驼案例命名
allowedAbbreviationLength 3 
6、Annotation Location (默认 关闭)
坏味道 主要
注释位置
allowSamelineSingleParameterlessAnnotation
To allow single parameterless annotation to be located on the same line as target element.
默认值true
allowSamelineParameterizedAnnotation
To allow parameterized annotation to be located on the same line as target element.
默认值false
allowSamelineMultipleAnnotations
To allow annotation to be located on the same line as target element.
默认值false
tokens
tokens to check
默认值CLASS_DEF,INTERFACE_DEF,ENUM_DEF,METHOD_DEF,CTOR_DEF,VARIABLE_DEF
7、Annotation Use Style (默认 关闭)
坏味道 主要
trailingArrayComma
Defines the policy for trailing comma in arrays. Default is never.
closingParens

Defines the policy for ending parenthesis. Default is never.
elementStyle

Defines the annotation element styles. Default value is compact_no_array.
8、Artifact ids should follow a naming convention (默认 关闭)
坏味道 次要
共享命名约定允许团队有效协作。 当pom的artifactId与提供的正则表达式不匹配时,此规则引发了一个问题
regex The regular expression the "artifactId" should match
默认值[a-z][a-z-0-9]+
9、At-clause Order (默认 关闭) 
坏味道 主要
检查从句顺序
tagOrder 
allows to specify the order by tags.
默认值
@author,@version,@param,@return,@throws,@exception,@see,@since,@serial,@serialField,@serialData,@deprecated target allows to specify targets to check at-clauses.
10、Avoid Escaped Unicode Characters (默认 关闭)
坏味道 主要
避免转义的Unicode字符
allowIfAllCharactersEscaped
Allow if all characters in literal are escaped.
默认值false
allowNonPrintableEscapes
Allow non-printable escapes.
默认值false
allowByTailComment
Allow use escapes if trail comment is present.
默认值false
allowEscapesForControlCharacters
Allow use escapes for non-printable(control) characters.
默认值false
11、Avoid Nested Blocks (默认 关闭)
坏味道 主要
避免嵌套块
allowInSwitchCase 
Allow nested blocks in case statements. Default is false.
12、Avoid Star Import (默认 关闭)
坏味道 次要
检查发现使用*符号的导入语句
excludes packages where star imports are allowed. Note that this property is not recursive, subpackages of excluded packages are not automatically excluded.
allowStaticMemberImports
whether to allow starred static member imports like <code>import static org.junit.Assert.*;</code>. Default is false.
默认值false
allowClassImports whether to allow starred class imports like <code>import java.util.*;</code>. Default is false.
默认值false
13、Boolean Expression Complexity (默认 关闭)
坏味道 主要
将嵌套布尔运算符(&&,||和^)限制为指定的深度(默认= 3)。
max the maximum allowed number of boolean operations in one expression. Default is 3.
默认值3
tokens tokens to check. Default is LAND,BAND,LOR,BOR,BXOR.
默认值LAND,BAND,LOR,BOR,BXOR
14、Branches should have sufficient coverage by tests (默认 关闭)
坏味道 主要
分支应有足够的测试覆盖
minimumBranchCoverageRatio
默认值65
15、Catch Parameter Name (默认 关闭)
坏味道 主要
检查catch参数名是否符合format属性指定的格式
format Specifies valid identifiers. Default is ^(e|t|ex|[a-z][a-z][a-zA-Z]+)$
默认值^(e|t|ex|[a-z][a-z][a-zA-Z]+)$
16、Class Data Abstraction Coupling (默认 关闭)
坏味道 主要
度量衡量给定类中其他类的实例化数。
max the maximum threshold allowed. Default is 7.
excludedClasses User-configured class names to ignore.
excludeClassesRegexps User-configured regular expressions to ignore classes
excludedPackages User-configured packages to ignore
17、Class Fan Out Complexity (默认 关闭)
坏味道 主要
类的依赖类数量
max the maximum threshold allowed. Default is 20.
excludedClasses
User-configured class names to ignore
excludeClassesRegexps
User-configured regular expressions to ignore classes
excludedPackages
User-configured packages to ignore
18、Class names should comply with a naming convention (开放)
坏味道 次要
类名应符合命名约定
format Regular expression used to check the class names against.
默认值^[A-Z][a-zA-Z0-9]*$
19、Classes from "sun.*" packages should not be used (开放)
坏味道 主要
不得使用“sun.*”软件包的类,sun类*或com.sun *包被视为实现细节,不属于Java API
Exclude Comma separated list of Sun packages to be ignored by this rule. Example: com.sun.jna,sun.misc 
20、Classes should not be coupled to too many other classes (Single Responsibility Principle) (默认 关闭)
坏味道 主要
类不应与太多其他类(单一责任原则)相耦合(依赖)
max Maximum number of classes a single class is allowed to depend upon
默认值20 
21、Classes should not be too complex (默认 关闭)
坏味道 严重 废弃
类不应太复杂
max Maximum complexity allowed.
默认值200
22、Classes should not have too many "static" imports (默认 关闭)
坏味道 主要
静态导入类允许您使用其公共静态成员,而不必使用类名。 这可以很方便,但如果静态导入太多的类,你的代码可能会变得混乱,很难维护
threshold The maximum number of static imports allowed
默认值4
23、Classes should not have too many fields (默认 关闭)
坏味道 主要
类不应有太多字段
countNonpublicFields 
Whether or not to include non-public fields in the count
默认值true
maximumFieldThreshold
The maximum number of fields
默认值20
24、Classes should not have too many methods (默认 关闭)
坏味道 主要
类不应该有太多方法
countNonpublicMethods
Whether or not to include non-public methods in the count.
默认值true
maximumMethodThreshold
The maximum number of methods authorized in a class.
默认值35
25、Close curly brace and the next "else", "catch" and "finally" keywords should be located on the same line (默认 关闭)
坏味道 次要
关闭大括号,下一个“else”,“catch”和“finally”关键字应位于同一行
26、Close curly brace and the next "else", "catch" and "finally" keywords should be on two different lines (默认 关闭)
坏味道 次要
关闭大括号和下一个“else”,“catch”和“finally”关键字应该在两个不同的行
29、Comments should not be located at the end of lines of code (默认 关闭)
坏味道 次要
注释不应位于代码行的末尾
legalTrailingCommentPattern
Description Pattern for text of trailing comments that are allowed. By default, comments containing only one word.
默认值^\s*+[^\s]++$
30、Constant Name (默认 关闭)
坏味道 次要
检查常数名称是否符合指定的格式
applyToPackage 
Controls whether to apply the check to package-private member
默认值true
format Regular expression
默认值^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$
applyToPublic
Controls whether to apply the check to public member
默认值true
applyToProtected
Controls whether to apply the check to protected member
默认值true
applyToPrivate Controls whether to apply the check to private member
默认值true
31、Control flow statements "if", "for", "while", "switch" and "try" should not be nested too deeply (默认 关闭)
坏味道 严重
控制流程语句“if”,“for”,“while”,“switch”和“try”不能嵌套太深
max Maximum allowed control flow statement nesting depth.
默认值3
32、Custom Import Order (默认 关闭)
坏味道 主要
检查导入声明组按照用户指定的顺序显示。 如果有导入,但是在组态中未指定其组,则导入应放在导入列表的末尾。
thirdPartyPackageRegExp RegExp for THIRDPARTY_PACKAGE group imports.
默认值^$
separateLineBetweenGroups
Force empty line separator between import groups.
默认值true
sortImportsInGroupAlphabetically
Force grouping alphabetically.
默认值false
specialImportsRegExp
RegExp for SPECIAL_IMPORTS group imports.
默认值^$
customImportOrderRules List of order declaration customizing by user. standardPackageRegExp
RegExp for STANDARD_JAVA_PACKAGE group imports.
默认值java|javax
33、Cyclomatic Complexity (默认 关闭)
坏味道 主要
检查针对特定限制的方法的循环复杂性
switchBlockAsSingleDecisionPoint whether to treat the whole switch block as a single decision point
默认值false
max the maximum threshold allowed.
默认值10
tokens
tokens to check
默认值
LITERAL_WHILE,LITERAL_DO,LITERAL_FOR,LITERAL_IF,LITERAL_SWITCH,LITERAL_CASE,LITERAL_CATCH,QUESTION,LAND,LOR
34、Default Comes Last (默认 关闭)
坏味道 主要
检查在switch语句中的所有情况之后的默认值。
skipIfLastAndSharedWithCase
whether to allow default along with case if they are not last
默认值false
35、Empty catch block (默认 关闭)
坏味道 主要
检查空的catch块。 有两个选项可以使验证更加精确(默认情况下,检查允许空的catch块和任何注释)
exceptionVariableName Format of skipping exception''s variable name.
默认值^$
commentFormat
Format of comment.
默认值.*
36、Empty For Initializer Pad (默认 关闭)
坏味道 次要
检查初始化程序为空的填充; 那是空的是否需要一个空的初始化程序,或者禁止这样的空格。 示例:for(; i <j; i ++,j--)
option policy on how to pad an empty for iterator
37、Empty For Iterator Pad
坏味道 次要
检查一个空的填充迭代器; 那就是空格是否需要一个空的迭代器,否则这样的空格是被禁止的。 示例:for(Iterator foo = very.long.line.iterator(); foo.hasNext();)
option policy on how to pad an empty for iterator
38、Empty Line Separator (默认 关闭)
坏味道 主要
在标题,包,所有导入声明,字段,构造函数,方法,嵌套类,静态初始化器和实例初始化器之后检查空行分隔符
allowNoEmptyLineBetweenFields
Allow no empty line between fields
默认值false
allowMultipleEmptyLines
Allows multiple empty lines between class members.
默认值true
tokens
assignments to check
默认值
PACKAGE_DEF,IMPORT,CLASS_DEF,INTERFACE_DEF,ENUM_DEF,STATIC_INIT,INSTANCE_INIT,METHOD_DEF,CTOR_DEF,VARIABLE_DEF
allowMultipleEmptyLinesInsideClassMembers
Allow multiple empty lines inside class members
默认值true
39、Executable Statement Count (默认 关闭)
坏味道 主要
将可执行语句的数量限制为指定的限制(默认= 30)。
max the maximum threshold allowed. Default is 30.
默认值30
tokens  members to check
默认值
CTOR_DEF,METHOD_DEF,INSTANCE_INIT,STATIC_INIT
40、Expressions should not be too complex (默认 关闭)
坏味道 严重
表达式不应太复杂
max Maximum number of allowed conditional operators in an expression
默认值3
42、File Length (默认 关闭)
坏味道 主要
如果源文件变得很长,那么很难理解。 因此,长类通常应该重构到专注于特定任务的几个单独的类中
fileExtensions
file type extension of files to process
max maximum allowable number of lines. Default is 2000.
43、File Tab Character (默认 关闭)
坏味道 次要
检查源代码中没有制表符('\ t')
fileExtensions
file type extension of files to process
eachLine whether to report on each line containing a tab, or just the first instance. Default is false.
44、Files should contain an empty new line at the end (默认 关闭)
坏味道 次要
文件最后应该包含一个空的新行

转载于:https://www.cnblogs.com/yanxinjiang/p/9875884.html

SonarQube规则之坏味道类型相关推荐

  1. sonar规则之坏味道类型

    1.Abbreviation As Word In Name (默认 关闭) 坏味道 主要 检查验证标识符名称中的缩写(连续大写字母)长度,还允许执行骆驼案例命名 allowedAbbreviatio ...

  2. 支付宝网银直连SDK封装记上|强力去掉支付宝网银直连DEMO中56个坏味道 余下6个坏味道 Sonarqube无视阿里支付宝光环

    " Yuema约吗?一起学技术,一起成长!学海无涯 高人带路系列" 程序的世界,就是有坑的地方!分享踩坑的心得与体验!每天分享一点点! 关注公众号,进入学海无涯,高人带路模式!!微 ...

  3. 支付宝网银直连SDK封装记下|强力去掉支付宝网银直连DEMO中56个坏味道 余下6个坏味道 Sonarqube无视阿里支付宝光环

    " Yuema约吗?一起学技术,一起成长!学海无涯 高人带路系列" 程序的世界,就是有坑的地方!分享踩坑的心得与体验!每天分享一点点! 关注公众号,进入学海无涯,高人带路模式!!支 ...

  4. 代码 | 一天一点代码坏味道(1)

    [代码精进]| 总结/Edison Zhou 作为一个后端工程师,想必在职业生涯中都写过一些不好维护的代码.本文是我学习<代码之丑>的学习总结,今天第一天发车,先来看看在命名上的一些常犯的 ...

  5. .NET代码质量 | 一天一点代码坏味道(4)

    [代码精进]| 总结/Edison Zhou 作为一个后端工程师,想必在职业生涯中都写过一些不好维护的代码.本文是我学习<代码之丑>的学习笔记,今天最后一天,一起品品滥用控制语句的味道,再 ...

  6. 25种代码坏味道总结+优化示例

    前言 什么样的代码是好代码呢?好的代码应该命名规范.可读性强.扩展性强.健壮性......而不好的代码又有哪些典型特征呢?这25种代码坏味道大家要注意啦 1. Duplicated Code (重复代 ...

  7. 消灭 Java 代码的“坏味道”

    点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试资料 导读 明代王阳明先生在<传习录>谈为学之道时说: 私欲 ...

  8. 代码坏味道之非必要的

    :notebook: 本文已归档到:「blog」 翻译自:https://sourcemaking.com/refactoring/smells/dispensables 非必要的(Dispensab ...

  9. 消灭 Java 代码的“坏味道”【转】

    原文地址:https://mp.weixin.qq.com/s/-YQsD6jJuxewFjQtyX16UA 明代王阳明先生在<传习录>谈为学之道时说: 私欲日生,如地上尘,一日不扫,便又 ...

  10. C#类中的internal成员可能是一种坏味道

    前言 最近除了搞ASP.NET MVC之外,我也在思考一些编程实践方面的问题.昨天在回家路上,我忽然对一个问题产生了较为清晰的认识.或者说,原先只是有一丝细微的感觉,而现在将它和一些其他的方面进行了联 ...

最新文章

  1. 《连线》杂志:2015年六大安全威胁预测
  2. 课程上线 -“新手入门 : Windows Phone 8.1 开发”
  3. spingboot集成jpa(一)
  4. P3177-[HAOI2015]树上染色【树形dp】
  5. 设计模式-责任链模型
  6. python纳入小学课本了吗_Python语言为什么被推荐纳入高考和小学教材
  7. Android Studio 常用快捷键(超实用!!!)
  8. c++画函数图像_二次函数图像与系数a,b,c的关系
  9. mysql查阅建立的库_mysql 怎么查看创建的数据库和表
  10. python3修改文件内容_使用python 修改文件内容
  11. python3GUI——微博图片爬取工具
  12. 【猿说理财】《一》理财需要理由吗
  13. 云主机创建网络失败:Unable to create the network. No tenant network is available for allocation.
  14. React Api请求最佳实践react-query3使用教程(比swr更好用更强大)
  15. Vega Prime 常见问题集
  16. Android 防止PC端第三方流氓软件强制安装apk至android设备
  17. 各linux桌面性能比较,七大顶级桌面比较!Linux平台自由选择
  18. linux c语言 ppt,Linux下C语言编程.ppt
  19. acm中的概率和期望类题目 挖坑
  20. 国家气象台示能测出西南大旱

热门文章

  1. 甘肃计算机报名准考证打印,2019年9月甘肃计算机等考准考证打印入口已开通
  2. python如何实现单例模式_用Python实现设计模式——单例模式
  3. 平面圆域分割(欧拉公式)+例题
  4. java 变量 类之间调用_java内部类与其他类变量之间的调用方式
  5. java 约瑟夫环_java中约瑟夫环代码实现
  6. 翻译: TensorFlow 2.0 中的新功能
  7. 算法:找出存在子字符串的最先位置28. Implement strStr()
  8. 2021-09-02Hive
  9. 凸优化有关的数值线性代数知识 4分块消元与Schur补
  10. 凸优化第五章对偶 5.3几何解释