How to exclude/ignore referenced project(s) analysis from SonarQube

回眸只為那壹抹淺笑 提交于 2019-12-08 09:35:24

问题


I have a solution which has three projects (X,Y,Z). Z referenced in Y , Y in X . When I start Analysis with MSBuild SonarQube Runner on project X, it is analyzing Y and Z as well. Do we have any solution for ignoring recursive analysis ?

Note: I can not breakup solution file into multiple solution files & refer dll's rather than projects.


回答1:


you can add the tag into ProjectReference 'Y' of your project 'X' configuration.

<PropertyGroup Condition=" $(ProjectGuid) != '' AND $(SonarQubeExclude) == '' ">
    <SonarQubeExclude Condition="$(ProjectGuid) == 'C999E666-3666-9990-B666-9999E666' " >true</SonarQubeExclude>
</PropertyGroup>

This must be added on X project and the id C999E666-3666... is the id that you want excluded.

More information on: https://github.com/SonarSource/sonar-.net-documentation/blob/master/doc/appendix-2.md




回答2:


You can statically mark individual projects as being included/excluded by setting a property in the MSBuild file. See the online docs here.

If you want to do something more dynamic have a look at the advanced config appendix.




回答3:


in sonar -> administration -> General Settings -> Analysis Scope set "Source File exclusions" like that: file:**/ProjectName/* * (without spaces between * *)



来源:https://stackoverflow.com/questions/32563682/how-to-exclude-ignore-referenced-projects-analysis-from-sonarqube

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