Azure DevOps Pipeline - Fail build for CA1502 CA1505

139 Views Asked by At

I am pretty new to Azure DevOps and this might be a very trivial or very specific question. However I could not find a concrete answer anywhere.

I have setup the build pipeline for My C# codebase and enabled Code analysis. This pipeline is configured to run on Every PR as a branch policy.

The Goal: Capture code analysis response and Look for CA1502 and CA1505 If the value of these is outside the threshold, Fail the build.

I explored the Build Quality Checks Plugin, but it doesn't seem to have such a configuration

1

There are 1 best solutions below

1
Patrick from NDepend team On

You can easily do that with the NDepend Azure DevOps extension.

The extension can fail the build thanks to the notion of quality gate.

The tool proposes several rules related to type and method complexity and maintainability.

Thresholds in these rules can be adjusted to your need since a rule is a C# LINQ query easily modifiable.

Azure DevOps Quality Gate Build Failure