First of all, I’m still not sure if this is a bug of if I’m using SonarCloud incorrectly, but some things have been surprising me a lot while using the tool.
I have installed the SonarCloud analyzers in my solution, and they work great for local builds. The problems starts happening when I try to build on a windows agent (windows-latest). For some reason, the SonarCloudPrepare step:
- task: SonarCloudPrepare@1 inputs: SonarCloud: 'ascent-backend-pipeline' organization: 'nexusinno' scannerMode: 'MSBuild' projectKey: 'ascent' projectName: 'ascent'
Will change the output of my MSBuild step, adding some warnings to the build. I already find it odd that a “prepare” step changes the output of MSBuild. Furthermore, the warnings raised in MSBuild are warnings that I ignore in my .ruleset file, which is why it actually works on my local build without any warnings:
<Rules AnalyzerId="SonarAnalyzer.CSharp" RuleNamespace="SonarAnalyzer.CSharp"> <Rule Id="S1128" Action="None" /> <Rule Id="S4529" Action="None" /> <Rule Id="S4825" Action="None" /> </Rules>
So, basically, my question is: why does SonarCloudPrepare change the output of my build, and why does that output raise warnings that are ignored in my .ruleset file?