Exclude Front end code

I am using:

  • Community Edition* Version 8.1 (build 31237)

  • Team City as the CI tool

  • Plugins - see screen shot below…


I have been trying to exclude certain directories without success. I am trying to make sure SQ does not scan “.git” directory without any luck.

I have tried:

  • .git//” - single asterisks “.git/” double asterisks / single asterisks
  • “.git/**/*” - " .git/" double asterisks / single asterisks
  • D:\tc\ba\w\daf866afe99292aa\.git**

Can someone tell me the syntax I am missing.


The .git directory should be ignored by default. Do you see evidence in the SonarQube UI that its contents are being analyzed. Because I don’t believe that “…is unmodified” log message is coming from analysis.

Also, there are a few points to note about your exclusion configuration. The first is that I’m not sure whitespace is stripped from the elements of the list, so I’d omit the space after a comma. Second, exclusions of this type generally end in *.*. Your **.git exclusion isn’t doing what you think it is. And finally - and I can tell you were desperate here and trying everything - exclusions should start from project root, not box root.

As a note for the future, screenshots are difficult to read. I’ve expanded your analysis command line screenshot, closed it, and then needed to re-open it half a dozen times in composing this short answer. Copy/pasted text is far easier to read. Even better if it’s code-formatted (``` on the line before and on the line after)!


Yes I do see SQ scanning .git directory

  • when team city is running
  • When i set SQ trace to debug. I see the logs is scanning that directory


Do you see the contents of the .git directory reflected for instance in your project’s Code tab:


I do not see it in SQ as to your screen shot.
I see the performance issue when building the solution in CI.
CI build logs scan within the git directory

Just to run the the Scanner step it takes 40 mins. During my trouble shooting… manually executing the command, I was removing different directory from the project to see where the performance was. git directory was the issue. Without scanning this directory this step takes 3 mins.

Starting: “C:\Program Files\Java\jdk-13.0.1\bin\java.exe” -classpath D:\BuildAgent\tools\sonar-qube-scanner.\lib\sonar-scanner-cli- org.sonarsource.scanner.cli.Main “-Dproject.home=.” “-Dsonar.host.url=http://sonarqube.abc.com:9000/sonar/” “-Dsonar.projectKey=ABCFrontend” “-Dsonar.projectName=ABC Frontend” “-Dsonar.projectVersion=0.0.1920-dev” “-Dsonar.login=wed462febfc0f51…” -X -Dsonar.analysis.mode=publish "-Dsonar.coverage.exclusions=/git//, .scannerwork//*," "-Dsonar.exclusions=/git/**/, .scannerwork/**/," -Dsonar.log.level=DEBUG -Dsonar.scm.provider=git -Dsonar.sourceEncoding=UTF-8 -Dsonar.verbose=true -Dscanner.home=D:\BuildAgent\tools\sonar-qube-scanner.


This is interesting. Before we can go any further with it, though we’ll need the code-formatted (``` on the line before and on the line after) text of your analysis log. Screenshots don’t help me.