Typescript rules not detected in an Angular application

Hi,

I am new to Sonar Qube, and i am trying to check the code smells in an angular (typescript) app, but dont seem to detect the rule breaches.

SonarQube version is the latest: sonarqube-7.9.3

in my angular component i added this rule breach explicitly:

var a = NaN;

if (a === NaN) {  // Noncompliant; always false

  console.log("a is not a number");  // this is dead code

}

When i run: npm run sonar, it displays no issues under http://localhost:9000/projects.

my sonar-project.properties file has:

sonar.host.url=http://localhost:9000
sonar.login=admin
sonar.password=admin
sonar.projectKey=test-app
sonar.projectName=test-app
sonar.projectVersion=1.0
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.exclusions=**/node_modules/**
sonar.tests=src
sonar.test.inclusions=**/*.spec.ts
sonar.typescript.lcov.reportPaths=coverage/lcov.info

Quality Profile typescript is set to “Sonar way recommended)”.

Can you please help me what am i missing?

Regards
Luay

I have noticed in the output

ERROR: Failed to find a source file matching path D:\temp\angularHelloWorld\hello-world-angular\src\app\app.component.ts in program created with D:\temp\angularHelloWorld\hello-world-angular\tsconfig.json

i dont see anything weird in the tsconfig, i have been struggling with this for the past 2 days, any hint is appreciated.

it turned out that i need to add the following line:

sonar.typescript.tsconfigPath = tsconfig.app.json

i hopethe comment will help someone

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.