Pablissimo / SonarTsPlugin

SonarQube plugin for TypeScript files
MIT License
185 stars 106 forks source link

Command executable cannot be blank #154

Open JulianSauer opened 7 years ago

JulianSauer commented 7 years ago

When trying to run sonar-scanner I get this exception:

java.lang.IllegalArgumentException: Command executable can not be blank
    at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
    at org.sonar.api.utils.command.Command.<init>(Command.java:49)
    at org.sonar.api.utils.command.Command.create(Command.java:61)
    at com.pablissimo.sonar.TsLintExecutorImpl.getBaseCommand(TsLintExecutorImpl.java:47)
    at com.pablissimo.sonar.TsLintExecutorImpl.execute(TsLintExecutorImpl.java:105)
    at com.pablissimo.sonar.TsLintSensor.execute(TsLintSensor.java:84)
    at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
    at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:87)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:81)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:67)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:75)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:178)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:259)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:254)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
    at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
    at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)

sonar-project.properties:

sonar.projectKey=toh:tour-of-heroes
sonar.projectName=Tour of Heroes
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src/app/
sonar.exclusions=\*\*/node_modules/\*\*,\*\*/\*.spec.ts
sonar.tests=src/app
sonar.test.inclusions=\*\*/\*.spec.ts

sonar.ts.tslint.configPath=tslint.json
sonar.ts.tslintpath=node_modules/tslint/bin/tslint
sonar.ts.coverage.lcovReportPath=coverage.lcov

Used versions: sonar-scanner: 3.0.3 SonarQube: 6.4 tslint: 5.4.3 Typescript: 2.3.4

Pablissimo commented 7 years ago

I've not tested anything yet on the 3.0.3 scanner (the old regression pack went up to 3.0.0). Can you run with the -X flag and send the log lines just before that exception please? It'll describe to you how the plugin has interpreted the configuration you've given it.

ivnaleta commented 7 years ago

I have this error with sonar-scanner- 3.0.0, sonarqube-5.6.6, typescript 2.2.0 and tslint 4.5.0.

config.getPathToNode() in TsLintExecutorImpl.java:47 is null. (even if set in configuration)

My log:

17:43:55.684 INFO: Scanner configuration file: /home/ivan/apps/sonar-scanner-3.0.0.702-linux/conf/sonar-scanner.properties
17:43:55.686 INFO: Project root configuration file: /home/ivan/workspace/factoring-frontend/sonar-project.properties
17:43:55.702 INFO: SonarQube Scanner 3.0.0.702
17:43:55.702 INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
17:43:55.702 INFO: Linux 4.4.0-83-generic amd64
17:43:55.813 DEBUG: keyStore is : 
17:43:55.814 DEBUG: keyStore type is : jks
17:43:55.814 DEBUG: keyStore provider is : 
17:43:55.814 DEBUG: init keystore
17:43:55.814 DEBUG: init keymanager of type SunX509
17:43:55.874 INFO: User cache: /home/ivan/.sonar/cache
17:43:55.874 DEBUG: Extract sonar-scanner-api-batch in temp...
17:43:55.878 DEBUG: Get bootstrap index...
17:43:55.878 DEBUG: Download: http://localhost:9000/batch/index
17:43:55.916 DEBUG: Get bootstrap completed
17:43:55.917 DEBUG: Create isolated classloader...
17:43:55.922 DEBUG: Start temp cleaning...
17:43:55.928 DEBUG: Temp cleaning done
17:43:55.928 DEBUG: Execution getVersion
17:43:55.952 DEBUG: Execution start
17:43:56.100 DEBUG: Publish global mode
17:43:56.176 INFO: Load global repositories
17:43:56.266 DEBUG: GET 200 http://localhost:9000/batch/global | time=90ms
17:43:56.310 INFO: Load global repositories (done) | time=133ms
17:43:56.332 INFO: User cache: /home/ivan/.sonar/cache
17:43:56.568 INFO: Load plugins index
17:43:56.574 DEBUG: GET 200 http://localhost:9000/deploy/plugins/index.txt | time=6ms
17:43:56.575 INFO: Load plugins index (done) | time=6ms
17:43:56.576 DEBUG: Load plugins
17:43:56.631 DEBUG: Load plugins (done) | time=55ms
17:43:56.640 DEBUG: API compatibility mode is enabled on plugin C# [csharp] (built with API lower than 5.2)
17:43:56.640 DEBUG: API compatibility mode is enabled on plugin Java [java] (built with API lower than 5.2)
17:43:56.641 DEBUG: API compatibility mode is enabled on plugin Git [scmgit] (built with API lower than 5.2)
17:43:56.642 DEBUG: API compatibility mode is enabled on plugin SVN [scmsvn] (built with API lower than 5.2)
17:43:56.642 DEBUG: API compatibility mode is enabled on plugin JavaScript [javascript] (built with API lower than 5.2)
17:43:56.728 DEBUG: Plugins:
17:43:56.728 DEBUG:   * C# 5.0 (csharp)
17:43:56.728 DEBUG:   * Java 3.13.1 (java)
17:43:56.728 DEBUG:   * Git 1.2 (scmgit)
17:43:56.728 DEBUG:   * TypeScript 1.1.0 (typescript)
17:43:56.728 DEBUG:   * SVN 1.3 (scmsvn)
17:43:56.728 DEBUG:   * JavaScript 2.11 (javascript)
17:43:56.743 DEBUG: Execution getVersion
17:43:56.743 INFO: SonarQube server 5.6.6
17:43:56.743 INFO: Default locale: "en_US", source code encoding: "UTF-8"
17:43:56.744 DEBUG: Work directory: /home/ivan/workspace/factoring-frontend/.scannerwork
17:43:56.744 DEBUG: Execution getVersion
17:43:56.744 DEBUG: Execution execute
17:43:56.982 INFO: Process project properties
17:43:56.985 DEBUG: Process project properties (done) | time=3ms
17:43:57.059 INFO: Load project repositories
17:43:57.206 DEBUG: GET 200 http://localhost:9000/batch/project.protobuf?key=factoring-frontend | time=146ms
17:43:57.337 INFO: Load project repositories (done) | time=278ms
17:43:57.562 DEBUG: Available languages:
17:43:57.562 DEBUG:   * C# => "cs"
17:43:57.562 DEBUG:   * Java => "java"
17:43:57.562 DEBUG:   * TypeScript => "ts"
17:43:57.562 DEBUG:   * JavaScript => "js"
17:43:57.569 INFO: Load quality profiles
17:43:57.598 DEBUG: GET 200 http://localhost:9000/api/qualityprofiles/search.protobuf?projectKey=factoring-frontend | time=28ms
17:43:57.602 INFO: Load quality profiles (done) | time=33ms
17:43:57.606 INFO: Load active rules
17:43:57.690 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=cs-sonar-way-72800&p=1&ps=500 | time=84ms
17:43:58.003 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=java-sonar-way-86418&p=1&ps=500 | time=290ms
17:43:58.059 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=js-sonar-way-04534&p=1&ps=500 | time=34ms
17:43:58.173 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=ts-tslint-43538&p=1&ps=500 | time=112ms
17:43:58.184 INFO: Load active rules (done) | time=578ms
17:43:58.227 INFO: Publish mode
17:43:58.227 DEBUG: Start recursive analysis of project modules
17:43:58.228 INFO: -------------  Scan factoring-frontend
17:43:58.311 INFO: Load server rules
17:43:58.845 DEBUG: GET 200 http://localhost:9000/api/rules/list.protobuf | time=534ms
17:43:58.864 INFO: Load server rules (done) | time=553ms
17:43:58.902 DEBUG: Initializers : 
17:43:58.902 INFO: Base dir: /home/ivan/workspace/factoring-frontend
17:43:58.902 INFO: Working dir: /home/ivan/workspace/factoring-frontend/.scannerwork
17:43:58.903 INFO: Source paths: test
17:43:58.903 INFO: Source encoding: UTF-8, default locale: en_US
17:43:58.904 INFO: Index files
17:43:58.905 INFO: Excluded sources: 
17:43:58.905 INFO:   ./node_modules/**
17:43:58.905 INFO:   ./src/assets/**
17:43:58.908 DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : **/*.cs
17:43:58.908 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : **/*.java,**/*.jav
17:43:58.909 DEBUG: Declared extensions of language TypeScript were converted to sonar.lang.patterns.ts : **/*.ts,**/*.tsx
17:43:58.909 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : **/*.js
17:43:58.912 DEBUG: Language of file 'test/index.ts' is detected to be 'ts'
17:43:58.917 INFO: 1 files indexed
17:43:58.917 INFO: 0 files ignored because of inclusion/exclusion patterns
17:43:58.921 INFO: Quality profile for ts: TsLint
17:43:59.299 INFO: JaCoCoSensor: JaCoCo report not found : /home/ivan/workspace/factoring-frontend/target/jacoco.exec
17:43:59.299 INFO: JaCoCoItSensor: JaCoCo IT report not found: /home/ivan/workspace/factoring-frontend/target/jacoco-it.exec
17:43:59.303 DEBUG: Code colorizer, supported languages: cs
17:43:59.318 DEBUG: Sensors : Lines Sensor (wrapped) -> SCM Sensor (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)
17:43:59.318 INFO: Sensor Lines Sensor (wrapped)
17:43:59.326 INFO: Sensor Lines Sensor (wrapped) (done) | time=8ms
17:43:59.326 INFO: Sensor SCM Sensor (wrapped)
17:43:59.327 INFO: SCM provider for this project is: git
17:43:59.330 INFO: 1 files to be analyzed
17:43:59.354 DEBUG: readpipe [git, --version],/usr/bin
17:43:59.405 DEBUG: readpipe may return 'git version 2.7.4'
17:43:59.405 DEBUG: remaining output:

17:43:59.405 DEBUG: readpipe [git, config, --system, --edit],/usr/bin
17:43:59.411 DEBUG: readpipe may return '/etc/gitconfig'
17:43:59.411 DEBUG: remaining output:

17:43:59.432 DEBUG: Blame file test/index.ts
17:43:59.534 DEBUG: Unable to blame file test/index.ts. No blame info at line 1. Is file committed? [Author: PersonIdent[Not Committed Yet, , Mon Jul 10 17:43:59 2017 +0300] Source commit: null]
17:43:59.537 INFO: 0/1 files analyzed
17:43:59.538 INFO: Sensor SCM Sensor (wrapped) (done) | time=212ms
17:43:59.538 INFO: Sensor Linting sensor for TypeScript files (wrapped)
17:43:59.538 DEBUG: Path sonar.ts.tslint.path not specified, falling back to node_modules/tslint/bin/tslint
17:43:59.540 DEBUG: Found sonar.ts.tslint.configPath path to be './tslint.json'
17:43:59.540 DEBUG: Path sonar.ts.tslint.rulesDir not specified, falling back to null
17:43:59.540 DEBUG: Path sonar.ts.tslint.projectPath not specified, falling back to null
17:43:59.540 DEBUG: Path sonar.ts.tslint.outputPath not specified, falling back to null
17:43:59.540 DEBUG: Found sonar.ts.tslint.nodePath path to be 'node'
17:43:59.557 INFO: ------------------------------------------------------------------------
17:43:59.557 INFO: EXECUTION FAILURE
17:43:59.558 INFO: ------------------------------------------------------------------------
17:43:59.559 INFO: Total time: 3.892s
17:43:59.682 INFO: Final Memory: 46M/212M
17:43:59.682 INFO: ------------------------------------------------------------------------
17:43:59.684 DEBUG: Execution getVersion
17:43:59.686 DEBUG: Execution stop
JulianSauer commented 7 years ago

Do you just mean these lines?

18:21:12.996 DEBUG: Found sonar.ts.tslint.path path to be '/usr/lib/node_modules/tslint/bin/tslint'
18:21:12.996 DEBUG: Found sonar.ts.tslint.configPath path to be 'tslint.json'
18:21:12.996 DEBUG: Path sonar.ts.tslint.rulesDir not specified, falling back to null
18:21:12.996 DEBUG: Path sonar.ts.tslint.projectPath not specified, falling back to null
18:21:12.996 DEBUG: Path sonar.ts.tslint.outputPath not specified, falling back to null
18:21:12.996 DEBUG: Path sonar.ts.tslint.nodePath not specified, falling back to node
18:21:13.010 INFO: ------------------------------------------------------------------------
18:21:13.010 INFO: EXECUTION FAILURE
18:21:13.010 INFO: ------------------------------------------------------------------------
18:21:13.010 INFO: Total time: 4.627s
18:21:13.118 INFO: Final Memory: 46M/223M
18:21:13.118 INFO: ------------------------------------------------------------------------
vkdinventor commented 7 years ago

I am also facing same issue.

zoltantarcsay commented 7 years ago

I worked around this error (java.lang.IllegalArgumentException: Command executable can not be blank) by setting sonar.ts.tslint.nodePath explicitly.

Nagarjunaavula commented 6 years ago

i am also getting same error.

girlygeek commented 6 years ago

I am getting this error also.

guilleremirez commented 6 years ago

Me too. Was the root cause discovered?