Last analysis failed Analysis ID "AYsTYnmNNXFJNM1ID3pa"

Hi,

I have added the ‘.sonarcloud.properties’ to the repository and scanned the pull request. The only following lines have values:

sonar.sources=src/Application/,src/Infrastructure/
sonar.tests=src/Tests/
sonar.sourceEncoding=UTF-8

All other ones from the example of the “supported optional settings” are left commented.

Please, explain what might be wrong with the ‘.sonarcloud.properties’ file.

Thanks,
Dmitry

Hi @dgusev-dodo

Welcome to Sonar Community!

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

It seems that you have some configuration issues.
Please check the Automatic Analysis documentation for more information.

Regards,
Ismail

2 Likes

Hi Ismail,

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”:

sonar.sources=.
sonar.inclusions=**/src/Application/**/*,**/src/Infrastructure/**/*,**/src/Jobs/**/*
sonar.tests=.
sonar.test.inclusions=**/src/Tests/**/*

The Analysis Method is set to the recommended ‘Automatic’.

Could you, please, tell what is in the logs for the mentioned analysis id?

Thanks,
Dmitry

Hi Dimitry,

What’s the actual structure of your project? Do you actually have multiple directories named src?

 
Ann

Hi,

No, we have only one ‘src’ folder. The actual structure is the following:

<solution root folder> (file '.sonarcloud.properties' is here)
    |
    –– src
        |
        –– Application
        |      |
        |      –– ...
        |
        –– Infrastructure
        |      |
        |      –– ...
        |
        –– Jobs
        |      |
        |      –– ...
        |
        –– Tests
               |
               –– ...

My last attempt was with the following contents of the ‘.sonarcloud.properties’ file:

sonar.sources=src/
sonar.inclusions=**/Application/**/*,**/Infrastructure/**/*,**/Jobs/**/*
sonar.tests=src/
sonar.test.inclusions=**/Tests/**/*

The analysis failed and the ID is “AYsd2UjHw_JyBggBRx3j”.

Hi,

Thanks for the detail. This is helpful and means your config can be simplified. First, sonar.sources takes a comma-delimited list of directories, so:

sonar.sources=src/Application,src/Infrastructure,src/Jobs

That automatically omits the src/Tests directory from your source file specification, leaving you to set tests like so:

sonar.tests=src/Tests

And those two properties, together, should be all you need.

 
HTH,
Ann

OK, I have tried the following ‘.sonarcloud.properties’ file contents:

# Path to sources
sonar.sources=src/Application,src/Infrastructure,src/Jobs
# Path to tests
sonar.tests=src/Tests

The analysis starts, works for some time and then fails.
The Analysis ID “AYsevK39315j01d39xET”.
Do you see something unusual in the logs?

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?

Regards,
Ismail

2 Likes

Hi Ismail,

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.

Thanks,
Dmitry

1 Like

Hi @dgusev-dodo,

After checking with my team, I have this suggestion:

sonar.sources=src
sonar.tests=src
sonar.test.inclusions=src/**/Tests/**
sonar.exclusions=src/**/Tests/**

The idea is to “include” the tests under test but “exclude” them from “sources”.
And no need to add separate “inclusions” after this.

Let me know if this works for you.

Regards,
Ismail

Hi Ismail,

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.

Thank you for the support!
Dmitry

1 Like

Hi Dmitry,

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.

 
Thx,
Ann