React Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

While building using azure devops pipeline of my react application with VITE I am getting error

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension):-* Developer Edition* v10.6 (92116)
  • how is SonarQube deployed: on premise :
  • what are you trying to achieve unit test coverage of react app with vite
  • what have you tried so far to achieve this
**Do not share screenshots of logs -- share the text itself (bonus points for being well-formatted)!**
2024-11-20T06:45:24.3661616Z ##[section]Starting: Analyze SonarQube Results
2024-11-20T06:45:24.3670603Z ==============================================================================
2024-11-20T06:45:24.3670956Z Task         : Run Code Analysis
2024-11-20T06:45:24.3671221Z Description  : Run scanner and upload the results to the SonarQube server.
2024-11-20T06:45:24.3671505Z Version      : 6.3.4
2024-11-20T06:45:24.3671724Z Author       : sonarsource
2024-11-20T06:45:24.3671941Z Help         : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarqube-extension-for-azure-devops/)
2024-11-20T06:45:24.3672615Z ==============================================================================
2024-11-20T06:45:25.9992867Z [command]/myagent/_work/_tasks/zzz/6.3.4/sonar-scanner/bin/sonar-scanner
2024-11-20T06:45:26.8118534Z 06:45:26.804 INFO  Scanner configuration file: /myagent/_work/_tasks/zzz/6.3.4/sonar-scanner/conf/sonar-scanner.properties
2024-11-20T06:45:26.8132164Z 06:45:26.812 INFO  Project root configuration file: NONE
2024-11-20T06:45:26.8352081Z 06:45:26.834 INFO  SonarScanner CLI 6.2.1.4610
2024-11-20T06:45:26.8374590Z 06:45:26.837 INFO  Java 17.0.13 Ubuntu (64-bit)
2024-11-20T06:45:26.8387182Z 06:45:26.838 INFO  Linux 5.15.0-125-generic amd64
2024-11-20T06:45:26.8891621Z 06:45:26.888 INFO  User cache: /home/zzz/.sonar/cache
2024-11-20T06:45:28.8458109Z 06:45:28.844 INFO  JRE provisioning: os[linux], arch[x86_64]
2024-11-20T06:45:29.5815468Z 06:45:29.580 INFO  Communicating with SonarQube Server 10.6.0.92116
2024-11-20T06:45:30.3477639Z 06:45:30.347 INFO  Starting SonarScanner Engine...
2024-11-20T06:45:30.3514278Z 06:45:30.350 INFO  Java 17.0.11 Eclipse Adoptium (64-bit)
2024-11-20T06:45:31.8799293Z 06:45:31.879 INFO  Load global settings
2024-11-20T06:45:32.6210801Z 06:45:32.620 INFO  Load global settings (done) | time=739ms
2024-11-20T06:45:32.6290828Z 06:45:32.628 INFO  Server id: zzzx
2024-11-20T06:45:32.6547252Z 06:45:32.651 INFO  Loading required plugins
2024-11-20T06:45:32.6558687Z 06:45:32.655 INFO  Load plugins index
2024-11-20T06:45:33.0010350Z 06:45:32.999 INFO  Load plugins index (done) | time=345ms
2024-11-20T06:45:33.0017797Z 06:45:33.000 INFO  Load/download plugins
2024-11-20T06:45:33.1408544Z 06:45:33.139 INFO  Load/download plugins (done) | time=139ms
2024-11-20T06:45:33.2553827Z 06:45:33.252 INFO  Loaded core extensions: developer-scanner
2024-11-20T06:45:33.8299206Z 06:45:33.829 INFO  Process project properties
2024-11-20T06:45:33.8474356Z 06:45:33.846 INFO  Process project properties (done) | time=17ms
2024-11-20T06:45:33.8603490Z 06:45:33.859 INFO  Project key: 1234
2024-11-20T06:45:33.8615854Z 06:45:33.861 INFO  Base dir: /myagent/_work/7/s
2024-11-20T06:45:33.8630086Z 06:45:33.862 INFO  Working dir: /myagent/_work/7/s/.scannerwork
2024-11-20T06:45:33.8813328Z 06:45:33.880 INFO  Load project settings for component key: '1234'
2024-11-20T06:45:34.2059111Z 06:45:34.204 INFO  Load project settings for component key: '1234' (done) | time=324ms
2024-11-20T06:45:34.2602747Z 06:45:34.259 INFO  Load project branches
2024-11-20T06:45:34.5882398Z 06:45:34.587 INFO  Load project branches (done) | time=327ms
2024-11-20T06:45:34.5902971Z 06:45:34.589 INFO  Load branch configuration
2024-11-20T06:45:34.5919725Z 06:45:34.591 INFO  Found manual configuration of branch/PR analysis. Skipping automatic configuration.
2024-11-20T06:45:34.5991982Z 06:45:34.598 INFO  Load branch configuration (done) | time=9ms
2024-11-20T06:45:34.6453564Z 06:45:34.644 INFO  Load quality profiles
2024-11-20T06:45:35.0246800Z 06:45:35.023 INFO  Load quality profiles (done) | time=378ms
2024-11-20T06:45:35.0418940Z 06:45:35.041 INFO  Auto-configuring with CI 'Azure DevOps'
2024-11-20T06:45:35.0907353Z 06:45:35.089 INFO  Load active rules
2024-11-20T06:45:50.3251625Z 06:45:50.324 INFO  Load active rules (done) | time=15234ms
2024-11-20T06:45:50.3399553Z 06:45:50.338 INFO  Load analysis cache
2024-11-20T06:45:50.6520112Z 06:45:50.650 INFO  Load analysis cache (404) | time=311ms
2024-11-20T06:45:51.0306544Z 06:45:51.029 INFO  Branch name: feature/950-husky-setup
2024-11-20T06:45:51.0788704Z 06:45:51.078 INFO  Preprocessing files...
2024-11-20T06:45:51.5574693Z 06:45:51.555 INFO  2 languages detected in 65 preprocessed files
2024-11-20T06:45:51.5576374Z 06:45:51.556 INFO  13 files ignored because of inclusion/exclusion patterns
2024-11-20T06:45:51.5577501Z 06:45:51.556 INFO  0 files ignored because of scm ignore settings
2024-11-20T06:45:51.5664643Z 06:45:51.565 INFO  Loading plugins for detected languages
2024-11-20T06:45:51.5693143Z 06:45:51.567 INFO  Load/download plugins
2024-11-20T06:45:51.6856763Z 06:45:51.683 INFO  Load/download plugins (done) | time=115ms
2024-11-20T06:45:52.0224446Z 06:45:52.021 INFO  Load project repositories
2024-11-20T06:45:52.3415296Z 06:45:52.338 INFO  Load project repositories (done) | time=317ms
2024-11-20T06:45:52.3946316Z 06:45:52.393 INFO  Indexing files...
2024-11-20T06:45:52.4055160Z 06:45:52.400 INFO  Project configuration:
2024-11-20T06:45:52.4056126Z 06:45:52.401 INFO    Excluded sources: **/node_modules/**, **/coverage/**, **/dist/**, **/src/**/*.test.tsx
2024-11-20T06:45:52.4057013Z 06:45:52.401 INFO    Excluded tests: **/node_modules/**, **/coverage/**, **/dist/**, **/src/**/*.ts, **/src/**/*.page.tsx
2024-11-20T06:45:52.6506698Z ##[error]06:45:52.641 ERROR File src/pages/Homepage/page.module.css can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
2024-11-20T06:45:52.6510331Z 06:45:52.641 ERROR File src/pages/Homepage/page.module.css can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
2024-11-20T06:45:52.9941616Z 06:45:52.989 INFO  EXECUTION FAILURE
2024-11-20T06:45:52.9942409Z 06:45:52.992 INFO  Total time: 26.260s
2024-11-20T06:45:53.0169410Z ##[warning]Can't find loc string for key: LIB_ProcessExitCode
2024-11-20T06:45:53.0197585Z ##[warning]Error while executing SonarQube:Analyze task: LIB_ProcessExitCode /myagent/_work/_tasks/zzz/6.3.4/sonar-scanner/bin/sonar-scanner 3
2024-11-20T06:45:53.0203452Z ##[error]LIB_ProcessExitCode /myagent/_work/_tasks/zzz/6.3.4/sonar-scanner/bin/sonar-scanner 3
2024-11-20T06:45:53.0285679Z ##[section]Finishing: Analyze SonarQube Results

What configuration (analysis parameters either in your pipeline or sonar-project.properties file) are you providing?

My team had added sonar.sources = src folder. So I commented that line as below.
THe thought process was, this folder should be scanned by sonar by default one shouldn’t have to explicitly set these. When I did that the issue dis appeared.

cliProjectVersion: '$(Build.BuildId)'

extraProperties: |

 # sonar.sources=src

# sonar.tests=**/src/**/*.test.tsx

sonar.javascript.lcov.reportPaths=coverage/lcov.info

sonar.exclusions=**/node_modules/**,**/coverage/**,**/dist/**,**/src/**/*.test.tsx,**/src/**/*.css

sonar.test.exclusions=**/node_modules/**,**/coverage/**,**/dist/**,**/src/**/*.ts,**/src/**/*.tsx,**/src/**/*.css

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.