GCDewski
(Gracie)
June 28, 2021, 4:44pm
#1
Hi all,
Version: 8.9 LTS
I have the following exclusion in sonar.global.exclusions:
*Test*/**/*
My expectation is that it would start excluding code smells from the following area below, but it does not?
Does anyone have any suggestions or should I post in the “bug” area?
Thanks,
Gracie.
Joe
(Joe)
June 28, 2021, 6:24pm
#2
Hi @GCDewski ,
You should use **/*Tests.cs
instead. You can test the glob pattern with https://globster.xyz/ or Digital Ocean’s Glob Tool .
GCDewski
(Gracie)
June 28, 2021, 6:53pm
#3
Thanks for the reply Joe,
Both of those glob testers say that my pattern should work for that path. I want all files, .cs or otherwise, under the folder “Website.blank.Tests” excluded.
Joe
(Joe)
June 28, 2021, 7:06pm
#4
OK, try this one: Website.blank.Tests/**/*Tests.cs
example: Glob Tool | DigitalOcean
GCDewski
(Gracie)
June 28, 2021, 7:32pm
#5
That did not work either. Here’s a snippit from the “Run Code Analysis” Sonarqube build step log.
2021-06-28T19:25:01.8965255Z INFO: Indexing files of module 'Website.Blank.Tests'
2021-06-28T19:25:01.8966300Z INFO: Base dir: C:\agent\_work\6\s\Website.Blank.Tests
2021-06-28T19:25:01.8967028Z INFO: Test paths: Clients/Auth0ClientTests.cs, Clients/RosterClientTests.cs, ...
2021-06-28T19:25:01.8968792Z INFO: Excluded sources: **/*jquery*, **/*modernizr*, **/AssemblyInfo.cs, **/*Tool*/**/*, *Tool*/**/*, **/bower_components/**/*, **/node_modules/**/*, **/typings/*.d.ts, **/InvalidXml.xml, **/karma.conf.js, **/*Test*/**/*, **/*Test*, *Test*/**/*, **/*Specs*/**/*, *Specs*/**/*, **/*Specs*, *test*/**/*, Website.Blank.Tests/**/*Tests.cs, **/Connected Services/**/*, **/testresults/**/*, **/SigWebTablet*, **/js/library/**, **/Migrations/**/*, **/js/bootstrap-datetimepicker.js
2021-06-28T19:25:01.8970653Z INFO: Excluded sources for coverage: **/Startup.cs, **/Program.cs, **/MainForm.cs, **/Services/Started/StartedClients.cs
2021-06-28T19:25:01.8971523Z INFO: Excluded sources for duplication: **/*Dialog.js, **/*Dialog.html
It acts like it is doing it, but it doesn’t seem to actually exclude the files on the UI side?
Joe
(Joe)
June 28, 2021, 8:59pm
#6
Hi @GCDewski ,
I think that code smell shown in the first picture is regarding a rule that runs against test files, so you need to exclude the file via sonar.test.exclusions=Website.blank.Tests/**/*Tests.cs
.
system
(system)
Closed
July 5, 2021, 9:20pm
#8
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.