Prerequisites
Suggested rule title
If expressions should not be too complex
Rule description
Similar to the existing RoutineNestingDepth and TooManyNestedRoutines rules, this rule would catch if expressions that are unclear due to their size. This could be measured in a few ways, e.g.:
- Sum length of the guard, then, or else expressions
- Number of lines the entire expression covers
- Number of nested
if expressions
- Whether anonymous methods are present
- etc.
Rationale
Keeping ternary use limited makes code more readable and less prone to errors.
Prerequisites
Suggested rule title
If expressions should not be too complex
Rule description
Similar to the existing
RoutineNestingDepthandTooManyNestedRoutinesrules, this rule would catchifexpressions that are unclear due to their size. This could be measured in a few ways, e.g.:ifexpressionsRationale
Keeping ternary use limited makes code more readable and less prone to errors.