Augustus
Augustus

Reputation: 385

SonarQube not detecting Angular-TypeScript rule breach

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)”

I have noticed the following 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, Can you please help me what am i missing?

Thanks

Upvotes: 2

Views: 1354

Answers (1)

Augustus
Augustus

Reputation: 385

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

sonar.typescript.tsconfigPath = tsconfig.app.json

i hope the comment will help someone

Upvotes: 2

Related Questions