Naming Long Class Name
ID |
csharp.naming_long_class_name |
Severity |
info |
Remediation Complexity |
trivial |
Remediation Risk |
medium |
Remediation Effort |
low |
Resource |
Naming Convention |
Language |
CSharp |
Tags |
naming |
Description
Reports C# type declarations whose name is longer than a configurable threshold
(maxLength, default 40 characters). The rule applies to classes, structs,
records, interfaces, enums and delegates.
Rationale
Very long type names hurt readability and usually indicate that a type is mixing multiple responsibilities. A shorter, well-chosen name is easier to read at a call site and forces clearer modelling of the domain.
public class OrderRepository { } // OK
public class CustomerOrderHistoryAggregationServiceFactoryBuilder { } // FLAW — too long
public interface IAggregatedReportingDataExportConfigurationProviderRegistry { } // FLAW — too long
Remediation
Rename the type to a shorter, more focused name. If you cannot shorten it without losing clarity, the type is probably doing too much: split it into smaller, more cohesive pieces.