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 (默认 关闭)
坏味道 次要
文件最后应该包含一个空的新行

SonarQube规则之坏味道类型的更多相关文章

  1. 代码的坏味道(3)——基本类型偏执(Primitive Obsession)

    坏味道--基本类型偏执(Primitive Obsession) 特征 使用基本类型而不是小对象来实现简单任务(例如货币.范围.电话号码字符串等). 使用常量编码信息(例如一个用于引用管理员权限的常量 ...

  2. Refactoring之——代码的坏味道(二)过大的类 &(三)基本类型偏执

    1.1.2 Large Class(过大的类) 特征:一个类包含过多的字段.方法.代码行. 问题原因: 类通常一开始很小,但是随着程序的增长而逐渐膨胀. 类似于过长方法,程序员通常觉得在一个现存类中添 ...

  3. Sonar项目主要指标以及代码坏味道详解

    更多原创测试技术文章同步更新到微信公众号 :三国测,敬请扫码关注个人的微信号,感谢! 原文链接:http://www.cnblogs.com/zishi/p/6766994.html 众所周知Sona ...

  4. 单元测试系列之四:Sonar平台中项目主要指标以及代码坏味道详解

    更多原创测试技术文章同步更新到微信公众号 :三国测,敬请扫码关注个人的微信号,感谢! 原文链接:http://www.cnblogs.com/zishi/p/6766994.html 众所周知Sona ...

  5. 代码的坏味道(16)——纯稚的数据类(Data Class)

    坏味道--纯稚的数据类(Data Class) 特征 纯稚的数据类(Data Class) 指的是只包含字段和访问它们的getter和setter函数的类.这些仅仅是供其他类使用的数据容器.这些类不包 ...

  6. 代码的坏味道(10)——发散式变化(Divergent Change)

    坏味道--发散式变化(Divergent Change) 发散式变化(Divergent Change) 类似于 霰弹式修改(Shotgun Surgery) ,但实际上完全不同.发散式变化(Dive ...

  7. 代码的坏味道(6)——Switch声明(Switch Statements)

    坏味道--Switch声明(Switch Statements) 特征 你有一个复杂的 switch 语句或 if 序列语句. 问题原因 面向对象程序的一个最明显特征就是:少用 switch  和 c ...

  8. 解析大型.NET ERP系统 代码的坏味道

    1  对用户输入做过多的约定和假设 配置文件App.config中有一个设定报表路径的配置节: <add key="ReportPath" value="C:\Us ...

  9. Bad Smell (代码的坏味道)

    sourcemaking 如果一段代码是不稳定或者有一些潜在问题的,那么代码往往会包含一些明显的痕迹.正如食物要腐坏之前,经常会发出一些异味一样, 我们管这些痕迹叫做 "代码异味" ...

随机推荐

  1. 【奇技淫巧】linux 定时任务 crontab 反弹 shell

    日期:2018-11-26 13:47:34 介绍:如何使用定时任务来反弹 shell? 0x01. 基本命令 参数 -e:编辑该用户的计时器设置: -l:列出该用户的计时器设置: -r:删除该用户的 ...

  2. Delphi中的进制转换

    二进制转换 function binToDec(Value: string): integer; var str: string; i: integer; begin Str := UpperCase ...

  3. MySQL5.6版本之后设置DATETIME类型自动更新

    在使用MySQL中datetime格式自动更新特性时,我们应该明确一点,datetime格式设置默认值为当前时间和自动更新时间是从MySQL5.6版本之后开始支持的.此前我们都是使用timestamp ...

  4. 修改了Ubuntu下的/usr目录权限,导致不能使用sudo命令的修复-----转载

    刚开始运行sudo时,报了下面这个错误 sudo: must be setuid root,于是上网找解决方法,搜索出来的都是这样解决的 ls -l  /usr/bin/sudochown root: ...

  5. 【Linux开发】【Qt开发】QT 同时支持鼠标和触摸屏

    QT 同时支持鼠标和触摸屏 现在 如果我要使用鼠标 导入环境变量 export QWS_MOUSE_PROTO=MouseMan:/dev/input/mice 使用触摸屏,导入环境变量 export ...

  6. MAC_BOOKPRO苹果电脑系统常用快捷键大全

    Mac 键盘快捷键 我在品多多上拼的Mac终于到货了,安全下车,接下来要熟练使用了! 您可以按下某些组合键来实现通常需要鼠标.触控板或其他输入设备才能完成的操作.   要使用键盘快捷键,请按住一个或多 ...

  7. glide使用总结

    1 glide是什么 glide是一个图片加载和缓存库. 2 glide的使用 第一,添加依赖 implementation 'com.github.bumptech.glide:glide:4.5. ...

  8. Java数据结构之双向链表

    管理单向链表的缺点分析: 单向链表,查找的方向只能是一个方向,而双向链表可以向前或者向后查找. 单向链表不能自我删除,需要靠辅助节点 ,而双向链表,则可以自我删除,所以前面我们单链表删除时节点,总是找 ...

  9. 使用extract-text-webpack-plugin插件后报错

    如果你使用的webpack是4+版本,那么尝试运行npm install extract-text-webpack-plugin@next ,即可解决问题 然而最好的解决办法是在webpack4+的版 ...

  10. c语言中字符串跨行书写的问题

    字符串常量定义时的换行问题     如果我们在一行代码的行尾放置一个反斜杠,c语言编译器会忽略行尾的换行符,而把下一行的内容也算作是本行的内容.这里反斜杠起到了续行的作用.        如果我们不使 ...