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.

  • Does anyone know of a good C# API for Subversion?
  • .NET projects build automation with NAnt/MSBuild + SVN
  • NuGet issues with packages.config, project references and the solutionwide packages folder
  • Prevent connection string from being committed to repository
  • Source Control Migration from Accurev to Git (.net)
  • Git .Net files to ignore
  • 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?

  • Clone a git repo (in depth)
  • Preventing TFS from adding Temporary files
  • Should generated documentation go into source control?
  • How can I get the latest commit ID of the currently checked out branch in git, using ANT, without having an active git installation?
  • How to diff/merge changes to a deployment project file
  • Making Jenkins build fail when Selenium tests fail
  • 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.