Must-share information:
- SonarQube 7.9.1, SonarQube Plugin for Azure DevOps 4.21.0, SonarScanner for MSBuild (5.2.1 according to pipeline logs).
- I want to run SQ code analysis on a branch from an Azure DevOps build pipeline (C# code), but all sources seem skipped during analysis. Additionally, SonarQube says “The ‘X’ branch has no lines of code”.
- I have successfully configured 30+ similar projects with practically the same settings but failed just on this one.
This problem is very consistent and appears only for one particular project out of all that we’ve covered with analysis. More things I have already tried:
- comparing the pipelines in Azure DevOps used for the failing project and for the working projects, but there are no significant differences. In fact, the build steps including SonarQube tasks are reused (as a task group), so apart from project paths the settings are the same
- following advice from several similar issues on the Community forum here
- creating a new project in SonarQube admin panel and running a fresh analysis
- recreating/changing the pipeline in Azure Devops
None of the above helps. What I notice in build logs is that the sources are detected but seemingly treated as test code:
03822CB2-365B-4B9B-AC7B-B6C459B23CC7.sonar.tests=\
"E:\\va2\\_work\\1718\\s\\src\\MyProject\\SomeFile.cs",\
"E:\\va2\\_work\\1718\\s\\src\\MyProject\\Constants\\SomeFile1.cs",\
"E:\\va2\\_work\\1718\\s\\src\\MyProject\\Constants\\SomeFile2.cs",\
"E:\\va2\\_work\\1718\\s\\src\\MyProject\\Constants\\SomeFile3.cs",\
"E:\\va2\\_work\\1718\\s\\src\\MyProject\\Constants\\SomeFile4.cs",\
"E:\\va2\\_work\\1718\\s\\src\\MyProject\\Constants\\SomeFile5.cs",\
....
I don’t know if this is a real problem, but it caught my attention. The other projects have the sources under sonar.sources
rather than sonar.tests
. I have tried to set the settings explicitly, e.g. sonar.sources
, sonar.tests
, sonar.test.exclusions
, etc., but it doesn’t help.
What else controls what files are put in the “tests” vs “sources” buckets?