We have specified in our .runsettings
a custom attribute to indicate which code should be ignored in Code Coverage reports on SonarCloud.
<Attribute>^Microsoft\.AspNetCore\.Mvc\.ApiControllerAttribute$</Attribute>
When excluding code using [ApiController]
it still gets flagged on SonarCloud for failing code coverage. However when using [ExcludeFromCodeCoverage]
that is setup in the exact same way it correctly exclude it from the analysis.
The [ApiController]
gets correctly ignored with the Visual Studio and Azure Pipelines reports.
Would appreciate any assistance.
Information about our setup:
- ALM used - Azure DevOps
- CI system used - Azure DevOps (YAML), and OpenCover for Code Coverage
- Languages of the repository - JavaScript, Vue, C#
- SonarCloud project is not public