SonarTsPlugin does not consider rules
For Angular2 project, I want to take measurements on it. I am very new to this kind of thing.
I have included SonarTsPlugin in SonarQube. But for some reason, the rules won't apply to the source code. There was absolutely no rule violation in the report. So I got suspicious and intentionally broke the following rule:
== and! = should not be used - use === or! == instead of
with the following line of code:
if (res.statusCode == 0) {
//do something
} else if (res.statusCode == -1) {
//do something different
};
I can see that SonarQube is correctly considering the corresponding TypeScript file. So I expect there will be at least one rule violation. Also, I am using Jenkins to take measurements, but I don't believe the error is there. The output says it has successfully completed
My sonar-project.properties looks like this:
sonar.projectKey=my.project
sonar.projectName=my-project
sonar.projectVersion=0.0.1-Snapshot
sonar.sourceEncoding=UTF-8
sonar.sources={ProjectPath}/ng-cli/src/app
sonar.exclusions={ProjectPath}/ng-cli/node_modules/**, 20_sourcecode/DDS_Client/ng-cli/src/app/*.spec.ts
sonar.tests={ProjectPath}/ng-cli/src/app
sonar.test.inclusions={ProjectPath}/ng-cli/src/app/*.spec.ts
sonar.ts.tslint.configPath={ProjectPath}/ng-cli/tslint.json
I have no custom rules. In SonarQube I defined the path to TSLint:
{Path}/tslint/bin/tslint
I checked the paths, they should be ok (if I don't understand where to go).
I use:
- SonarQube: 5.6.5
- SonarTsPlugin: v1.1.0-RC1
- tslint: 4.3.0
- Jenkins: 1.598 (if needed)
Is there anything I missed for customization or any other guidelines?
Edit: I tested it with a more obvious rule violation:
Forcing case execution in switch statements
and added the following line of code:
var someString: string = "1";
switch (someString) {
case "1":
/* code */
break;
}
SonarQube recognizes these newlines, but does not report a rule violation here.
No one has answered this question yet
Check out similar questions: