SonarQube JavaScript 2.11发布,这个版本加入了16项新规则实施一些与ECMAScript 2015相关的编码实践(原ECMAScript 6或ECMAScript和谐版)。
16项新规则:
“arguments” should not be accessed directly (api-design, es2015)
“import” should be used to include external code (convention, es2015, obsolete)
Attempts should not be made to update “const” variables (bug, es2015)
Braces and parentheses should be used consistently with arrow functions (convention, es2015)
Class methods should be used instead of “prototype” assignments (es2015)
Default parameters should not cause side effects (es2015, pitfall)
Destructuring syntax should be used for assignments (clumsy, es2015)
Function parameters with default values should be last (bug, es2015)
Object literal shorthand syntax should be used (convention, es2015)
Template strings should be used instead of concatenation (clumsy, es2015)
Variables should be declared with “let” or “const” (bad-practice, es2015)
漏洞:
[SONARJS-427] - False positive CommentedCode
[SONARJS-571] - False positive ExpressionComplexity (S1067)
[SONARJS-603] - False Positive SemicolonCheck: nested class declaration
[SONARJS-617] - False Positive VariableDeclarationWithoutVar (S2703): "module" and "exports" in node.js project
[SONARJS-640] - Support octal literals
[SONARJS-641] - ClassCastException in destructuring assignment
[SONARJS-649] - False Positive NonEmptyCaseWithoutBreak: complex flow
[SONARJS-650] - False Positive UselessStringOperationCheck (S1154) : "replace" with function parameter
改进:
[SONARJS-400] - Improve DeadStore (S1854): consider execution order
[SONARJS-511] - Provide semantic support of ECMAScript 2015
[SONARJS-548] - Ignore functions passed as parametes to AngularJS module methods in function size rules
[SONARJS-601] - Simplify the API to create new issues
[SONARJS-610] - Tune "Sonar way" Quality Profile to cover only generally accepted conventions
[SONARJS-627] - Improve UnreachableCode (S1763): consider execution order
[SONARJS-628] - Improve type-inference: consider unary operations
[SONARJS-630] - Remove visitToken() and visitTrivia() from SubscriptionVisitor
[SONARJS-648] - Update description of TrailingComma
[SONARJS-652] - Improve issue location for rules checking variable name
新特性:
[SONARJS-604] - Rule: Variables should be declared with "let" or "const"
[SONARJS-605] - Rule: Unchanged variables should be marked "const"
[SONARJS-606] - Rule: Attempts should not be made to update "const" variables
[SONARJS-607] - Rule: Object literal shorthand syntax should be used
[SONARJS-608] - Rule: Shorthand object properties should be grouped at the beginning or end of an object declaration
[SONARJS-609] - Rule: Function parameters with default values should be last
[SONARJS-612] - Rule: Template strings should be used instead of concatenation
[SONARJS-613] - Rule: "arguments" should not be accessed directly
[SONARJS-614] - Rule: Destructuring syntax should be used for assignments
[SONARJS-615] - Rule: Default parameters should not cause side effects
[SONARJS-616] - Rule: Variable declarations should be placed appropriately for their scope
[SONARJS-620] - Rule: Generators should "yield" something
[SONARJS-622] - Rule: Arrow function should use consistently parentheses and curly braces
[SONARJS-623] - Rule: Class methods should be used instead of "prototype" assignments
[SONARJS-624] - Rule: "import" should be used to include external code
[SONARJS-625] - Rule: Wildcard imports should not be used
[SONARJS-626] - Rule: Class names and file names should match
[SONARJS-653] - Remove property "sonar.javascript.exclude.minifiedFiles"
任务:
[SONARJS-518] - Refactor JavaScriptCheckContext not to use Issuable anymore
[SONARJS-544] - Provide profile generator for IT-ruling
[SONARJS-611] - Update description of VariableDeclarationWithoutVar
子任务:
[SONARJS-618] - Remove Semicolon rule from default quality profile
[SONARJS-619] - Remove TrailingComment rule from default quality profile
[SONARJS-629] - Support block-scoped variables
[SONARJS-631] - Create symbol and type for class declaration
[SONARJS-632] - Create type for arrow function
[SONARJS-633] - Create symbols for import
[SONARJS-644] - Remove TrailingComma rule from default quality profile
[SONARJS-645] - Remove FunctionName (S100) rule from default quality profile
[SONARJS-646] - Remove TrailingWhitespace rule from default quality profile
[SONARJS-647] - Remove TabCharacter rule from default quality profile