我没有在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,sonarqube,junit 来源: https://codeday.me/bug/20190831/1772598.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。