separate-field-declarations
What it does
Section titled “What it does”Reports a declaration of several fields or events (int a, b;), which becomes int a; and int b;, each with the attributes, modifiers and type of the original. The fix is not offered when the declaration has a comment in it.
Why it matters
Section titled “Why it matters”One field to a declaration gives each its own line, so a change to one is one line in the diff and each can have its own comment and initializer.
Example
Section titled “Example”class A { int a, b; Nullable<int> n = (long)1 < 2 ? null : null; void F(object o, int i) { var f = delegate (int x) { return x; };...Configuration
Section titled “Configuration”csharp: lint: rules: separate-field-declarations: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line separate-field-declarations 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 | SA1132 |
full |