Open greenlaw110 opened 7 years ago
Further finding, I have replaced the shell based sonar-scanner
with Jenkins' integrated SonarQuebe scanner:
And I can see a huge amount of tslint warnings in the jenkins job log:
However in the Sonar server there is still no bugs, no vulnerabilities and no smells:
You've set a project path in your sonar-project.properties, it seems from the log? i.e. you'll have a key somewhere
sonar.ts.tslint.projectPath=src
If you're specifying projectPath, you need to specify the full path to the project's tsconfig.json
file rather than just the path to the containing folder - you may find that sorts things. Seems there's a bug when using a project file that it doesn't log the command line being sent to tslint
which is making diagnosis a bit trickier but my guess is the above.
Here is my sonar-project.properties
file content:
1 sonar.projectKey=myproj
2 sonar.projectName=My Project
3 sonar.projectVersion=2.0.0
4
5 sonar.sources=src
6 sonar.sourceEncoding=UTF-8
7 sonar.language=ts
8
9 sonar.host.url=http://localhost:9000
10 sonar.login=<the-sonar-token>
11
12 sonar.scm.disabled=true
13 sonar.ts.tslint.path=node_modules/tslint/bin
14 sonar.ts.tslint.projectPath=src
Now I have commented out the sonar.ts.tslint.projectPath=src
line:
The result is still the same:
The Jenkins log could be found at
https://gist.github.com/greenlaw110/0515201a48c25d5661a0d4c878c5a54c
I am experiencing the same result. My sonarqube version is 5.6.6 and sonar scanner version is 3.0.3.778.
Any help would be appreciated.
Same problem here with same versions than @Jeferex.
Any updates on this? Facing the same problem.
The solution I found to this was the following:
Example snip of sonar-project.properties:
sonar.scm.disabled=true
sonar.ts.tslint.path=node_modules/tslint/bin/tslint
sonar.ts.tslint.projectPath=src
sonar.ts.tslint.nodePath=/usr/bin/nodejs
sonar.ts.tslint.enabled=true
sonar.ts.tslint.rulesDir=node_modules/tslint-eslint-rules/dist/rules
sonar.ts.tslint.outputPath=
In the above example, I am using a linux install and I am pointing to the actual binary for nodejs and tslint.
@CINJ I followed your instructions, but it still doesn't work for me. It's like there are no files being analysed. Here's the part about typescript in my console when running in debug mode:
14:40:22.404 INFO: Sensor Linting sensor for TypeScript files (wrapped) 14:40:22.404 DEBUG: Found sonar.ts.tslint.path path to be 'web/node_modules/tslint/bin/tslint' 14:40:22.404 DEBUG: Found sonar.ts.tslint.configPath path to be 'tslint.json' 14:40:22.404 DEBUG: Found sonar.ts.tslint.rulesDir path to be 'web/node_modules/tslint-eslint-rules/dist/rules' 14:40:22.404 DEBUG: Found sonar.ts.tslint.projectPath path to be 'web/srcReact' 14:40:22.404 DEBUG: Path sonar.ts.tslint.outputPath not specified, falling back to null 14:40:22.414 DEBUG: Using a temporary path for TsLint output: /tmp/jenkins/workspace/UTIL - Run SonarQube Analysis (test)/.scannerwork/.sonartmp/634329673450925242.tmp 14:40:22.415 DEBUG: Running against a single project JSON file 14:40:23.159 INFO: Sensor Linting sensor for TypeScript files (wrapped) (done) | time=755ms
Same here, @CINJ solution did'nt worked as expected.
You need to post your tslint.json file, your sonar-project properties file to help me understand the problem.
The issues I faced were twofold:
To help debug the issues yourself, see if you can run TSLINT directly from the command line on your project. If that works perperly, then you can move back up the chain to the sonar-plugin and make sure it's configuration is correct.
Regards Joe
I've got the same problem. I try to run sonar-scanner with (tslint: v5.8.0, tslint-sonarts: v1.6.0 and sonarqube-scanner: v2.0.2) - and it seems that no tslint rules have been checked.
If I run tslint separately from command-line, broken rules can be found. Here's the relevant snipped of my sonar-project.properties
sonar.sourceEncoding=UTF-8 sonar.sources=src sonar.ts.tslint.projectPath=tsconfig.json sonar.ts.tslint.typeCheck=true sonar.ts.tslint.enabled=true
I already tried to set the following paths explicit but still no errors:
sonar.ts.tslint.path=node_modules\tslint\bin\tslint sonar.ts.tslint.nodePath=C:\Program Files\nodejs\node.exe
sonar-scanner -X
says:
13:35:41.334 DEBUG: Analyzing 98 typescript file(s) with the following configuration file (...)\trunk\tsconfig.json
So I think my configuration is ok?
What am I doing wrong?
Hi, I facing the same problem is there any update on it ? Thanks
Here is my
sonar-project.properties
:My sonar-scanner version
My sonarqube version is
5.6.3
Running
sonar-scanner -X
generated the following outputs: