Skip to content

Commit 90653ef

Browse files
committed
Update Configuration documentation to clarify kind and accessibility orderings
1 parent c23e996 commit 90653ef

3 files changed

Lines changed: 36 additions & 57 deletions

File tree

documentation/Configuration.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ and SA1215) evaluate these traits in the order they are defined to identify orde
9696
this property when reordering code elements. Any traits which are omitted from the array are ignored. The following
9797
traits are supported:
9898

99-
* `kind`: Elements are ordered according to their kind
100-
* `accessibility`: Elements are ordered according to their declared accessibility
99+
* `kind`: Elements are ordered according to their kind (see [SA1201](SA1201.md) for this predefined order)
100+
* `accessibility`: Elements are ordered according to their declared accessibility (see [SA1202](SA1202.md) for this
101+
predefined order)
101102
* `constant`: Constant elements are ordered before non-constant elements
102103
* `static`: Static elements are ordered before non-static elements
103104
* `readonly`: Readonly elements are ordered before non-readonly elements

documentation/SA1201.md

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -25,51 +25,29 @@ A violation of this rule occurs when the code elements within a file do not foll
2525

2626
To comply with this rule, elements at the file root level or within a namespace must be positioned in the following order:
2727

28-
*Extern Alias Directives*
29-
30-
*Using Directives*
31-
32-
*Namespaces*
33-
34-
*Delegates*
35-
36-
*Enums*
37-
38-
*Interfaces*
39-
40-
*Structs*
41-
42-
*Classes*
43-
44-
28+
* Extern Alias Directives
29+
* Using Directives
30+
* Namespaces
31+
* Delegates
32+
* Enums
33+
* Interfaces
34+
* Structs
35+
* Classes
4536

4637
Within a class, struct, or interface, elements must be positioned in the following order:
4738

48-
*Fields*
49-
50-
*Constructors*
51-
52-
*Finalizers (Destructors)*
53-
54-
*Delegates*
55-
56-
*Events*
57-
58-
*Enums*
59-
60-
*Interfaces*
61-
62-
*Properties*
63-
64-
*Indexers*
65-
66-
*Methods*
67-
68-
*Structs*
69-
70-
*Classes*
71-
72-
39+
* Fields
40+
* Constructors
41+
* Finalizers (Destructors)
42+
* Delegates
43+
* Events
44+
* Enums
45+
* Interfaces
46+
* Properties
47+
* Indexers
48+
* Methods
49+
* Structs
50+
* Classes*
7351

7452
Complying with a standard ordering scheme based on element type can increase the readability and maintainability of the file and encourage code reuse.
7553

documentation/SA1202.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@
1717

1818
## Cause
1919

20-
An element within a C# code file is out of order within regard to access level, in relation to other elements in the code.
20+
An element within a C# code file is out of order within regard to access level, in relation to other elements in the
21+
code.
2122

2223
## Rule description
2324

24-
A violation of this rule occurs when the code elements within a file do not follow a standard ordering scheme based on access level.
25+
A violation of this rule occurs when the code elements within a file do not follow a standard ordering scheme based on
26+
access level.
2527

2628
To comply with this rule, adjacent elements of the same type must be positioned in the following order by access level:
2729

28-
*public*
30+
* public
31+
* internal
32+
* protected internal
33+
* protected
34+
* private
2935

30-
*internal*
36+
:memo: Static constructors and explicitly implemented interface members are considered *public* for the purposes of this
37+
rule.
3138

32-
*protected internal*
33-
34-
*protected*
35-
36-
*private*
37-
38-
39-
40-
Complying with a standard ordering scheme based on access level can increase the readability and maintainability of the file and make it easier to identify the public interface that is being exposed from a class.
39+
Complying with a standard ordering scheme based on access level can increase the readability and maintainability of the
40+
file and make it easier to identify the public interface that is being exposed from a class.
4141

4242
## How to fix violations
4343

0 commit comments

Comments
 (0)