从SonarQube 4.1.1分析中排除Java测试文件

我没有在SonarQube中报告Java测试文件的ward违规,但我确实希望分析和显示JUnit和Cobertura代码覆盖(JUnit和代码覆盖率报告被重用,而不是由SonarQube执行).

如何仅从违规分析中排除测试文件?我尝试添加全局排除这些设置,但它们无法正常工作:

**/test/**
**/Test*.*

谢谢

解决方法:

SonarQube可以忽略某些组件和某些编码规则的问题.您可能希望阅读SonarQube Narrowing the Focus中的“忽略多个条件上的问题”部分.

如文档中所述:

You can ignore issues on certain components and for certain coding rules.

Examples:

  • I want to ignore all issues on all files => *;**/*
  • I want to ignore all issues on COBOL program bank/ZTR00021.cbl => *;bank/ZTR00021.cbl
  • I want to ignore all issues on classes located directly in the Java package com.foo, but not in its sub-packages => ;com/foo/
  • I want to ignore all issues against coding rule cpp.Union on files in the directory object and its sub-directories => cpp.Union;object/**/*
上一篇:java – 如何加快Sonar的包装设计分析?


下一篇:SonarQube-7.9.1+SQL Server2017在Windows环境下的安装与配置