From b5f620df707578c05c8beb93aa705efc5d31dbab Mon Sep 17 00:00:00 2001 From: Paul O'Neill Date: Sat, 11 Feb 2017 06:24:18 -0800 Subject: [PATCH] Fix #103 - specify bug and vuln types against applicable rules (#109) * Update rules to match most recent tslint * Adding debtTypes to rules --- pom.xml | 2 +- .../pablissimo/sonar/TsLintExecutorImpl.java | 2 - .../pablissimo/sonar/TsLintParserImpl.java | 4 +- .../com/pablissimo/sonar/TsLintSensor.java | 5 - .../pablissimo/sonar/TsRulesDefinition.java | 4 +- .../resources/tslint/tslint-rules.properties | 233 +++++++++++++++++- .../sonar/TypeScriptRuleProfileTest.java | 29 ++- 7 files changed, 258 insertions(+), 21 deletions(-) diff --git a/pom.xml b/pom.xml index 57286ab..1682813 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.pablissimo.sonar sonar-typescript-plugin sonar-plugin - 1.0.0-RC1 + 1.0.0-RC2 TypeScript Analyse TypeScript projects diff --git a/src/main/java/com/pablissimo/sonar/TsLintExecutorImpl.java b/src/main/java/com/pablissimo/sonar/TsLintExecutorImpl.java index 506a963..616b33a 100644 --- a/src/main/java/com/pablissimo/sonar/TsLintExecutorImpl.java +++ b/src/main/java/com/pablissimo/sonar/TsLintExecutorImpl.java @@ -144,8 +144,6 @@ else if (files == null) { LOG.debug("Split " + files.size() + " files into " + batches.size() + " batches for processing"); for (int i = 0; i < batches.size(); i++) { - StringBuilder outputBuilder = new StringBuilder(); - List thisBatch = batches.get(i); Command thisCommand = getBaseCommand(config, tslintOutputFilePath); diff --git a/src/main/java/com/pablissimo/sonar/TsLintParserImpl.java b/src/main/java/com/pablissimo/sonar/TsLintParserImpl.java index c93731c..582693e 100644 --- a/src/main/java/com/pablissimo/sonar/TsLintParserImpl.java +++ b/src/main/java/com/pablissimo/sonar/TsLintParserImpl.java @@ -14,9 +14,7 @@ import com.pablissimo.sonar.model.TsLintIssue; @BatchSide -public class TsLintParserImpl implements TsLintParser { - private static final Logger LOG = LoggerFactory.getLogger(TsLintParserImpl.class); - +public class TsLintParserImpl implements TsLintParser { public Map> parse(List toParse) { GsonBuilder builder = new GsonBuilder(); Gson gson = builder.create(); diff --git a/src/main/java/com/pablissimo/sonar/TsLintSensor.java b/src/main/java/com/pablissimo/sonar/TsLintSensor.java index 7d0fade..53a2955 100644 --- a/src/main/java/com/pablissimo/sonar/TsLintSensor.java +++ b/src/main/java/com/pablissimo/sonar/TsLintSensor.java @@ -9,16 +9,11 @@ import org.sonar.api.batch.sensor.SensorDescriptor; import org.sonar.api.batch.sensor.issue.NewIssue; import org.sonar.api.batch.sensor.issue.NewIssueLocation; -import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.config.Settings; import org.sonar.api.rule.RuleKey; import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.*; public class TsLintSensor implements Sensor { diff --git a/src/main/java/com/pablissimo/sonar/TsRulesDefinition.java b/src/main/java/com/pablissimo/sonar/TsRulesDefinition.java index 6aec863..f68d586 100644 --- a/src/main/java/com/pablissimo/sonar/TsRulesDefinition.java +++ b/src/main/java/com/pablissimo/sonar/TsRulesDefinition.java @@ -128,7 +128,7 @@ public static void loadRules(InputStream stream, List rulesCollectio ruleDescription ); } - + rulesCollection.add(tsRule); } @@ -203,7 +203,7 @@ public void define(Context context) { for (TsLintRule customRule : tslintRules) { createRule(repository, customRule); } - + repository.done(); } diff --git a/src/main/resources/tslint/tslint-rules.properties b/src/main/resources/tslint/tslint-rules.properties index 3b4ed30..853e671 100644 --- a/src/main/resources/tslint/tslint-rules.properties +++ b/src/main/resources/tslint/tslint-rules.properties @@ -15,6 +15,7 @@ array-type.name=Requires using either 'T[]' or 'Array' for arrays array-type.severity=MAJOR array-type.debtFunc=CONSTANT_ISSUE array-type.debtScalar=5min +array-type.debtType=BUG arrow-parens=true arrow-parens.name=Requires parentheses around the parameters of arrow-function definitions @@ -22,11 +23,32 @@ arrow-parens.severity=MINOR arrow-parens.debtFunc=CONSTANT_ISSUE arrow-parens.debtScalar=5min +arrow-return-shorthand=true +arrow-return-shorthand.name=Convert function expressions with only a return in a block to remove the block and return statement +arrow-return-shorthand.severity=MINOR +arrow-return-shorthand.debtFunc=CONSTANT_ISSUE +arrow-return-shorthand.debtScalar=5min + +await-promise=true +await-promise.name=Warns for an awaited value that is not a Promise +await-promise.severity=MAJOR +await-promise.debtFunc=CONSTANT_ISSUE +await-promise.debtScalar=10min +await-promise.debtType=BUG + ban=true ban.name=Use of this method is banned by current configuration ban.severity=CRITICAL ban.debtFunc=CONSTANT_ISSUE ban.debtScalar=60min +ban.debtType=BUG + +callable-types=true +callable-types.name=Rewrite interfaces or literal types with just a call signature to be function types +callable-types.severity=MAJOR +callable-types.debtFunc=CONSTANT_ISSUE +callable-types.debtScalar=10min +callable-types.debtType=BUG class-name=true class-name.name=Name must use PascalCase @@ -51,6 +73,7 @@ curly.name=Enforces braces for if/for/do/while statements curly.severity=MAJOR curly.debtFunc=CONSTANT_ISSUE curly.debtScalar=5min +curly.debtType=BUG cyclomatic-complexity=true cyclomatic-complexity.name=Enforces a threshold of cyclomatic complexity @@ -75,6 +98,20 @@ forin.name=Enforces a for ... in statement to be filtered with an if statement forin.severity=MAJOR forin.debtFunc=CONSTANT_ISSUE forin.debtScalar=5min +forin.debtType=BUG + +import-blacklist=true +import-blacklist.name=Disallows importing specific modules directly via import and require. Instead, only sub modules may be imported from those modules +import-blacklist.severity=MAJOR +import-blacklist.debtFunc=CONSTANT_ISSUE +import-blacklist.debtScalar=10min +import-blacklist.debtType=BUG + +import-spacing=true +import-spacing.name=Ensures proper spacing between import statement keywords +import-spacing.severity=MINOR +import-spacing.debtFunc=CONSTANT_ISSUE +import-spacing.debtScalar=2min indent=true indent.name=Enforces consistent indentation with tabs or spaces @@ -88,6 +125,12 @@ interface-name.severity=MAJOR interface-name.debtFunc=CONSTANT_ISSUE interface-name.debtScalar=1min +interface-over-type-literal=true +interface-over-type-literal.name=Prefer an interface declaration over a type literal +interface-over-type-literal.severity=MAJOR +interface-over-type-literal.debtFunc=CONSTANT_ISSUE +interface-over-type-literal.debtScalar=10min + jsdoc-format=true jsdoc-format.name=Enforces basic format rules for jsdoc comments - comments starting with /** jsdoc-format.severity=MAJOR @@ -99,12 +142,14 @@ label-position.name=Enforces labels only on sensible statements label-position.severity=MAJOR label-position.debtFunc=CONSTANT_ISSUE label-position.debtScalar=20min +label-position.debtType=BUG 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 +label-undefined.debtType=BUG linebreak-style=true linebreak-style.name=Enforces a consistent linebreak style @@ -135,6 +180,7 @@ member-access.name=Enforces using explicit visibility on class members member-access.severity=MAJOR member-access.debtFunc=CONSTANT_ISSUE member-access.debtScalar=1min +member-access.debtType=BUG member-ordering=true member-ordering.name=Enforces ordering of class members @@ -147,6 +193,7 @@ new-parens.name=Requires parentheses when invoking a constructor via the new key new-parens.severity=MINOR new-parens.debtFunc=CONSTANT_ISSUE new-parens.debtScalar=1min +new-parens.debtType=BUG no-angle-bracket-type-assertion=true no-angle-bracket-type-assertion.name=Enforces use of the 'as' operator for type assertions @@ -159,24 +206,35 @@ 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-any.debtType=BUG 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-arg.debtType=BUG 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-bitwise.debtType=BUG + +no-boolean-literal-compare=true +no-boolean-literal-compare.name=Warns on comparison to a boolean literal +no-boolean-literal-compare.severity=MINOR +no-boolean-literal-compare.debtFunc=CONSTANT_ISSUE +no-boolean-literal-compare.debtScalar=5min +no-boolean-literal-compare.debtType=BUG 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-conditional-assignment.debtType=BUG no-consecutive-blank-lines=true no-consecutive-blank-lines.name=No more than one blank line should appear in a row @@ -189,24 +247,28 @@ no-console.name=Specified function must not be called on the global console obje no-console.severity=MAJOR no-console.debtFunc=CONSTANT_ISSUE no-console.debtScalar=5min +no-console.debtType=VULNERABILITY 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-construct.debtType=BUG 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-constructor-vars.debtType=BUG 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-debugger.debtType=VULNERABILITY no-default-export=true no-default-export.name=Disallows default exports in ES6-style modules @@ -219,30 +281,48 @@ 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-key.debtType=BUG 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-duplicate-variable.debtType=BUG 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-empty.debtType=BUG + +no-empty-interface=true +no-empty-interface.name=Forbids empty interfaces +no-empty-interface.severity=MAJOR +no-empty-interface.debtFunc=CONSTANT_ISSUE +no-empty-interface.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-eval.debtType=VULNERABILITY + +no-floating-promises=true +no-floating-promises.name=Promises returned by functions must be handled appropriately +no-floating-promises.severity=MAJOR +no-floating-promises.debtFunc=CONSTANT_ISSUE +no-floating-promises.debtScalar=20min +no-floating-promises.debtType=BUG no-for-in-array=true no-for-in-array.name=Disallows iterating over an array with a for-in loop no-for-in-array.severity=MINOR no-for-in-array.debtFunc=CONSTANT_ISSUE -no-for-in-array.debtScalar=5min +no-for-in-array.debtScalar=10min +no-for-in-array.debtType=BUG no-inferrable-types=true no-inferrable-types.name=Disallows explicit type declarations for variables or parameters initialised to a number, string or boolean @@ -250,6 +330,12 @@ no-inferrable-types.severity=MAJOR no-inferrable-types.debtFunc=CONSTANT_ISSUE no-inferrable-types.debtScalar=5min +no-inferred-empty-object-type=true +no-inferred-empty-object-type.name=Disallow type inference of empty object types at function and constructor call sites +no-inferred-empty-object-type.severity=MAJOR +no-inferred-empty-object-type.debtFunc=CONSTANT_ISSUE +no-inferred-empty-object-type.debtScalar=10min + no-internal-module=true no-internal-module.name=Disallows internal modules - use namespaces instead no-internal-module.severity=MAJOR @@ -261,6 +347,20 @@ no-invalid-this.name=Disallows using the this keyword outside of classes no-invalid-this.severity=MAJOR no-invalid-this.debtFunc=CONSTANT_ISSUE no-invalid-this.debtScalar=10min +no-invalid-this.debtType=BUG + +no-magic-numbers=true +no-magic-numbers.name=Disallows the use of constant number values out of variable assignments +no-magic-numbers.severity=MAJOR +no-magic-numbers.debtFunc=CONSTANT_ISSUE +no-magic-numbers.debtScalar=10min + +no-misused-new=true +no-misused-new.name=Warns on apparent attempts to define constructors for interfaces or new for classes +no-misused-new.severity=MAJOR +no-misused-new.debtFunc=CONSTANT_ISSUE +no-misused-new.debtScalar=10min +no-misused-new.debtType=BUG no-mergeable-namespace=true no-mergeable-namespace.name=Disallows mergeable namespaces in the same file @@ -279,6 +379,7 @@ 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-null-keyword.debtType=BUG no-parameter-properties=true no-parameter-properties.name=Disallows parameter properties in class constructors @@ -303,18 +404,28 @@ 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-shadowed-variable.debtType=BUG 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-string-literal.debtType=BUG + +no-string-throw=true +no-string-throw.name=Flags throwing plain strings or concatenations of strings because only Errors produce proper stack traces +no-string-throw.severity=MAJOR +no-string-throw.debtFunc=CONSTANT_ISSUE +no-string-throw.debtScalar=10min +no-string-throw.debtType=BUG 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-switch-case-fall-through.debtType=BUG no-trailing-whitespace=true no-trailing-whitespace.name=Trailing whitespace at the end of lines is not allowed @@ -322,29 +433,58 @@ no-trailing-whitespace.severity=MINOR no-trailing-whitespace.debtFunc=CONSTANT_ISSUE no-trailing-whitespace.debtScalar=1min +no-unnecessary-initializer=true +no-unnecessary-initializer.name=Forbids var/let statements or destructuring initializers from being initialized to 'undefined' +no-unnecessary-initializer.severity=MINOR +no-unnecessary-initializer.debtFunc=CONSTANT_ISSUE +no-unnecessary-initializer.debtScalar=5min + +no-unnecessary-qualifier=true +no-unnecessary-qualifier.name=Warns when a namespace qualifier is unnecessary +no-unnecessary-qualifier.severity=MINOR +no-unnecessary-qualifier.debtFunc=CONSTANT_ISSUE +no-unnecessary-qualifier.debtScalar=5min + +no-unbound-method=true +no-unbound-method.name=Avoid referencing unbound methods which may cause unintentional scoping of 'this' +no-unbound-method.severity=MAJOR +no-unbound-method.debtFunc=CONSTANT_ISSUE +no-unbound-method.debtScalar=10min +no-unbound-method.debtType=BUG + 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-unreachable.debtType=BUG + +no-unsafe-any=true +no-unsafe-any.name=Warns when using an expression of type 'any' in an unsafe way - type-casts and tests are allowed, and expressions that work on all values are allowed +no-unsafe-any.severity=MAJOR +no-unsafe-any.debtFunc=CONSTANT_ISSUE +no-unsafe-any.debtScalar=10min +no-unsafe-any.debtType=BUG no-unsafe-finally=true no-unsafe-finally.name=Disallows control flow statements, such as return, continue, break and throw in finally blocks no-unsafe-finally.severity=MAJOR no-unsafe-finally.debtFunc=CONSTANT_ISSUE no-unsafe-finally.debtScalar=30min +no-unsafe-finally.debtType=BUG 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-expression.debtScalar=10min no-unused-new=true no-unused-new.name=Disallows unused new statements no-unused-new.severity=MINOR no-unused-new.debtFunc=CONSTANT_ISSUE no-unused-new.debtScalar=5min +no-unused-new.debtType=BUG no-unused-variable=true no-unused-variable.name=Unused imports, variables, functions and private class members are not allowed @@ -357,24 +497,28 @@ 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-use-before-declare.debtType=BUG 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-keyword.debtType=BUG 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 +no-var-requires.debtType=BUG -prefer-for-of=true -prefer-for-of.name=Recommends a 'for-of' loop over a standard 'for' loop if the index is only used to access the array being indexed -prefer-for-of.severity=MINOR -prefer-for-of.debtFunc=CONSTANT_ISSUE -prefer-for-of.debtScalar=5min +no-void-expression=true +no-void-expression.name=Requires expressions of type void to appear in statement positions +no-void-expression.severity=MAJOR +no-void-expression.debtFunc=CONSTANT_ISSUE +no-void-expression.debtScalar=5min +no-void-expression.debtType=BUG object-literal-key-quotes=true object-literal-key-quotes.name=Enforces consistent object literal property quote style @@ -411,6 +555,7 @@ only-arrow-functions.name=Disallows traditional (i.e. non-arrow) function expres only-arrow-functions.severity=MAJOR only-arrow-functions.debtFunc=CONSTANT_ISSUE only-arrow-functions.debtScalar=10min +only-arrow-functions.debtType=BUG ordered-imports=true ordered-imports.name=Requires that import statements be alphabetized @@ -418,6 +563,39 @@ ordered-imports.severity=MINOR ordered-imports.debtFunc=CONSTANT_ISSUE ordered-imports.debtScalar=5min +prefer-const=true +prefer-const.name=Requires that variable declarations use const instead of let if possible +prefer-const.severity=MAJOR +prefer-const.debtFunc=CONSTANT_ISSUE +prefer-const.debtScalar=5min +prefer-const.debtType=BUG + +prefer-for-of=true +prefer-for-of.name=Recommends a 'for-of' loop over a standard 'for' loop if the index is only used to access the array being indexed +prefer-for-of.severity=MINOR +prefer-for-of.debtFunc=CONSTANT_ISSUE +prefer-for-of.debtScalar=5min +prefer-for-of.debtType=BUG + +prefer-function-over-method=true +prefer-function-over-method.name=Warns for methods that do not use 'this' +prefer-function-over-method.severity=MAJOR +prefer-function-over-method.debtFunc=CONSTANT_ISSUE +prefer-function-over-method.debtScalar=10min + +prefer-method-signature=true +prefer-method-signature.name=Prefer foo(): void over foo: () => void in interfaces and types +prefer-method-signature.severity=MAJOR +prefer-method-signature.debtFunc=CONSTANT_ISSUE +prefer-method-signature.debtScalar=5min + +promise-function-async=true +promise-function-async.name=Requires any function or method that returns a promise be marked async +promise-function-async.severity=MINOR +promise-function-async.debtFunc=CONSTANT_ISSUE +promise-function-async.debtScalar=20min +promise-function-async.debtType=BUG + quotemark=true quotemark.name=Consistent use of single or double quotes is required - a mixture is not allowed quotemark.severity=MAJOR @@ -429,24 +607,48 @@ radix.name=Requires the radix be specified when calling parseInt radix.severity=CRITICAL radix.debtFunc=CONSTANT_ISSUE radix.debtScalar=1min +radix.debtType=BUG restrict-plus-operands=true restrict-plus-operands.name=When adding two variables, operands must both be of type number or of type string restrict-plus-operands.severity=MAJOR restrict-plus-operands.debtFunc=CONSTANT_ISSUE restrict-plus-operands.debtScalar=5min +restrict-plus-operands.debtType=BUG semicolon=true semicolon.name=Statement must end with a semicolon semicolon.severity=MAJOR semicolon.debtFunc=CONSTANT_ISSUE semicolon.debtScalar=1min +semicolon.debtType=BUG + +space-before-function-paren=true +space-before-function-paren.name=Specifies correct spacing before function parentheses +space-before-function-paren.severity=MINOR +space-before-function-paren.debtFunc=CONSTANT_ISSUE +space-before-function-paren.debtScalar=1min + +strict-boolean-expressions=true +strict-boolean-expressions.name=Restricts the types allowed in boolean expressions +strict-boolean-expressions.severity=MAJOR +strict-boolean-expressions.debtFunc=CONSTANT_ISSUE +strict-boolean-expressions.debtScalar=10min +strict-boolean-expressions.debtType=BUG + +strict-type-predicates=true +strict-type-predicates.name=Warns for type predicates that are always-true or always-false +strict-type-predicates.severity=MAJOR +strict-type-predicates.debtFunc=CONSTANT_ISSUE +strict-type-predicates.debtScalar=10min +strict-type-predicates.debtType=BUG 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 +switch-default.debtType=BUG trailing-comma=true trailing-comma.name=Enforces a standard for trailing commas within array and object literals, destructuring assignment and named imports @@ -459,12 +661,14 @@ triple-equals.name=== and != must not be used - use === or !== instead triple-equals.severity=MAJOR triple-equals.debtFunc=CONSTANT_ISSUE triple-equals.debtScalar=5min +triple-equals.debtType=BUG typedef=true typedef.name=Type definition must be specified typedef.severity=MAJOR typedef.debtFunc=CONSTANT_ISSUE typedef.debtScalar=5min +typedef.debtType=BUG typedef-whitespace=true typedef-whitespace.name=Whitespace around type definitions must be correct @@ -472,17 +676,32 @@ typedef-whitespace.severity=MINOR typedef-whitespace.debtFunc=CONSTANT_ISSUE typedef-whitespace.debtScalar=5min +typeof-compare=true +typeof-compare.name=Makes sure result of typeof is compared to correct string values +typeof-compare.severity=MAJOR +typeof-compare.debtFunc=CONSTANT_ISSUE +typeof-compare.debtScalar=10min +typeof-compare.debtType=BUG + +unified-signatures=true +unified-signatures.name=Warns for any two overloads that could be unified into one by a union or an optional/rest parameter +unified-signatures.severity=MAJOR +unified-signatures.debtFunc=CONSTANT_ISSUE +unified-signatures.debtScalar=10min + use-strict=true use-strict.name=Strict mode must be used use-strict.severity=CRITICAL use-strict.debtFunc=CONSTANT_ISSUE use-strict.debtScalar=5min +use-strict.debtType=BUG use-isnan=true use-isnan.name=Enforces use of the isNaN() function to check for NaN references, instead of a comparison to the NaN constant use-isnan.severity=MINOR use-isnan.debtFunc=CONSTANT_ISSUE use-isnan.debtScalar=5min +use-isnan.debtType=BUG variable-name=true variable-name.name=Variable names must be either camelCased or UPPER_CASED diff --git a/src/test/java/com/pablissimo/sonar/TypeScriptRuleProfileTest.java b/src/test/java/com/pablissimo/sonar/TypeScriptRuleProfileTest.java index da6d549..c103b97 100644 --- a/src/test/java/com/pablissimo/sonar/TypeScriptRuleProfileTest.java +++ b/src/test/java/com/pablissimo/sonar/TypeScriptRuleProfileTest.java @@ -27,8 +27,11 @@ public void setUp() throws Exception { "align", "adjacent-overload-signatures", "array-type", + "arrow-return-shorthand", "arrow-parens", + "await-promise", "ban", + "callable-types", "class-name", "comment-format", "completed-docs", @@ -37,8 +40,11 @@ public void setUp() throws Exception { "eofline", "file-header", "forin", + "import-blacklist", + "import-spacing", "indent", "interface-name", + "interface-over-type-literal", "jsdoc-format", "label-position", "label-undefined", @@ -53,6 +59,7 @@ public void setUp() throws Exception { "no-any", "no-arg", "no-bitwise", + "no-boolean-literal-compare", "no-conditional-assignment", "no-consecutive-blank-lines", "no-console", @@ -63,11 +70,16 @@ public void setUp() throws Exception { "no-duplicate-key", "no-duplicate-variable", "no-empty", + "no-empty-interface", "no-eval", "no-for-in-array", + "no-floating-promises", "no-inferrable-types", + "no-inferred-empty-object-type", "no-internal-module", "no-invalid-this", + "no-magic-numbers", + "no-misused-new", "no-mergeable-namespace", "no-namespace", "no-null-keyword", @@ -76,9 +88,14 @@ public void setUp() throws Exception { "no-require-imports", "no-shadowed-variable", "no-string-literal", + "no-string-throw", "no-switch-case-fall-through", "no-trailing-whitespace", + "no-unnecessary-initializer", + "no-unnecessary-qualifier", + "no-unbound-method", "no-unreachable", + "no-unsafe-any", "no-unsafe-finally", "no-unused-expression", "no-unused-new", @@ -86,7 +103,7 @@ public void setUp() throws Exception { "no-use-before-declare", "no-var-keyword", "no-var-requires", - "prefer-for-of", + "no-void-expression", "object-literal-key-quotes", "object-literal-shorthand", "object-literal-sort-keys", @@ -94,15 +111,25 @@ public void setUp() throws Exception { "one-variable-per-declaration", "only-arrow-functions", "ordered-imports", + "prefer-const", + "prefer-for-of", + "promise-function-async", + "prefer-function-over-method", + "prefer-method-signature", "quotemark", "radix", "restrict-plus-operands", "semicolon", + "space-before-function-paren", + "strict-boolean-expressions", + "strict-type-predicates", "switch-default", "trailing-comma", "triple-equals", "typedef", "typedef-whitespace", + "typeof-compare", + "unified-signatures", "use-strict", "use-isnan", "variable-name",