CA1509: Invalid entry in code metrics configuration file

Value
Rule ID CA1509
Category Maintainability
Fix is breaking or non-breaking Non-Breaking

Cause

Code metrics rules, such as CA1501, CA1502, CA1505 and CA1506, supplied a configuration file named CodeMetricsConfig.txt that has an invalid entry.

Rule description

.NET code-quality analyzers implementation of code metrics analysis rules allow end users to supply an additional file named CodeMetricsConfig.txt. This file contains entries to configure code metric thresholds for analysis. Following rules are configurable in this file:

This configuration file expects each entry to be in following format:

'RuleId'(Optional 'SymbolKind'): 'Threshold'
  • Valid values for 'RuleId' are CA1501, CA1502, CA1505, and CA1506.
  • Valid values for optional 'SymbolKind' are Assembly, Namespace, Type, Method, Field, Event, and Property.
  • Valid values for 'Threshold' are non-negative integers.
  • Lines starting with '#' are treated as comment lines

For example, the following is a valid configuration file:

# Comment text

CA1501: 1

CA1502(Type): 4
CA1502(Method): 2

An invalid entry in this configuration file is flagged with the CA1509 diagnostic.

How to fix violations

To fix a violation of this rule, make sure the invalid entry in CodeMetricsConfig.txt gets the required format.

When to suppress warnings

Do not suppress violations of this rule.

See also