From 51672504a22cbdbd7e5d2b5055366f71633ef8a3 Mon Sep 17 00:00:00 2001 From: Pablissimo Date: Sat, 23 Jul 2016 15:26:16 +0100 Subject: [PATCH] Update rules for tech debt, fix readme --- README.md | 2 +- pom.xml | 4 +- .../resources/tslint/tslint-rules.properties | 112 ++++++++++++++++++ 3 files changed, 115 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index af3ea73..19693fb 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ a configuration for that rule in SonarTsPlugin could look as follows: export-name.debtOffset=1h export-name.debtType=HARDWARE_RELATED_PORTABILITY -**You will need to restart the SonarQube server after configuring custom rules this way before subsequent analyses will pick them up.** +**You will need to restart the SonarQube server after configuring custom rules this way before subsequent analyses will pick them up. You will also need to activate the new rules after restart for any quality profile you want them to participate in - by default they will be disabled.** * for documentation about the `technical debt` parameters look [here](http://docs.sonarqube.org/display/PLUG/Rule+Remediation+Costs) and [here](http://javadocs.sonarsource.org/5.2/apidocs/org/sonar/api/server/debt/DebtRemediationFunction.html) * for possible values for `debtType` go [here](http://javadocs.sonarsource.org/5.2/apidocs/org/sonar/api/server/rule/RulesDefinition.SubCharacteristics.html) diff --git a/pom.xml b/pom.xml index 043460d..b342ee6 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.pablissimo.sonar sonar-typescript-plugin sonar-plugin - 0.6-SNAPSHOT + 0.7-SNAPSHOT TypeScript Analyse TypeScript projects @@ -14,7 +14,7 @@ scm:git:git@github.com:Pablissimo/SonarTsPlugin.git scm:git:git@github.com:Pablissimo/SonarTsPlugin.git https://github.com/Pablissimo/SonarTsPlugin - 0.6 + 0.7 diff --git a/src/main/resources/tslint/tslint-rules.properties b/src/main/resources/tslint/tslint-rules.properties index 54c60a0..c2195fe 100644 --- a/src/main/resources/tslint/tslint-rules.properties +++ b/src/main/resources/tslint/tslint-rules.properties @@ -1,223 +1,335 @@ align=true align.name=enforces vertical alignment of parameters, arguments and statements align.severity=MINOR +align.debtFunc=CONSTANT_ISSUE +align.debtScalar=5min ban=true ban.name=Use of this method is banned by current configuration ban.severity=CRITICAL +ban.debtFunc=CONSTANT_ISSUE +ban.debtScalar=60min class-name=true class-name.name=Name must use PascalCase class-name.severity=MAJOR +class-name.debtFunc=CONSTANT_ISSUE +class-name.debtScalar=5min comment-format=true comment-format.name=Comments must be correctly formatted comment-format.severity=MINOR +comment-format.debtFunc=CONSTANT_ISSUE +comment-format.debtScalar=5min curly=true curly.name=enforces braces for if/for/do/while statements curly.severity=MAJOR +curly.debtFunc=CONSTANT_ISSUE +curly.debtScalar=5min eofline=true eofline.name=enforces the file to end with a newline eofline.severity=MINOR +eofline.debtFunc=CONSTANT_ISSUE +eofline.debtScalar=1min forin=true forin.name=enforces a for ... in statement to be filtered with an if statement forin.severity=MAJOR +forin.debtFunc=CONSTANT_ISSUE +forin.debtScalar=5min indent=true indent.name=enforces consistent indentation with tabs or spaces indent.severity=MINOR +indent.debtFunc=CONSTANT_ISSUE +indent.debtScalar=2min interface-name=true interface-name.name=enforces the rule that interface names must begin with a capital I interface-name.severity=MAJOR +interface-name.debtFunc=CONSTANT_ISSUE +interface-name.debtScalar=1min jsdoc-format=true jsdoc-format.name=enforces basic format rules for jsdoc comments - comments starting with /** jsdoc-format.severity=MAJOR +jsdoc-format.debtFunc=CONSTANT_ISSUE +jsdoc-format.debtScalar=3min label-position=true label-position.name=enforces labels only on sensible statements label-position.severity=MAJOR +label-position.debtFunc=CONSTANT_ISSUE +label-position.debtScalar=20min label-undefined=true label-undefined.name=checks that labels are defined before usage label-undefined.severity=CRITICAL +label-undefined.debtFunc=CONSTANT_ISSUE +label-undefined.debtScalar=5min max-line-length=true max-line-length.name=sets the maximum length of a line max-line-length.severity=MAJOR +label-undefined.debtFunc=CONSTANT_ISSUE +label-undefined.debtScalar=1min member-access=true member-access.name=enforces using explicit visibility on class members member-access.severity=MAJOR +member-access.debtFunc=CONSTANT_ISSUE +member-access.debtScalar=1min member-ordering=true member-ordering.name=enforces ordering of class members member-ordering.severity=MAJOR +member-ordering.debtFunc=CONSTANT_ISSUE +member-ordering.debtScalar=5min no-angle-bracket-type-assertion=true no-angle-bracket-type-assertion.name=enforces use of the 'as' operator for type assertions no-angle-bracket-type-assertion.severity=MAJOR +no-angle-bracket-type-assertion.debtFunc=CONSTANT_ISSUE +no-angle-bracket-type-assertion.debtScalar=5min no-any=true no-any.name='any' must not be used as a type decoration no-any.severity=MAJOR +no-any.debtFunc=CONSTANT_ISSUE +no-any.debtScalar=20min no-arg=true no-arg.name=arguments.callee must not be used no-arg.severity=MAJOR +no-arg.debtFunc=CONSTANT_ISSUE +no-arg.debtScalar=30min no-bitwise=true no-bitwise.name=bitwise operators must not be used no-bitwise.severity=MAJOR +no-bitwise.debtFunc=CONSTANT_ISSUE +no-bitwise.debtScalar=5min no-conditional-assignment=true no-conditional-assignment.name=disallows any type of assignment in conditionals - this applies to do-while, for, if and while statements no-conditional-assignment.severity=MAJOR +no-conditional-assignment.debtFunc=CONSTANT_ISSUE +no-conditional-assignment.debtScalar=5min no-consecutive-blank-lines=true no-consecutive-blank-lines.name=No more than one blank line should appear in a row no-consecutive-blank-lines.severity=MINOR +no-consecutive-blank-lines.debtFunc=CONSTANT_ISSUE +no-consecutive-blank-lines.debtScalar=5min no-console=true no-console.name=Specified function must not be called on the global console object no-console.severity=MAJOR +no-console.debtFunc=CONSTANT_ISSUE +no-console.debtScalar=5min no-construct=true no-construct.name=Constructors of String, Number and Boolean must not be used no-construct.severity=MAJOR +no-construct.debtFunc=CONSTANT_ISSUE +no-construct.debtScalar=5min no-constructor-vars=true no-constructor-vars.name=Public and private modifiers must not be used on constructor arguments no-constructor-vars.severity=MAJOR +no-constructor-vars.debtFunc=CONSTANT_ISSUE +no-constructor-vars.debtScalar=5min no-debugger=true no-debugger.name=Debugger statements are not allowed no-debugger.severity=CRITICAL +no-debugger.debtFunc=CONSTANT_ISSUE +no-debugger.debtScalar=5min no-duplicate-key=true no-duplicate-key.name=Duplicate keys must not be specified in object literals no-duplicate-key.severity=MAJOR +no-duplicate-key.debtFunc=CONSTANT_ISSUE +no-duplicate-key.debtScalar=5min no-duplicate-variable=true no-duplicate-variable.name=Duplicate variable definitions are not allowed no-duplicate-variable.severity=MAJOR +no-duplicate-variable.debtFunc=CONSTANT_ISSUE +no-duplicate-variable.debtScalar=5min no-empty=true no-empty.name=Empty blocks are not allowed no-empty.severity=MAJOR +no-empty.debtFunc=CONSTANT_ISSUE +no-empty.debtScalar=5min no-eval=true no-eval.name=Use of eval is not allowed no-eval.severity=CRITICAL +no-eval.debtFunc=CONSTANT_ISSUE +no-eval.debtScalar=30min no-inferrable-types=true no-inferrable-types.name=disallows explicit type declarations for variables or parameters initialised to a number, string or boolean no-inferrable-types.severity=MAJOR +no-inferrable-types.debtFunc=CONSTANT_ISSUE +no-inferrable-types.debtScalar=5min no-internal-module=true no-internal-module.name=disallows internal modules - use namespaces instead no-internal-module.severity=MAJOR +no-internal-module.debtFunc=CONSTANT_ISSUE +no-internal-module.debtScalar=5min no-null-keyword=true no-null-keyword.name=disallows use of the null keyword literal no-null-keyword.severity=MAJOR +no-null-keyword.debtFunc=CONSTANT_ISSUE +no-null-keyword.debtScalar=5min no-require-imports=true no-require-imports.name=disallows invocation of require() - use ES6-style imports instead no-require-imports.severity=MAJOR +no-require-imports.debtFunc=CONSTANT_ISSUE +no-require-imports.debtScalar=5min no-shadowed-variable=true no-shadowed-variable.name=disallows shadowed variable declarations no-shadowed-variable.severity=MAJOR +no-shadowed-variable.debtFunc=CONSTANT_ISSUE +no-shadowed-variable.debtScalar=10min no-string-literal=true no-string-literal.name=Object access via string literals is not allowed no-string-literal.severity=MAJOR +no-string-literal.debtFunc=CONSTANT_ISSUE +no-string-literal.debtScalar=10min no-switch-case-fall-through=true no-switch-case-fall-through.name=Falling through one case statement to another is not allowed no-switch-case-fall-through.severity=MAJOR +no-switch-case-fall-through.debtFunc=CONSTANT_ISSUE +no-switch-case-fall-through.debtScalar=5min no-trailing-whitespace=true no-trailing-whitespace.name=Trailing whitespace at the end of lines is not allowed no-trailing-whitespace.severity=MINOR +no-trailing-whitespace.debtFunc=CONSTANT_ISSUE +no-trailing-whitespace.debtScalar=1min no-unreachable=true no-unreachable.name=Unreachable code after break, catch, throw and return statements is not allowed no-unreachable.severity=MAJOR +no-unreachable.debtFunc=CONSTANT_ISSUE +no-unreachable.debtScalar=1min no-unused-expression=true no-unused-expression.name=Unused expressions (those that aren't assignments or function calls) are not allowed no-unused-expression.severity=MAJOR +no-unused-expression.debtFunc=CONSTANT_ISSUE +no-unused-expression.debtScalar=1min no-unused-variable=true no-unused-variable.name=Unused imports, variables, functions and private class members are not allowed no-unused-variable.severity=MAJOR +no-unused-variable.debtFunc=CONSTANT_ISSUE +no-unused-variable.debtScalar=1min no-use-before-declare=true no-use-before-declare.name=Variable use before declaration is not allowed no-use-before-declare.severity=CRITICAL +no-use-before-declare.debtFunc=CONSTANT_ISSUE +no-use-before-declare.debtScalar=5min no-var-keyword=true no-var-keyword.name=disallows usage of the var keyword - use let or const instead no-var-keyword.severity=MAJOR +no-var-keyword.debtFunc=CONSTANT_ISSUE +no-var-keyword.debtScalar=1min no-var-requires=true no-var-requires.name=Require is only allowed in import statements no-var-requires.severity=MAJOR +no-var-requires.debtFunc=CONSTANT_ISSUE +no-var-requires.debtScalar=5min object-literal-sort-keys=true object-literal-sort-keys.name=checks that keys in object literals are declared in alphabetical order (useful to prevent merge conflicts) object-literal-sort-keys.severity=MINOR +object-literal-sort-keys.debtFunc=CONSTANT_ISSUE +object-literal-sort-keys.debtScalar=5min one-line=true one-line.name=No newline is allowed before keyword one-line.severity=MINOR +one-line.debtFunc=CONSTANT_ISSUE +one-line.debtScalar=1min quotemark=true quotemark.name=Consistent use of single or double quotes is required - a mixture is not allowed quotemark.severity=MAJOR +quotemark.debtFunc=CONSTANT_ISSUE +quotemark.debtScalar=1min radix=true radix.name=A radix must be specified when calling parseInt radix.severity=CRITICAL +radix.debtFunc=CONSTANT_ISSUE +radix.debtScalar=1min semicolon=true semicolon.name=Statement must end with a semicolon semicolon.severity=MAJOR +semicolon.debtFunc=CONSTANT_ISSUE +semicolon.debtScalar=1min switch-default=true switch-default.name=enforces a default case in switch statements switch-default.severity=MAJOR +switch-default.debtFunc=CONSTANT_ISSUE +switch-default.debtScalar=5min trailing-comma=true trailing-comma.name=enforces a standard for trailing commas within array and object literals, destructuring assignment and named imports trailing-comma.severity=MINOR +trailing-comma.debtFunc=CONSTANT_ISSUE +trailing-comma.debtScalar=1min triple-equals=true triple-equals.name=== and != must not be used - use === or !== instead triple-equals.severity=MAJOR +triple-equals.debtFunc=CONSTANT_ISSUE +triple-equals.debtScalar=5min typedef=true typedef.name=Type definition must be specified typedef.severity=MAJOR +typedef.debtFunc=CONSTANT_ISSUE +typedef.debtScalar=5min typedef-whitespace=true typedef-whitespace.name=Whitespace around type definitions must be correct typedef-whitespace.severity=MINOR +typedef-whitespace.debtFunc=CONSTANT_ISSUE +typedef-whitespace.debtScalar=5min use-strict=true use-strict.name=Strict mode must be used use-strict.severity=CRITICAL +use-strict.debtFunc=CONSTANT_ISSUE +use-strict.debtScalar=5min variable-name=true variable-name.name=Variable names must be either camelCased or UPPER_CASED variable-name.severity=MAJOR +variable-name.debtFunc=CONSTANT_ISSUE +variable-name.debtScalar=5min whitespace=true whitespace.name=Inappropriate whitespace between tokens whitespace.severity=MINOR +whitespace.debtFunc=CONSTANT_ISSUE +whitespace.debtScalar=5min