ERROR: File src/API/.dockerignore can't be indexed twice. Please check that inclusion/exclusion patt

Hello guys,

I’m trying to run some analysis on my local machine. So I installed the sonarscanner tool from dotnet tool install. I also set up the sonarqube server where I created a project and generated a token.

This is my project structure:

$ ls
Application.UnitTests/    azure-pipelines-pullrequest.yml  README.md             src/
azure-pipelines-deps.yml  Flowmono.ProcessService.sln      ReventEmailTemplate/
azure-pipelines-main.yml  helm/                            ReventInject/

The src directory contains:

$ ls src/
API/  Application/  Domain/  Infrastructure/

The API is the entrypoint to the project.

The test directory is inside the root directory. The Application.UnitTests.

Trying to run the sonarscanner using this command:

> dotnet sonarscanner begin /k:"flowmono-process" /d:sonar.host.url="http://localhost:9009"  /d:sonar.token="squ_3bb4f7891a87a1891cef0ce93ba7bef95c70727e"

Which I get this

Then I run dotnet build which was successful. Then I run the end command:

> dotnet sonarscanner end /d:sonar.token="squ_3bb4f7891a87a1891cef0ce93ba7bef95c70727e"

Which gave me this error:

INFO: Indexing files...
INFO: Project configuration:
INFO: Indexing files of module 'Application.UnitTests'
INFO:   Base dir: C:\Users\Toyin Muhammed\Desktop\Flowmono\Flowmono.ProcessService\Application.UnitTests
INFO:   Test paths: obj/Application.UnitTests.csproj.nuget.dgspec.json, obj/Process...
INFO: Indexing files of module 'ReventInject'
INFO:   Base dir: C:\Users\Toyin Muhammed\Desktop\Flowmono\Flowmono.ProcessService\ReventInject
INFO:   Source paths: App.config, packages.config, obj/project.assets.json, obj/Rev...
INFO: Indexing files of module 'Domain'
INFO:   Base dir: C:\Users\Toyin Muhammed\Desktop\Flowmono\Flowmono.ProcessService\src\Domain
INFO:   Source paths: obj/Domain.csproj.nuget.dgspec.json, obj/project.assets.json,...
INFO: Indexing files of module 'Infrastructure'
INFO:   Base dir: C:\Users\Toyin Muhammed\Desktop\Flowmono\Flowmono.ProcessService\src\Infrastructure
INFO:   Source paths: obj/Infrastructure.csproj.nuget.dgspec.json, obj/project.asse...
INFO: Indexing files of module 'Application'
INFO:   Base dir: C:\Users\Toyin Muhammed\Desktop\Flowmono\Flowmono.ProcessService\src\Application
INFO:   Source paths: obj/Application.csproj.nuget.dgspec.json, obj/project.assets....
INFO: Indexing files of module 'ReventEmailTemplate'
INFO:   Base dir: C:\Users\Toyin Muhammed\Desktop\Flowmono\Flowmono.ProcessService\ReventEmailTemplate
INFO:   Source paths: DependencyInjection.cs, Models/EmailTemplate.cs, Program.cs, ...
INFO: Indexing files of module 'API'
INFO:   Base dir: C:\Users\Toyin Muhammed\Desktop\Flowmono\Flowmono.ProcessService\src\API
INFO:   Source paths: appsettings.Development.json, appsettings.json, Dockerfile, D...
INFO: Indexing files of module 'flowmono-process'
INFO:   Base dir: C:\Users\Toyin Muhammed\Desktop\Flowmono\Flowmono.ProcessService
INFO:   Source paths: src
INFO:   Test paths: Application.UnitTests
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 17.129s
INFO: Final Memory: 10M/37M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: File src/API/.dockerignore can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
ERROR:
The SonarScanner did not complete successfully
00:30:23.902  Post-processing failed. Exit code: 1

I’ve tried specifying the sonar.sources and sonar.test but they are getting ignored due to the version that I’m on.

How do I resolve this

Hi,

Welcome to the community!

First, I hope you’ve already revoked that token. :sweat_smile:

Regarding the problem, can you check to see if you have any inclusions / exclusions set in the UI?

 
Ann