Skip to content

Commit 280f5e2

Browse files
committed
Document the usingDirectivesPlacement property
1 parent 6cbdc46 commit 280f5e2

1 file changed

Lines changed: 43 additions & 1 deletion

File tree

documentation/Configuration.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,49 @@ This section describes the features of ordering rules which can be configured in
8383
}
8484
```
8585

86-
> Currently there are no configurable settings for ordering rules.
86+
### Using Directives
87+
88+
The following properties are used to configure using directives in StyleCop Analyzers.
89+
90+
| Property | Default Value | Summary |
91+
| --- | --- | --- |
92+
| `usingDirectivesPlacement` | `"insideNamespace"` | Specifies the desired placement of using directives |
93+
94+
#### Using Directives Placement
95+
96+
The `usingDirectivesPlacement` property affects the behavior of the following rules which report incorrectly placed
97+
using directives.
98+
99+
* [SA1200 Using directives must be placed correctly](SA1200.md)
100+
101+
> :warning: Use of certain features, including but not limited to preprocessor directives, may cause the using
102+
> directives code fix to not relocate using directives automatically. If SA1200 is still reported after applying the Fix
103+
> All operation for using directives, the remaining cases will need to be resolved manually.
104+
105+
This property has three allowed values, which are described as follows.
106+
107+
##### `"insideNamespace"`
108+
109+
In this mode, using directives should be placed *inside* of namespace declarations. This is the default mode, and
110+
adheres to the original SA1200 behavior from StyleCop Classic.
111+
112+
* SA1200 reports using directives which are located outside of a namespace declaration (a few exceptions exist for cases
113+
where this is required)
114+
* Using directives code fix moves using directives inside of namespace declarations where possible
115+
116+
##### `"outsideNamespace"`
117+
118+
In this mode, using directives should be placed *outside* of namespace declarations.
119+
120+
* SA1200 reports using directives which are located inside of a namespace declaration
121+
* Using directives code fix moves using directives outside of namespace declarations where possible
122+
123+
##### `"preserve"`
124+
125+
In this mode, using directives may be placed inside or outside of namespaces.
126+
127+
* SA1200 does not report any violations
128+
* Using directives code fix may reorder using directives, but does not relocate them
87129

88130
## Naming Rules
89131

0 commit comments

Comments
 (0)