I am using a azure devops pipeline (api.UserManagement-CI) to run sonar cloud analysis. I have a code repo (api.UserManagement) which I am referring for analysis. I am using template for same. Sonar cloud should analysis for code repo (api.UserManagement). But it is actually analyzing devops pipeline (api.UserManagement-CI).
Is the wrong code being analyzed, or is the correct code being analyzed, but with the wrong project key / name?
If the former, that’s a question of a bad checkout in your pipeline. If the latter, then I would take a look at those envvars you’re using to provide project identification to analysis and make sure they’re being set and cleared properly.
Hey Ann,
Thanks for reply, Now I followed what you advised, I can see that code is being analyzed. But there is different error we never encountered.
Error during SonarScanner execution
2025-03-27T11:47:07.0218884Z ##[error]ERROR: File UWA.UserManagement.API/Controllers/ApplicationsController.cs can’t be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
ERROR:
2025-03-27T11:47:07.0220004Z ERROR: File UWA.UserManagement.API/Controllers/ApplicationsController.cs can’t be indexed twice. Please check that inclusion/exclusion patterns produce disjoint sets for main and test files
yes, I thought so. as we are using 3 repos. I can send logs on your email. Please take your time. if that helps. Things are working if we have pipeline in code repo only.
You’ll need to check out and analyze each repo individually, from its own directory. For any .NET repos, you will need to not manually specify sonar.sources or sonar.tests.