5
// Mike Krüger <mkrueger@xamarin.com>
7
// Copyright (c) 2012 Xamarin <http://xamarin.com>
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
// of this software and associated documentation files (the "Software"), to deal
11
// in the Software without restriction, including without limitation the rights
12
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
// copies of the Software, and to permit persons to whom the Software is
14
// furnished to do so, subject to the following conditions:
16
// The above copyright notice and this permission notice shall be included in
17
// all copies or substantial portions of the Software.
19
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
using System.Collections.Generic;
29
namespace ICSharpCode.NRefactory.CSharp.Refactoring
31
public static class DefaultRules
33
public static IEnumerable<NamingRule> GetFdgRules()
35
yield return new NamingRule(AffectedEntity.Namespace) {
37
NamingStyle = NamingStyle.PascalCase
40
yield return new NamingRule(AffectedEntity.Class | AffectedEntity.Struct | AffectedEntity.Enum | AffectedEntity.Delegate) {
42
NamingStyle = NamingStyle.PascalCase
45
yield return new NamingRule(AffectedEntity.Interface) {
47
NamingStyle = NamingStyle.PascalCase,
48
RequiredPrefixes = new [] { "I" }
51
yield return new NamingRule(AffectedEntity.CustomAttributes) {
53
NamingStyle = NamingStyle.PascalCase,
54
RequiredSuffixes = new [] { "Attribute" }
57
yield return new NamingRule(AffectedEntity.CustomEventArgs) {
58
Name = "Event Arguments",
59
NamingStyle = NamingStyle.PascalCase,
60
RequiredSuffixes = new [] { "EventArgs" }
63
yield return new NamingRule(AffectedEntity.CustomExceptions) {
65
NamingStyle = NamingStyle.PascalCase,
66
RequiredSuffixes = new [] { "Exception" }
69
yield return new NamingRule(AffectedEntity.Methods) {
71
NamingStyle = NamingStyle.PascalCase
74
yield return new NamingRule(AffectedEntity.ReadonlyField) {
75
Name = "Static Readonly Fields",
76
VisibilityMask = Modifiers.Public | Modifiers.Protected | Modifiers.Internal,
77
NamingStyle = NamingStyle.PascalCase,
78
IncludeInstanceMembers = false
81
yield return new NamingRule(AffectedEntity.Field) {
82
Name = "Fields (Non Private)",
83
NamingStyle = NamingStyle.PascalCase,
84
VisibilityMask = Modifiers.Public | Modifiers.Protected | Modifiers.Internal
87
yield return new NamingRule(AffectedEntity.ReadonlyField) {
88
Name = "ReadOnly Fields (Non Private)",
89
NamingStyle = NamingStyle.PascalCase,
90
VisibilityMask = Modifiers.Public | Modifiers.Protected | Modifiers.Internal,
91
IncludeStaticEntities = false
94
yield return new NamingRule(AffectedEntity.Field | AffectedEntity.ReadonlyField) {
95
Name = "Fields (Private)",
96
NamingStyle = NamingStyle.CamelCase,
97
AllowedPrefixes = new [] { "_", "m_" },
98
VisibilityMask = Modifiers.Private,
99
IncludeStaticEntities = false
102
yield return new NamingRule(AffectedEntity.Field) {
103
Name = "Static Fields (Private)",
104
NamingStyle = NamingStyle.CamelCase,
105
VisibilityMask = Modifiers.Private,
106
IncludeStaticEntities = true,
107
IncludeInstanceMembers = false
110
yield return new NamingRule(AffectedEntity.ReadonlyField) {
111
Name = "ReadOnly Fields (Private)",
112
NamingStyle = NamingStyle.CamelCase,
113
VisibilityMask = Modifiers.Private,
114
AllowedPrefixes = new [] { "_", "m_" },
115
IncludeStaticEntities = false
118
yield return new NamingRule(AffectedEntity.ConstantField) {
119
Name = "Constant Fields",
120
NamingStyle = NamingStyle.PascalCase,
121
VisibilityMask = Modifiers.Public | Modifiers.Protected | Modifiers.Internal | Modifiers.Private
124
yield return new NamingRule(AffectedEntity.Property) {
126
NamingStyle = NamingStyle.PascalCase
129
yield return new NamingRule(AffectedEntity.Event) {
131
NamingStyle = NamingStyle.PascalCase
134
yield return new NamingRule(AffectedEntity.EnumMember) {
135
Name = "Enum Members",
136
NamingStyle = NamingStyle.PascalCase
139
yield return new NamingRule(AffectedEntity.Parameter) {
141
NamingStyle = NamingStyle.CamelCase
144
yield return new NamingRule(AffectedEntity.TypeParameter) {
145
Name = "Type Parameters",
146
NamingStyle = NamingStyle.PascalCase,
147
RequiredPrefixes = new [] { "T" }