I have a C# API solution which is having code project and a test project. I am using classic azure CICD pipeline. Help me to set up sonarqube to get code coverage and code smell . Also I don’t want test project files should be part of code smell. it only should be part of code coverage.
Our current pipeline task setup given below:
PrepareAnalysis- Dotnet Restore- Test Case Analysis using dot net task- Dotnet Publish- Run Code Analysis
Sonar property we tried out in pipelines not working:
Thanks for your update. We have tried both this property(use a ruleKey of csharpsquid:* or of just *) in sonar UI for the project we are trying to analyze. But still it is not working and issues are flagged out for the test case projects we don’t require to publish in sonar dashboard.
Kindly help. We want to get the code coverage by doing test case analysis in pipeline at the same time we want to suppress the vulnerabilities raised for the test case files on sonar UI.
The logs you’ve provided aren’t adequate. I may need to ask you for the full files, redacted as necessary. First though, the reason you include tests in your analysis at all is that you want to make sure coverage shows up correctly on your non-test files? You think that without the tests visible to analysis to back up the coverage data, the coverage data won’t be imported or interpreted correctly? Because I don’t believe that’s the case. Can you try excluding your test project from analysis?