View on GitHub

Arnolyzer

Clean-code Roslyn-based analyzer for C# 6

Arnolyzer on nuget

AA2103 - Method Should Not Contain And

Report code: AA2103-MethodShouldNotContainAnd

Summary

Status Implemented
Description Method names that contain "And" often indicate a method is doing more than one thing. Consider refacting into two methods.
Category Single Responsibilty Analyzers
Enabled by default: Yes
Severity: Warning

Cause

Methods that contain “And” in their name often undertake two tasks and thus have two responsibilities. Thus they are likely to violate the single responsibility principle.

How to fix violations

There currently aren’t any implemented code-fixes for this rule.

How to suppress violations

This rule can be suppressed using the following attributes:

[HasSingleResponsibility]
A method annotated with HasSingleResponsibility is allowed to contain “And” as it is explicitly guaranteeing that it only has one responsibility.