User threshold for CA1502

Is there a way to change thresholds for CodeAnalysis rules?

In particular, we would like our assembly to fail when the method has a code complexity of more than 20. Unfortunately, the CA1502 rule has a threshold of 25:

The rule reports a violation when the cyclomatic complexity is more than 25.

Can we somehow change this?

+4
source share
1 answer

, . , - .fxcop, VStudio , - , . , , , . , . , , , Settings, ( , , 20):

<Settings>
    <Rule TypeName="AvoidExcessiveComplexity">
        <Entry Name="Warning Threshold">20</Entry>
        <Entry Name="Information Threshold">20</Entry>
        <Entry Name="Critical Warning Threshold">20</Entry>
        <Entry Name="Critical Error Threshold">20</Entry>
        <Entry Name="Error Threshold">20</Entry>
        <Entry Name="Recommended Threshold">20</Entry>
    </Rule>
</Settings>
+2

Source: https://habr.com/ru/post/1526172/


All Articles