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. TField中的GetText和SetText

    在数据表中的某些字段出于性能或数据规范化的考虑,会用组编号代替,就像学生有学号,员工有员工ID一样,但我们看的时候如果直接输入这样的编号看的人可能就会头痛了,这时就可用TField中的GetText转 ...

  2. 远程桌面 虚拟打印 到本地打印机(虚拟化 终端 远程接入 RemoteApp)

    使用远程桌面或remoteapp进行打印时,若需使用本地的打印机,需要通过重定向方式,但本地打印机如果五花八门比较杂,那给服务器安装打印机驱动很麻烦. 其实可以借助虚拟打印机简化操作,省去给服务器安装 ...

  3. HTML5——新表单元素 表单属性 语义元素

    表单元素 新的表单元素 datalist——输入域选项列表 keygen——提供一种验证用户的可靠方法 output——不同类型的输出,比如计算或脚本输出 表单属性 <form> / &l ...

  4. 【ABAP系列】SAP ABAP 开发中的SMARTFORMS 参数

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP 开发中的SMA ...

  5. Discrete Mathematics and Its Applications | 1 CHAPTER The Foundations: Logic and Proofs | 1.1 Propositional Logic

    propositional variables (or statement variables), letters used for propositional variables are p, q, ...

  6. debian下安装mysql 5.1.34

    #cd /usr/local/src # tar xvzf mysql-5.1.34.tar.gz # cd mysql-5.5.1.34 配置和编译 #chmod +x configure # ./ ...

  7. SQL如何通过当前日期获取上周一日期【转】

    --当前时间 select getdate() --当前时间周的起始日期(以周一为例) ,) --上周起始: ,,)) --上上周起始: ,,)) --上上上周起始:s elect ,,))

  8. 这款多线程中间件,吊打 Redis!

    Java技术栈 www.javastack.cn 优秀的Java技术公众号 今天给大家介绍的是KeyDB,KeyDB项目是从redis fork出来的分支.众所周知redis是一个单线程的kv内存存储 ...

  9. C++中对象的构造顺序

    1,C++ 中的类可以定义多个对象,那么对象构造顺序是怎样的? 1,很多的 bug 是由对象的构造顺序造成的,虽然它不难: 2,对象的构造往往和构造函数牵涉在一起,构造函数的函数体又可能由非常复杂的程 ...

  10. 如何将数据库导入到本地MySQL

    有两个方法:(1)在MySQL的客户端进行导入,比如: http://jingyan.baidu.com/article/6dad507517c11aa123e36ea0.html (2)方法:常用s ...