C# project set sonar.exclusions,but it doesn't work


(limingyang) #1

sonarqube version is 7.3.0
sonar-scanner-msbuild-3.0.2.656
SonarQube.Analysis.xml content add
“sonar.exclusions”=**/Tests/.cs
But the dir “Fleck.Tests” Still being counted

the log is==============
D:\CodeCheckcsharp2\Fleck-master\src>MSBuild.SonarQube.Runner.exe end
SonarQube Scanner for MSBuild 3.0.2
Default properties file was found at C:\Program Files\Scanner\sonar-scanner-msbu
ild-3.0.2.656\SonarQube.Analysis.xml
Loading analysis properties from C:\Program Files\Scanner\sonar-scanner-msbuild-
3.0.2.656\SonarQube.Analysis.xml
Post-processing started.
SONAR_SCANNER_OPTS is not configured. Setting it to the default value of -Xmx102
4m
Calling the SonarQube Scanner…
INFO: Scanner configuration file: C:\Program Files\Scanner\sonar-scanner-msbuild
-3.0.2.656\sonar-scanner-3.0.3.778\bin…\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\CodeCheckcsharp2\Fleck-master\src.son
arqube\out\sonar-project.properties
INFO: SonarQube Scanner 3.0.3.778
INFO: Java 1.8.0_152 Oracle Corporation (64-bit)
INFO: Windows 7 6.1 amd64
INFO: SONAR_SCANNER_OPTS=-Xmx1024m
INFO: User cache: C:\Users\l00294958.sonar\cache
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=549ms
INFO: Server id: 229C2CE5-AWbJNpeipDnIwCAQ_r8b
INFO: User cache: C:\Users\l00294958.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=497ms
INFO: Load/download plugins (done) | time=539ms
INFO: Loaded core extensions:
INFO: SonarQube server 7.3.0
INFO: Default locale: “zh_CN”, source code encoding: “GBK” (analysis is platform
dependent)
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=512ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=472ms
INFO: Load active rules
INFO: Load active rules (done) | time=7552ms
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=434ms
INFO: Project key: csharp2-1
INFO: Project base dir: D:\CodeCheckcsharp2\Fleck-master\src
INFO: ------------- Scan ConsoleApp
INFO: Base dir: D:\CodeCheckcsharp2\Fleck-master\src\Samples\ConsoleApp
INFO: Working dir: D:\CodeCheckcsharp2\Fleck-master\src.sonarqube\out.sonar\mo
d0
INFO: Source paths: Server.cs, Properties/AssemblyInfo.cs, client.html
INFO: Source encoding: UTF-8, default locale: zh_CN
INFO: Load server rules
INFO: Load server rules (done) | time=1034ms
INFO: Index files
INFO: Excluded sources:
INFO: **/Tests/.cs
INFO: 3 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: Quality profile for cs: Sonar way
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=3ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: ------------- Scan Fleck
INFO: Base dir: D:\CodeCheckcsharp2\Fleck-master\src\Fleck
INFO: Working dir: D:\CodeCheckcsharp2\Fleck-master\src.sonarqube\out.sonar\mo
d2
INFO: Source paths: ConnectionNotAvailableException.cs, Handlers/ComposableHandl
er.cs, Handlers/Draft76Handler.cs, Handlers/FlashSocketPolicyRequestHandler.cs,
Handlers/Hybi13Handler.cs, Interfaces/ISocket.cs, Interfaces/IWebSocketConnectio
n.cs, FleckLog.cs, Interfaces/IWebSocketServer.cs, Interfaces/IWebSocketConnecti
onInfo.cs, SocketWrapper.cs, WebSocketConnectionInfo.cs, WebSocketServer.cs, Web
SocketHttpRequest.cs, RequestParser.cs, HandlerFactory.cs, WebSocketConnection.c
s, WebSocketException.cs, IntExtensions.cs, HandshakeException.cs, FrameType.cs,
ReadState.cs, Interfaces/IHandler.cs, WebSocketStatusCodes.cs, SubProtocolNegot
iator.cs, SubProtocolNegotiationFailureException.cs, QueuedStream.cs, Helpers/Mo
noHelper.cs
INFO: Source encoding: UTF-8, default locale: zh_CN
INFO: Index files
INFO: Excluded sources:
INFO: **/Tests/.cs
INFO: 28 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: Quality profile for cs: Sonar way
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: ------------- Scan Fleck.Tests
INFO: Base dir: D:\CodeCheckcsharp2\Fleck-master\src\Fleck.Tests
INFO: Working dir: D:\CodeCheckcsharp2\Fleck-master\src.sonarqube\out.sonar\mo
d1
INFO: Source paths: AssemblyTests.cs, FlashSocketPolicyRequestHandlerTests.cs, Q
ueuedStreamTests.cs, WebSocketConnectionInfoTests.cs, WebSocketConnectionTests.c
s, WebSocketServerTests.cs, RequestParserTests.cs, Hybi14DataFrameTests.cs, Defa
ultHandlerFactoryTests.cs, Draft76HandlerTests.cs, Hybi13HandlerTests.cs, Hybi14
DataFrame.cs, SocketWrapperTests.cs, SubProtocolNegotiatorTests.cs, packages.con
fig
INFO: Source encoding: UTF-8, default locale: zh_CN
INFO: Index files
INFO: Excluded sources:
INFO: **/Tests/.cs
INFO: 15 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: Quality profile for cs: Sonar way
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=1ms
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: ------------- Scan csharp2-2
INFO: Base dir: D:\CodeCheckcsharp2\Fleck-master\src
INFO: Working dir: D:\CodeCheckcsharp2\Fleck-master\src.sonarqube\out.sonar
WARNING: WARN: Metric ‘comment_lines_data’ is deprecated. Provided value is igno
red.
INFO: Source encoding: GBK, default locale: zh_CN
INFO: Index files
INFO: Excluded sources:
INFO: **/Tests/.cs
INFO: 0 files indexed
INFO: 0 files ignored because of inclusion/exclusion patterns
INFO: Sensor SonarJavaXmlFileSensor [java]
INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
INFO: Sensor C# [csharp]
INFO: Importing results from 6 proto files in ‘D:\CodeCheckcsharp2\Fleck-master
src.sonarqube\out\ConsoleApp_3462\output-cs’
INFO: Importing results from 6 proto files in ‘D:\CodeCheckcsharp2\Fleck-master
src.sonarqube\out\Fleck_1306\output-cs’
INFO: Importing results from 6 proto files in ‘D:\CodeCheckcsharp2\Fleck-master
src.sonarqube\out\Fleck.Tests_7309\output-cs’
INFO: Importing 3 Roslyn reports
INFO: Sensor C# [csharp] (done) | time=743ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=120ms
INFO: 4 files had no CPD blocks
INFO: Calculating CPD for 40 files
INFO: CPD calculation finished
INFO: Analysis report generated in 1008ms, dir size=354 KB
INFO: Analysis reports compressed in 226ms, zip size=160 KB
INFO: Analysis report uploaded in 499ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard?id=csh
arp2-1
INFO: Note that you will be able to access the updated dashboard once the server
has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=A
WcxAyXsepivkY-a2gSS
INFO: Task total time: 16.798 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 19.629s
INFO: Final Memory: 50M/376M
INFO: ------------------------------------------------------------------------
The SonarQube Scanner has finished
20:05:49.679 Creating a summary markdown file…
20:05:49.682 Analysis results: http://localhost:9000/dashboard/index/csharp2-1
20:05:49.683 Post-processing succeeded.

D:\CodeCheckcsharp2\Fleck-master\src>


(G Ann Campbell) #2

Hi,

Am I reading the log right that your exclusion specification is **/Tests/.cs? That would only exclude files with no file name, only an extension. Try this instead: **/Tests/*.cs. That should exclude all cs files located in any directory named Tests.

 
HTH,
Ann