19

I have just upgraded to SonarQube 6.4 and at the same time moved to mysql. Whenever I try to parse a particular solution I get the message:

can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

I am running the scanner through VSTS using the new SonarQube tasks. I have also tried to pass the -X flag to SQ but it is not getting through the VSTS task. I have also upped the mysql max packet to 512M and restarted both mysql and Sonar servers. I'm at a loss

JBelbute
  • 231
  • 1
  • 3
  • 7
  • 2
    Have you checked the project's inclusion/exclusion patterns? – G. Ann - SonarSource Team Aug 11 '17 at 15:56
  • What're tasks with settings of the build definition? Can you share the detail log here? – starian chen-MSFT Aug 14 '17 at 06:42
  • @ G. Ann I have excluded file types that do not need to be scanned. What is curious is that when I run the same scan on 6.1 using MSSQL it works. I – JBelbute Aug 15 '17 at 09:28
  • The settings of the "Prepare the Sonar Qube analysis" are standard I do have the additional setting of /d:/sonar.verbose=true.The log files are huge 2017-08-14T23:44:57.2369425Z ##[error]00:44:57.205 ERROR: Error during SonarQube Scanner execution 2017-08-14T23:44:57.2369425Z ##[error]00:44:57.205 ERROR: File [moduleKey=DevDeploySIMS8, relative=Packages/Microsoft.Net.Compilers.1.0.0/tools/csc.exe, basedir=F:\build\_work\6\s] can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files 2017-08-14T23:44:57.2369425Z ##[error]00:44:57.205 – JBelbute Aug 15 '17 at 09:33
  • Can you share the detail log on the OneDrive? – starian chen-MSFT Aug 18 '17 at 01:48

5 Answers5

16

Have a look at the post here: https://github.com/SonarSource/sonar-csharp/issues/958

and follow the advice in the bottom:

The problem it's caused by /d:sonar.source="Project" or /d:sonar.tests="Project.Tests", just remove and works.

It works for me.

civic.LiLister
  • 2,087
  • 16
  • 13
15

In my case, along with the exclusions, I had written

sonar.sources=.

Once I removed this, it started working.

Ganesh Satpute
  • 3,664
  • 6
  • 41
  • 78
7

"sonar.tests.inclusions=src/**/*.spec.ts" and "sonar.tests=src" are in conflict, take just only one

Leo Lanese
  • 476
  • 4
  • 5
2

If you have mentioned exclusion property in the test command and also in the sonar-project.properties file. Remove it from either of those.

Check all properties, remove any duplicates.

Sumit Badsara
  • 769
  • 9
  • 23
2

Access the Sonar, Enter your project screen in the master branch followed: Click Administration> Analysis Scope> In *Code coverage options *Duplications *Source File Exclusions insert the folder that may be being counted twice when reading the code, in my case it was the src folder so I put it in one of the ** /src/ **(no spaces) fields and the problem was solved