SonarQube: Ignore files during coverage report

让人想犯罪 __ 提交于 2019-12-11 03:14:30

问题


I want to provide a coverage report for a ui project.

The project mainly consists of .ts files which under version control.

The gulp command used to check coverage, generates .js files which are then checked for coverage. (and a coverage report that ... reports only on those files)

The .js files are not under version control and, when produced are intermingled with the .ts files (i.e., wherever there is a .ts file, a .js file will be generated next to it).

This creates the following issue:

When sonarqube generates coverage report, to my report above (pointed to by sonar.javascript.lcov.reportPaths), the .ts files are added (which of course have 0.0% coverage) and this breaks the actual cov value.

Is there a way / pattern to instruct sonarqube to:

a) perform code analysis on .ts files

b) ignore all .ts files when generating coverage report?


回答1:


Just found out in the project's documentation.

Ignore Code Coverage

You can prevent some files from being taken into account for code coverage by unit tests.

To do so, go to Administration > General Settings > Analysis Scope > Code Coverage and set the Coverage Exclusions property

There is also the following directive that can be used in the sonar-project.properties file:

sonar.coverage.exclusions


来源:https://stackoverflow.com/questions/48378528/sonarqube-ignore-files-during-coverage-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!