SonarSource / SonarTS

Static code analyzer for TypeScript
GNU Lesser General Public License v3.0
761 stars 53 forks source link

Setting sonar.typescript.tsconfigPath via pom.xml results in wrong path #868

Closed bseiller closed 5 years ago

bseiller commented 5 years ago

I want to report a bug. Setting the value for sonar.typescript.tsconfigPath via properties

<sonar.typescript.tsconfigPath>${project.basedir}${file.separator}tsconfig_app.json</sonar.typescript.tsconfigPath>

in a pom.xml results in the below error in the logs. If using a non-standard file name this will break the analysis - see the attached example project maven_867.zip, that contains 2 tsconfig files just to illustrate. Using the standard file name tsconfig.json can mask this problem. It seems that part of the path is prepended twice.

SonarTS version: 1.9 (build 3766)
Node.js version: v8.11.1
TypeScript version: 2.7.2

SonarQube version: Version 7.9 (build 26994)

Logs

[ERROR] 13:14:00.437 The tsconfig file [/home/gf-user/maven_867/typescript-module/home/gf-user/maven_867/typescript-module/tsconfig_app.json] doesn't exist. Check property specified in sonar.typescript.tsconfigPath
[INFO] 13:14:00.445 Analyzing 2 typescript file(s) with the following configuration file /home/gf-user/maven_867/typescript-module/tsconfig.json

maven_867.log

Expected behavior Setting sonar.typescript.tsconfigPath via pom.xml should be possible and result in a working TS analysis.

vilchik-elena commented 5 years ago

In the description of this property it's written Relative to a project/module base directory path to a tsconfig JSON file. So just put in your pom:

<sonar.typescript.tsconfigPath>tsconfig_app.json</sonar.typescript.tsconfigPath>
bseiller commented 5 years ago

Ah, now I see, thank you for pointing this out to me. And please accept my humble apology for not properly reading the description! 😞