I checked the logs for this specific analysis, and I got the following error:
ERROR: File src/Tests/Dodo.Cdp.Contract.Tests/MissionsControllerTests.cs can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
I tried the different variations of inclusions/exclusions but with no luck. For example, the following SonarCloud config file ‘.sonarcloud.properties’ resulted in the error with the analysis id “AYsaID5tifp0njjVd9u2”:
For the quotes analysis ID, the error is still the same:
ERROR: File src/Tests/Dodo.Cdp.Unit.Tests/ImportMailingsFromMindboxJob/TryGetStartEndTimeTests.cs can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
I need to check with my team regarding the current values you have in the .sonarcoud.properties file and I’ll get back to you.
Meanwhile, did the project was ever analyzed successfully before? Also, can you try without the properties file?
Yes, this project can be successfully analyzed without the ‘.sonarcloud.properties’ file but there is no coverage and unit-tests statistics information in the report. All previous pull requests have the SonarCloud analysis succeeded.
Our current task is to setup the unit tests analysis and then tests coverage. So, I am creating pull requests with the different ‘.sonarcloud.properties’ file and want to find their analysis report in SonarCloud but the report is not generated because of the mentioned errors.
I tried the 3 variants of the ‘.sonarcloud.properties’ file with different asterisk placement but none of them was working:
# Path to sources
sonar.sources=src
sonar.exclusions=src/Tests/**
# Path to tests
sonar.tests=src
sonar.test.inclusions=src/Tests/**
Then another one:
# Path to sources
sonar.sources=src
sonar.exclusions=src/Tests/**/*
# Path to tests
sonar.tests=src
sonar.test.inclusions=src/Tests/**/*
The Analysis ID “AYsl6G_5nndIN11d_81x”
And the last one:
# Path to sources
sonar.sources=src
sonar.exclusions=src/**/Tests/**/*
# Path to tests
sonar.tests=src
sonar.test.inclusions=src/**/Tests/**/*
The Analysis ID “AYsl9WkeuWFg2q-76Zky”
After that I re-read the documentation about the ‘Automatic Analysis’: Automatic Analysis | SonarCloud Docs and noticed a paragraph about not supported Code coverage information.
The Code coverage is our final goal, so we will switch to the CI-based analysis.
I would be really interested to understand what patterns finally work in your CI-based analysis. I believe the patterns I gave you should have worked and I’m wondering if there’s something going on in automatic analysis.