C#-MaxConditions¶
An expression must not have more than N logical operators
Required inputs: CSharpAST
&& or ||) are used within a single expression.
As an exception, this rule does not warn about complex conditions within
custom Equals, op_Equality or op_Inequality definitions.
Those operators are often implemented by compare all the class members in a long chain of logical operators.
Rationale
Complex conditions can be hard to understand, and should be split into several statements or extracted into a function.Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
excessive_condition_complexity |
An expression must not have more than {0} logical operators. |
None |
False |
Options¶
This rule shares the following common options: excludes, includes, justification_checker, post_processing, provider, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
ignore_in¶
ignore_in : set[bauhaus.analysis.config.FunctionName] = {'Equals', 'op_Equality', 'op_Inequality'}
maxconditions¶
maxconditions : int = 7