I am trying to run a POC on SonarQube and a solution to illustrate the need for analysis tooling in the pipeline.
Problem: File Apps/Apps.Api/DataExchangeRateLimitConfiguration.cs can’t be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files.
If I exclude “Apps/Apps.Api” another folder just becomes the problem.
I have been reading various posts, but most are related to duplicate use of source.
Running:
- SonarQube Community Edition Version 9.2.4 (build 50792)
- sonar-scanner-4.6.2.2472
- mixed js and C#
- running from a bat file on Windows
This is the bat script I am using: (org. names removed)
SET projectName="[Projectname]"
SET projectKey="[Projectname]"
SET sources="C:/Development/[Subname]/source"
SET sln_path="%sources%/[Projectname].sln"
SET msbuild_path="C:/TestTools/Sonar-scanner-msbuild-net5.0/SonarScanner.MSBuild.dll"
SET login="[key]"
SET exclusions="**/**/**/**/Apps/Apps.Api/*.json"
SET host_url="http://localhost:9000"
SET sourceEncoding=UTF-8
SET verbose=true
ECHO ============START RUNNING SCANNER==============
dotnet %msbuild_path% begin /k:%projectName% /d:sonar.host.url=%host_url% /d:sonar.sourceEncoding=%sourceEncoding% /d:sonar.verbose=%verbose% /d:sonar.exclusions=%exclusions% /d:sonar.sources=%sources% /d:sonar.login=%login%
dotnet build %sln_path%
dotnet %msbuild_path% end /d:sonar.login=%login%
ECHO ============DONE RUNNING SCANNER==============
ECHO ============PAUSING==============
PAUSE