using-placement
What it does
Section titled “What it does”Reports a using directive outside the namespace declaration in a file that has one. No fix: moving a directive changes how names are looked up.
Why it matters
Section titled “Why it matters”A using inside the namespace is resolved relative to it, and one outside is global to the file. Projects choose one place for all files, so that the lookup of names does not depend on which file a directive is in.
Example
Section titled “Example”using System;namespace N{ using System.IO;...Configuration
Section titled “Configuration”csharp: lint: rules: using-placement: warn # off (default), warn, errorEnabled by the presets: csharp/stylecop.
Suppress one line with sudsy-disable-next-line using-placement 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 | SA1200 |
full |