Search code examples
svnversion-controlsonarqubeblamesonarqube-5.0

Exclude a file from SonarQube SCM blame?


Is it possible to exclude a file from Sonar's SCM blame data gathering?

I have a file at this path: ./projects/ichrg/ichrg.Web/bottombar.cs

svn blame from a command line works fine on the file, but when I run it with sonar I get the following error:

java.lang.IllegalStateException:

The svn blame command:

svn blame --xml --non-interactive -x -w --username ******** --password ******** --trust-server-cert BottomBar.cs

failed:

svn: warning: W155010: The node 'D:\JenkinsBuilds\svntrunk\projects\ichrg\ichrg.Web\BottomBar.cs' was not found.

svn: E200009: Could not perform blame on all targets because some targets don't exist

Which sounds like it's probably an svn problem.

For now, I just want to exclude the file in question from SCM analysis, I added the following pattern to the "Source File Exclusions" property in the web portal, under "File Exclusions":

**/bottombar*

But it continues to try to get blame data for the file.

Is there someway else I can prevent sonar from trying to get blame data for my file?


Solution

  • File exclusions is case sensitive, so you should do the following to exclude your file:

    sonar.exclusions=**/BottomBar.cs
    

    Concerning your initial problem which is related to SCM information, SonarQube will be less strict about such failures in the upcoming 5.1 version. Please see "SONAR-6172 - Do not fail when a file has no blame information".