【问题标题】:SonarQube not detecting Angular-TypeScript rule breachSonarQube 未检测到 Angular-TypeScript 规则违规
【发布时间】:2020-11-04 15:47:12
【问题描述】:

我是 Sonar Qube 的新手,我正在尝试检查 Angular(打字稿)应用程序中的代码气味,但似乎没有检测到违反规则的情况。

SonarQube 版本为最新:sonarqube-7.9.3

在我的角度组件中,我明确添加了此规则违规:

var a = NaN;

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

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

}

当我运行:npm run sonar 时,它在 http://localhost:9000/projects 下没有显示任何问题。

我的 sonar-project.properties 文件有:

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

质量配置文件打字稿设置为“推荐声纳方式”

我在输出中注意到以下内容:

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

我在 tsconfig 中没有看到任何奇怪的东西,你能帮我看看我缺少什么吗?

谢谢

【问题讨论】:

    标签: typescript sonarqube sonarqube-scan


    【解决方案1】:

    原来我需要添加以下行:

    sonar.typescript.tsconfigPath = tsconfig.app.json
    

    我希望评论对某人有所帮助

    【讨论】:

      猜你喜欢
      • 2019-01-07
      • 2016-02-12
      • 1970-01-01
      • 2015-10-13
      • 1970-01-01
      • 2014-11-24
      • 2019-07-09
      • 1970-01-01
      • 2018-07-15
      相关资源
      最近更新 更多