How to exclude files with spaces in the path in Sonar?

I am trying to exclude some auto generated code (Service References) from Sonars static code and unit test coverage analysis. The project is C# .Net and Sonar is running via Jenkins on a Windows server.

Within my file I am able to exclude various other files and directories by using the sonar.exclusions property, but this is not working for files that have a space in the path.

  • What is the right way to add .NET project with NuGet dependencies to a git repo?
  • CruiseControl.Net with git build fails when running as a service
  • Where should you store 3rd party assemblies?
  • What are the key differences between Git Extensions and Git Source Control Provider?
  • Source Control Migration from Accurev to Git (.net)
  • It's possible that Team Foundation Server Version Control support external repo like git
  • sonar.exclusions=**/Global.asax.cs, **/MyProject/Service References/*

    Given the above example the Global.asax.cs files are excluded in all projects within the solution, but the Service References are not.

    I have tried enclosing the path in single and double quotes.
    I have tried using a backslash to escape the space.
    I have tried putting the path as **/MyProject/Service*/* to take advantage of the wildcard (could be risky) but that didn’t work either.

    Does anyone have a solution for this?

  • svn monitor for linux
  • Sharing code between two different git projects
  • jenkins unable to run “ /build-tools/17.0.0/aapt ”
  • C# How to read commit time with libgit2Sharp
  • Why is indentation in empty lines bad?
  • Whats the simplest way to return all commits on git to master branch that have not been merged already?
  • One Solution collect form web for “How to exclude files with spaces in the path in Sonar?”

    I just ran into the same problem. I needed to exclude javascript files in a Project, “My Project”, in a folder Scripts. I tried this first:


    And that worked fine, but I realized it would exclude a “Scripts” folder in other projects too. So I changed it to this:

    **/My Project/Scripts/**/*.js

    And it stopped working. My first instinct was that the space in the project name was to blame. So i tried the same things you did:

    "**/My Project/Scripts/**/*.js"
    '**/My Project/Scripts/**/*.js'
    **/My\ Project/Scripts/**/*.js

    but none of it worked.

    Then I stumbled upon this forum:

    Particularly this line provided the answer: Modules (.Net projects) are not part of the fully qualified name. You must define exclusions at module (.Net project) level.

    It means that my mistake wasn’t having a space in the project name, but including the project name at all! I changed the filter to this:


    and voila, the files were correctly excluded. No quotes or escaping necessary.

    Of course, this still leaves the problem that a “Scripts” folder in another project wil also be excluded. The information provided here: may prove useful for that.

    I use the web interface, and not the configuration file directly, but this would also suggest that if you have multiple filters, that the comma-separated list should not contain spaces (other than the ones actually in the path) because they are interpreted quite literally.

    Git Baby is a git and github fan, let's start git clone.