Files being indexed twice in SonarCloud scan

I’m learning how to integrate SonarCloud with Github Actions in a personal project. The Github repository that I am using can be accessed by clicking here.

The solution I am developing was created with version 8.0 of .NET. By default, all source code is present in the src directory. All test projects (unit, integration and functional) are present in the tests directory.

My Github Actions workflow that is integrating with SonarCloud is called Develop Workflow, and can be accessed by clicking here.

name: Develop Workflow

on:
    push:
        branches: ["develop"]

permissions:
    contents: write

jobs:
    build:
        name: Build
        runs-on: ubuntu-latest
        steps:
            - name: Checkout code
              uses: actions/checkout@v3

            - name: Setup .NET Core
              uses: actions/setup-dotnet@v3
              with:
                dotnet-version: '8.0.x'

            - name: Restore dependencies
              run: dotnet restore
              working-directory: src

            - name: Build solution
              run: dotnet build --configuration Release --no-restore
              working-directory: src

    unit_test:
        name: Unit Tests
        runs-on: ubuntu-latest
        needs: build
        steps:
            - name: Checkout code
              uses: actions/checkout@v3

            - name: Setup .NET Core
              uses: actions/setup-dotnet@v3
              with:
                dotnet-version: '8.0.x'

            - name: Restore dependencies
              run: dotnet restore
              working-directory: tests/Postech.PhaseOne.GroupEight.TechChallenge.UnitTests

            - name: Build test project
              run: dotnet build --no-restore
              working-directory: tests/Postech.PhaseOne.GroupEight.TechChallenge.UnitTests

            - name: Run tests
              run: dotnet test --verbosity normal
              working-directory: tests/Postech.PhaseOne.GroupEight.TechChallenge.UnitTests

    functional_test:
        name: Functional Tests
        runs-on: ubuntu-latest
        needs: build
        steps:
            - name: Checkout code
              uses: actions/checkout@v3

            - name: Setup .NET Core
              uses: actions/setup-dotnet@v3

            - name: Restore dependencies
              run: dotnet restore
              working-directory: tests/Postech.PhaseOne.GroupEight.TechChallenge.FunctionalTests

            - name: Build test project
              run: dotnet build --no-restore
              working-directory: tests/Postech.PhaseOne.GroupEight.TechChallenge.FunctionalTests

            - name: Run tests
              run: dotnet test --verbosity normal
              working-directory: tests/Postech.PhaseOne.GroupEight.TechChallenge.FunctionalTests

    sonarcloud:
      name: SonarCloud Scan
      runs-on: ubuntu-latest
      needs: build
      steps:
        - name: Checkout code
          uses: actions/checkout@v3
          with:
            fetch-depth: 0

        - name: Setup .NET
          uses: actions/setup-dotnet@v3
          with:
            dotnet-version: '8.0.x'
        
        - name: Install Java 17
          uses: actions/setup-java@v3
          with:
            java-version: '17'
            distribution: 'temurin'

        - name: Cache SonarCloud packages
          uses: actions/cache@v3
          with:
            path: ~sonarcache
            key: ${{ runner.os }}-sonar
            restore-keys: ${{ runner.os }}-sonar

        - name: Cache SonarCloud scanner
          id: cache-sonar-scanner
          uses: actions/cache@v3
          with:
            path: ..sonarscanner
            key: ${{ runner.os }}-sonar-scanner
            restore-keys: ${{ runner.os }}-sonar-scanner

        - name: Install SonarCloud scanner
          if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
          run: |
            mkdir -p ./.sonar/scanner
            dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner

        - name: Install dotnet coverage
          run: dotnet tool install --global dotnet-coverage

        - name: Solution Scan
          env:
            SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
            GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
          run: |
           ./.sonar/scanner/dotnet-sonarscanner begin /k:"lucasdirani_GithubActionsTest" /o:"tech-challenge-arquitetura-sistemas-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.sources="src/" /d:sonar.tests="tests/" /d:sonar.host.url="https://sonarcloud.io"
           dotnet build src/Postech.PhaseOne.GroupEight.TechChallenge.sln --no-incremental
           ~/.dotnet/tools/dotnet-coverage collect "dotnet test src/Postech.PhaseOne.GroupEight.TechChallenge.sln" -f xml -o "coverage.xml"
           ./.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

As my test and source code directories are separate, I followed the recommendations from the official SonarCloud documentation, and indicated their respective locations in the dotnet-sonarscanner begin command.

./.sonar/scanner/dotnet-sonarscanner begin /k:"lucasdirani_GithubActionsTest" /o:"tech-challenge-arquitetura-sistemas-net" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml /d:sonar.sources="src/" /d:sonar.tests="tests/" /d:sonar.host.url="https://sonarcloud.io"

However, during the execution of the pipeline (the last execution I performed can be found by clicking here), for some reason the scanner is pointing out the indexing error shared right after.

ERROR: File
src/Postech.PhaseOne.GroupEight.TechChallenge.Api/Setup/RepositorySetup.cs
can’t be indexed twice. Please check that inclusion/exclusion patterns
produce disjoint sets for main and test files

I’m confused by the error since the RepositorySetup file is only being referenced in a single project in my solution. I would like to ask for help to resolve the problem in question. I tried several alternatives, but the error persists regardless of what I do.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật