single-class-per-file
What it does
Section titled “What it does”Reports a class or record that comes after the first one in a file: more parts of the first class (when it is partial) are not reported. Structs, interfaces, enums and delegates are not counted. No fix.
Why it matters
Section titled “Why it matters”A file with one class is found by the name of the class, and a change to a class touches one file. A file with several is a place where a class has to be searched for.
To fix, move the class into a file of its own.
Example
Section titled “Example”...namespace N { class Other { void M() {...#endregion} } class B { } struct S { } namespace M { } }Configuration
Section titled “Configuration”csharp: lint: rules: single-class-per-file: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line single-class-per-file in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| StyleCop | SA1402 |
full |