no-regions
What it does
Section titled “What it does”Reports every #region outside a block (a region inside a block is no-region-in-body’s), also in disabled #if branches. No fix, because removing a pair is a judgment call.
Why it matters
Section titled “Why it matters”A region hides code behind a label, so a reader of a large class sees only the labels and not the size of what is behind them. Regions make a file longer without making it clearer, and are often a sign that the class should be split.
To fix, remove the region, or move its members to a class of their own.
Example
Section titled “Example”class A {# region R int a;# endregion# if X...Configuration
Section titled “Configuration”csharp: lint: rules: no-regions: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line no-regions 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 | SA1124 |
full |