Skip to content
This repository has been archived by the owner on Jul 8, 2019. It is now read-only.

SonarQube SonarTsPlugin report not showing any Issues #173

Open
ws11606 opened this issue Aug 25, 2017 · 8 comments
Open

SonarQube SonarTsPlugin report not showing any Issues #173

ws11606 opened this issue Aug 25, 2017 · 8 comments

Comments

@ws11606
Copy link

ws11606 commented Aug 25, 2017

I followed instructions to install SonarTsPlugin on my SonarQube 5.6.6 and ran sonar-scanner on the basic-setup sample project but the SonarQube report is not showing any issues. Hopefully someone can help me. Running tslint using the sample projects' tslint.json file correctly outputs this:
ERROR: src/MyApp.ts[15, 13]: else statements must be braced
ERROR: src/MyApp.ts[1, 8]: The internal 'module' syntax is deprecated, use the 'namespace' keyword instead.
ERROR: src/MyApp.ts[12, 20]: == should be ===
ERROR: src/MyApp.ts[25, 36]: missing whitespace
ERROR: src/MyApp.ts[25, 43]: missing whitespace

Here's sonar-scanner -X output:
16:27:46.139 INFO: Scanner configuration file: C:\Users\ws11606\AppData\Roaming\npm\node_modules\sonar-scanner\bin..\conf\sonar-scanner.properties
16:27:46.142 INFO: Project root configuration file: C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup\sonar-project.properties
16:27:46.153 INFO: SonarQube Scanner 3.0.3.778
16:27:46.153 INFO: Java 1.8.0_91 Oracle Corporation (32-bit)
16:27:46.153 INFO: Windows 7 6.1 x86
16:27:46.234 DEBUG: keyStore is :
16:27:46.234 DEBUG: keyStore type is : jks
16:27:46.234 DEBUG: keyStore provider is :
16:27:46.234 DEBUG: init keystore
16:27:46.234 DEBUG: init keymanager of type SunX509
16:27:46.320 INFO: User cache: C:\Users\ws11606.sonar\cache
16:27:46.320 DEBUG: Extract sonar-scanner-api-batch in temp...
16:27:46.324 DEBUG: Get bootstrap index...
16:27:46.324 DEBUG: Download: http://dwebscm01.staging.int:9090/batch/index
16:27:46.374 DEBUG: Get bootstrap completed
16:27:46.374 DEBUG: Create isolated classloader...
16:27:46.379 DEBUG: Start temp cleaning...
16:27:46.397 DEBUG: Temp cleaning done
16:27:46.397 DEBUG: Execution getVersion
16:27:46.401 DEBUG: Execution start
16:27:46.589 DEBUG: Publish global mode
16:27:46.655 INFO: Load global repositories
16:27:46.753 DEBUG: GET 200 http://dwebscm01.staging.int:9090/batch/global | time=97ms
16:27:46.802 INFO: Load global repositories (done) | time=147ms
16:27:46.816 INFO: User cache: C:\Users\ws11606.sonar\cache
16:27:47.042 INFO: Load plugins index
16:27:47.050 DEBUG: GET 200 http://dwebscm01.staging.int:9090/deploy/plugins/index.txt | time=7ms
16:27:47.050 INFO: Load plugins index (done) | time=8ms
16:27:47.051 DEBUG: Load plugins
16:27:47.076 DEBUG: Load plugins (done) | time=25ms
16:27:47.088 DEBUG: API compatibility mode is enabled on plugin Git [scmgit] (built with API lower than 5.2)
16:27:47.093 DEBUG: API compatibility mode is enabled on plugin SVN [scmsvn] (built with API lower than 5.2)
16:27:47.191 DEBUG: Plugins:
16:27:47.191 DEBUG: * C# 6.3.0.2862 (csharp)
16:27:47.191 DEBUG: * SonarJava 4.12.0.11033 (java)
16:27:47.191 DEBUG: * Git 1.2 (scmgit)
16:27:47.191 DEBUG: * TypeScript 1.1.0 (typescript)
16:27:47.191 DEBUG: * SVN 1.3 (scmsvn)
16:27:47.191 DEBUG: * SonarJS 3.1.1.5128 (javascript)
16:27:47.201 DEBUG: Execution getVersion
16:27:47.202 INFO: SonarQube server 5.6.6
16:27:47.202 INFO: Default locale: "en_US", source code encoding: "UTF-8"
16:27:47.202 DEBUG: Work directory: C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup.scannerwork
16:27:47.202 DEBUG: Execution getVersion
16:27:47.202 DEBUG: Execution execute
16:27:47.377 INFO: Process project properties
16:27:47.379 DEBUG: Process project properties (done) | time=2ms
16:27:47.445 INFO: Load project repositories
16:27:47.482 DEBUG: GET 200 http://dwebscm01.staging.int:9090/batch/project.protobuf?key=com.pablissimo.sonar%3Abasic-setup | time=36ms
16:27:47.532 INFO: Load project repositories (done) | time=87ms
16:27:47.605 DEBUG: Available languages:
16:27:47.606 DEBUG: * C# => "cs"
16:27:47.606 DEBUG: * Java => "java"
16:27:47.606 DEBUG: * TypeScript => "ts"
16:27:47.606 DEBUG: * JavaScript => "js"
16:27:47.610 INFO: Load quality profiles
16:27:47.642 DEBUG: GET 200 http://dwebscm01.staging.int:9090/api/qualityprofiles/search.protobuf?projectKey=com.pablissimo.sonar%3Abasic-setup | time=32ms
16:27:47.646 INFO: Load quality profiles (done) | time=36ms
16:27:47.650 INFO: Load active rules
16:27:47.868 DEBUG: GET 200 http://dwebscm01.staging.int:9090/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=cs-sonar-way-77016&p=1&ps=500 | time=218ms
16:27:48.050 DEBUG: GET 200 http://dwebscm01.staging.int:9090/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=java-sonar-way-77026&p=1&ps=500 | time=129ms
16:27:48.134 DEBUG: GET 200 http://dwebscm01.staging.int:9090/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=js-sonar-way-29109&p=1&ps=500 | time=69ms
16:27:48.219 DEBUG: GET 200 http://dwebscm01.staging.int:9090/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=ts-tslint-55271&p=1&ps=500 | time=79ms
16:27:48.251 INFO: Load active rules (done) | time=601ms
16:27:48.295 INFO: Publish mode
16:27:48.295 DEBUG: Start recursive analysis of project modules
16:27:48.296 INFO: ------------- Scan Basic project setup example
16:27:48.354 INFO: Load server rules
16:27:48.456 DEBUG: GET 200 http://dwebscm01.staging.int:9090/api/rules/list.protobuf | time=102ms
16:27:48.470 INFO: Load server rules (done) | time=117ms
16:27:48.530 DEBUG: Initializers :
16:27:48.531 INFO: Base dir: C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup
16:27:48.531 INFO: Working dir: C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup.scannerwork
16:27:48.532 INFO: Source paths: src
16:27:48.533 INFO: Test paths: test
16:27:48.533 INFO: Source encoding: UTF-8, default locale: en_US
16:27:48.533 INFO: Index files
16:27:48.534 INFO: Excluded sources:
16:27:48.534 INFO: node_modules/**
16:27:48.537 DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : /.cs
16:27:48.537 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : **/
.java,
/.jav
16:27:48.537 DEBUG: Declared extensions of language TypeScript were converted to sonar.lang.patterns.ts : **/
.ts,/.tsx
16:27:48.537 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : **/
.js,
/.jsx,**/.vue
16:27:48.541 DEBUG: Language of file 'src/MyApp.ts' is detected to be 'ts'
16:27:48.542 DEBUG: Language of file 'test/MyAppTests.ts' is detected to be 'ts'
16:27:48.546 INFO: 2 files indexed
16:27:48.546 INFO: 0 files ignored because of inclusion/exclusion patterns
16:27:48.549 INFO: Quality profile for ts: TsLint
16:27:48.550 DEBUG: Code colorizer, supported languages:
16:27:48.818 DEBUG: 'C#' skipped because there is no related file in current project
16:27:48.818 DEBUG: 'C# Unit Tests Coverage Report Import' skipped because there is no related file in current project
16:27:48.819 DEBUG: 'C# Integration Tests Coverage Report Import' skipped because there is no related file in current project
16:27:48.819 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
16:27:48.819 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
16:27:48.819 DEBUG: 'JaCoCoItSensor' skipped because there is no related file in current project
16:27:48.819 DEBUG: 'JaCoCoOverallSensor' skipped because there is no related file in current project
16:27:48.819 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
16:27:48.819 DEBUG: 'JavaScript Squid Sensor' skipped because there is no related file in current project
16:27:48.822 DEBUG: Sensors : Lines Sensor (wrapped) -> SCM Sensor (wrapped) -> C# Unit Test Results Import (wrapped) -> SonarJavaXmlFileSensor (wrapped) -> Linting sensor for TypeScript files (wrapped) -> Combined LCOV and LOC sensor (wrapped) -> Zero Coverage Sensor (wrapped) -> Code Colorizer Sensor (wrapped) -> CPD Block Indexer (wrapped)
16:27:48.823 INFO: Sensor Lines Sensor (wrapped)
16:27:48.828 INFO: Sensor Lines Sensor (wrapped) (done) | time=5ms
16:27:48.828 INFO: Sensor SCM Sensor (wrapped)
16:27:48.828 INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
16:27:48.828 INFO: Sensor SCM Sensor (wrapped) (done) | time=0ms
16:27:48.828 INFO: Sensor C# Unit Test Results Import (wrapped)
16:27:48.828 DEBUG: No unit test results property. Skip Sensor
16:27:48.829 INFO: Sensor C# Unit Test Results Import (wrapped) (done) | time=1ms
16:27:48.829 INFO: Sensor SonarJavaXmlFileSensor (wrapped)
16:27:48.829 INFO: Sensor SonarJavaXmlFileSensor (wrapped) (done) | time=0ms
16:27:48.829 INFO: Sensor Linting sensor for TypeScript files (wrapped)
16:27:48.829 DEBUG: Found sonar.ts.tslint.path path to be 'C:\Users\Tfs_build_user\AppData\Roaming\npm'
16:27:48.829 DEBUG: Found sonar.ts.tslint.configPath path to be 'tslint.json'
16:27:48.829 DEBUG: Path sonar.ts.tslint.rulesDir not specified, falling back to null
16:27:48.829 DEBUG: Path sonar.ts.tslint.projectPath not specified, falling back to null
16:27:48.829 DEBUG: Path sonar.ts.tslint.outputPath not specified, falling back to null
16:27:48.831 DEBUG: Using a temporary path for TsLint output: C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup.scannerwork.sonartmp\2961287337999812949.tmp
16:27:48.831 DEBUG: Split 2 files into 1 batches for processing
16:27:48.831 DEBUG: Executing TsLint with command: node C:\Users\Tfs_build_user\AppData\Roaming\npm --format json --out C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup.scannerwork.sonartmp\2961287337999812949.tmp --config C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup\tslint.json C:/temp/SonarQube/Upgrade/SonarTsPlugin-master/SonarTsPlugin-master/samples/basic-setup/src/MyApp.ts C:/temp/SonarQube/Upgrade/SonarTsPlugin-master/SonarTsPlugin-master/samples/basic-setup/test/MyAppTests.ts
16:27:49.074 INFO: Sensor Linting sensor for TypeScript files (wrapped) (done) | time=245ms
16:27:49.074 INFO: Sensor Combined LCOV and LOC sensor (wrapped)
16:27:49.078 INFO: Analysing C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup\coverage\lcov.info
16:27:49.085 INFO: Sensor Combined LCOV and LOC sensor (wrapped) (done) | time=11ms
16:27:49.085 INFO: Sensor Zero Coverage Sensor (wrapped)
16:27:49.089 INFO: Sensor Zero Coverage Sensor (wrapped) (done) | time=4ms
16:27:49.089 INFO: Sensor Code Colorizer Sensor (wrapped)
16:27:49.090 INFO: Sensor Code Colorizer Sensor (wrapped) (done) | time=1ms
16:27:49.090 INFO: Sensor CPD Block Indexer (wrapped)
16:27:49.090 INFO: DefaultCpdBlockIndexer is used for ts
16:27:49.090 DEBUG: No CpdMapping for language ts
16:27:49.090 INFO: Sensor CPD Block Indexer (wrapped) (done) | time=0ms
16:27:49.091 INFO: Calculating CPD for 0 files
16:27:49.091 INFO: CPD calculation finished
16:27:49.149 INFO: Analysis report generated in 55ms, dir size=26 KB
16:27:49.159 INFO: Analysis reports compressed in 9ms, zip size=9 KB
16:27:49.159 INFO: Analysis report generated in C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup.scannerwork\batch-report
16:27:49.159 DEBUG: Upload report
16:27:49.200 DEBUG: POST 200 http://dwebscm01.staging.int:9090/api/ce/submit?projectKey=com.pablissimo.sonar:basic-setup&projectName=Basic%20project%20setup%20example | time=41ms
16:27:49.201 INFO: Analysis report uploaded in 42ms
16:27:49.201 INFO: ANALYSIS SUCCESSFUL, you can browse http://dwebscm01.staging.int:9090/dashboard/index/com.pablissimo.sonar:basic-setup
16:27:49.201 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
16:27:49.201 INFO: More about the report processing at http://dwebscm01.staging.int:9090/api/ce/task?id=AV4Wkr4xwAv3nlvBvvHD
16:27:49.205 DEBUG: Report metadata written to C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup.scannerwork\report-task.txt
16:27:49.206 DEBUG: Post-jobs :
16:27:49.208 INFO: ------------------------------------------------------------------------
16:27:49.208 INFO: EXECUTION SUCCESS
16:27:49.208 INFO: ------------------------------------------------------------------------
16:27:49.208 INFO: Total time: 3.087s
16:27:49.237 INFO: Final Memory: 42M/104M
16:27:49.237 INFO: ------------------------------------------------------------------------
16:27:49.237 DEBUG: Execution getVersion
16:27:49.237 DEBUG: Execution stop

@greenlaw110
Copy link

I think this is exactly the same issue with #172

@ws11606
Copy link
Author

ws11606 commented Aug 28, 2017

Hi greenlaw110, was your issue #172 ever resolved? Thx.

@ws11606
Copy link
Author

ws11606 commented Aug 28, 2017

The basic-setup sample project's sonar-project.properties file does not contain
sonar.ts.tslint.projectPath=src

Here's sonar-project.properties content:
sonar.projectKey=com.pablissimo.sonar:basic-setup
sonar.projectName=Basic project setup example
sonar.projectVersion=1.0

sonar.sources=./src
sonar.sourceEncoding=UTF-8
sonar.exclusions=node_modules/**

sonar.tests=./test

To import the LCOV report

sonar.ts.coverage.lcovReportPath=coverage/lcov.info

@ws11606
Copy link
Author

ws11606 commented Aug 28, 2017

Here's my Sonar-Scanner version:
INFO: Scanner configuration file: C:\Users\ws11606\AppData\Roaming\npm\node_modules\sonar-scanner\bin..\conf\sonar-scan
ner.properties
INFO: Project root configuration file: C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic
-setup\sonar-project.properties
INFO: SonarQube Scanner 3.0.3.778
INFO: Java 1.8.0_91 Oracle Corporation (32-bit)
INFO: Windows 7 6.1 x86

@ws11606
Copy link
Author

ws11606 commented Aug 28, 2017

In looking at the log, could this command being executed be wrong?
Executing TsLint with command: node C:\Users\Tfs_build_user\AppData\Roaming\npm --format json --out C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup.scannerwork.sonartmp\2961287337999812949.tmp --config C:\temp\SonarQube\Upgrade\SonarTsPlugin-master\SonarTsPlugin-master\samples\basic-setup\tslint.json C:/temp/SonarQube/Upgrade/SonarTsPlugin-master/SonarTsPlugin-master/samples/basic-setup/src/MyApp.ts C:/temp/SonarQube/Upgrade/SonarTsPlugin-master/SonarTsPlugin-master/samples/basic-setup/test/MyAppTests.ts

@greenlaw110
Copy link

@ws11606 no, it's not resolved.

@ws11606
Copy link
Author

ws11606 commented Aug 29, 2017

I figured it out myself. I passed incorrect path to TSlint when configuring path in SonarQube Admin TypeScript config. Instructions stated that it should be C:\Users[Username]\AppData\Roaming\npm\node_modules\tslint\bin\tslint on Windows. I figured this out from my previous post about the "Executing TsLint with command:" had incorrect path to TsLint. Hope this helps you greenlaw110.

Unfortunately, when I try to use TFS vNext build's SonarQube task (following instructions at http://blogs.blackmarble.co.uk/blogs/rfennell/post/2016/07/05/Running-TSLint-within-SonarQube-on-a-TFS-build), I do not get any results. I think it's because of this build warning log of:
"TsLint reported issues against a file that isn't in the analysis set - will be ignored: s/MyApp.ts"
but I don't know what this error means or how to fix it.

@wOOx92
Copy link

wOOx92 commented Apr 3, 2018

I'm facing the same issue. Any updates here?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants