jenkins - Sonar.exclusions not working with Sonar scanner for MSBuild -
i have msbuild project analyzed using sonar scanner msbuild. have passed following sonar.exclusion properties part of pipeline script exclude folder analysis. exclusion combinations fail exclude files.
/d:sonar.exclusions=\"ixmilia.dxf/**,ixmilia.dxf/*,**/ixmilia.dxf,**/ixmilia.dxf/**,**/ixmilia.dxf/**/*,**/ixmilia.dxf/*.cs,ixmilia.dxf/*.cs\"
i tried passing same sonar ui under analysis scope, did not either.
the sonar output looks this:
info: ------------- scan ixmilia.dxf info: initializer genericcoveragesensor info: initializer genericcoveragesensor (done) | time=0ms info: base dir: c:\program files (x86)\jenkins\jobs\mcdc_dev\workspace\ixmilia.dxf info: source encoding: utf-8, default locale: en_in info: index files info: excluded sources: info: ixmilia.dxf/** info: ixmilia.dxf/* info: **/ixmilia.dxf info: **/ixmilia.dxf/** info: **/ixmilia.dxf/**/* info: **/ixmilia.dxf/*.cs info: ixmilia.dxf/*.cs info: analyzer working directory contains 5 .pb file(s) info: 200 files indexed info: 0 files ignored because of inclusion/exclusion patterns
as can see output logs, want exclude folder present @ root of workspace c:\program files (x86)\jenkins\jobs\mcdc_dev\workspace\ixmilia.dxf
the ixmilia.dxf folder contains .cs files referred while building cs project.
any on appreciated.
i have found solution this. sonar.exclusions parameter not directly work sonar scanner msbuild unlike general sonar scanner. msbuild projects, need add exclusion in .csproj want exclude. adding below code .csproj file result in exclusion of files according configured pattern.
<target name="beforebuild"> <itemgroup> <sonarqubesetting include="sonar.exclusions"> <value>/**</value> </sonarqubesetting> </itemgroup> </target> </project>
in above-mentioned code, files under project folder excluded since /**
passed value. can refer thread more details: http://www.it1me.com/it-answers?id=35656157&ttl=sonarqube+with+c%23+plugin+with+msbuild+runner+does+not+take+exclusions
Comments
Post a Comment