Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated source and tests: inclusion/exclusion patterns produce disjoint sets for main and test files #70

Open
skokaina opened this issue Feb 12, 2024 · 1 comment

Comments

@skokaina
Copy link

Hi,

Currently running the scanner on version 0.3.5, however the scanner currently includes twice paths in the project configuration.

Here's the project configuration:

"options": {
        "name": "shared-libs",
        "hostUrl": "http://localhost:9000",
        "projectKey": "shared-backend",
        "skipTargetDefaults": false,
        "branches": false,
        "qualityGate": true,
        "qualityGateTimeout": "300",
        "skipImplicitDeps": true,
        "extra": {
          "sonar.javascript.lcov.reportPaths": "libs/shared/coverage/lcov.info",
          "sonar.testExecutionReportPaths": "libs/shared/reports/test-sonar-report.xml",
          "sonar.dependencyCheck.htmlReportPath": "dependency-check-report.html",
          "sonar.externalIssuesReportPaths": "image-scan-sonar-report.json",
          "sonar.test.inclusions": "libs/shared/src/**/*.spec.ts"
        }
      }

Command run on one the mono-repo sub-projects: npx nx run shared:sonar

Here's the error:

INFO: Load quality profiles
INFO: Load quality profiles (done) | time=30ms
INFO: Load active rules
INFO: Load active rules (done) | time=408ms
INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: **/*.spec.ts
INFO:   Included tests: **/*.spec.ts
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1.789s
INFO: Final Memory: 12M/68M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
ERROR: File libs/shared/src/dto/index.ts can't be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files

Would you see any missing configuration or adjustments are missing here ? Tried setting the testInclusions however it also get doubled in the project excluded sources, ie. set testInclusions to libs/shared/src/**/*.spec.ts, it gets duplicated in excluded sources as shown below:

"sonar": {
      "executor": "@koliveira15/nx-sonarqube:scan",
      "options": {
        "name": "shared-libs",
        "hostUrl": "http://localhost:9000",
        "projectKey": "ATC-shared-backend",
        "skipTargetDefaults": false,
        "branches": false,
        "qualityGate": true,
        "qualityGateTimeout": "300",
        "skipImplicitDeps": true,
        "testInclusions":"libs/shared/src/**/*.spec.ts",
        "extra": {
          "sonar.javascript.lcov.reportPaths": "libs/shared/coverage/lcov.info",
          "sonar.testExecutionReportPaths": "libs/shared/reports/test-sonar-report.xml",
          "sonar.dependencyCheck.htmlReportPath": "dependency-check-report.html",
          "sonar.externalIssuesReportPaths": "image-scan-sonar-report.json",
          "sonar.test.inclusions": "libs/shared/src/**/*.spec.ts"
        }
      }
    }

Error:

INFO: Indexing files...
INFO: Project configuration:
INFO:   Excluded sources: libs/shared/src/**/*.spec.ts
INFO:   Included tests: libs/shared/src/**/*.spec.ts
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
@koliveira15
Copy link
Owner

@skokaina do you have a repo I can look at to triage this further? A lot can be happening here to cause this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants