~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to contrib/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/InconsistentNamingIssue/DefaultRules.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// 
2
 
// DefaultRules.cs
3
 
//  
4
 
// Author:
5
 
//       Mike Krüger <mkrueger@xamarin.com>
6
 
// 
7
 
// Copyright (c) 2012 Xamarin <http://xamarin.com>
8
 
// 
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:
15
 
// 
16
 
// The above copyright notice and this permission notice shall be included in
17
 
// all copies or substantial portions of the Software.
18
 
// 
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
25
 
// THE SOFTWARE.
26
 
using System;
27
 
using System.Collections.Generic;
28
 
 
29
 
namespace ICSharpCode.NRefactory.CSharp.Refactoring
30
 
{
31
 
        public static class DefaultRules
32
 
        {
33
 
                public static IEnumerable<NamingRule> GetFdgRules()
34
 
                {
35
 
                        yield return new NamingRule(AffectedEntity.Namespace) {
36
 
                                Name = "Namespaces",
37
 
                                NamingStyle = NamingStyle.PascalCase
38
 
                        };
39
 
                        
40
 
                        yield return new NamingRule(AffectedEntity.Class | AffectedEntity.Struct | AffectedEntity.Enum | AffectedEntity.Delegate) {
41
 
                                Name = "Types",
42
 
                                NamingStyle = NamingStyle.PascalCase
43
 
                        };
44
 
 
45
 
                        yield return new NamingRule(AffectedEntity.Interface) {
46
 
                                Name = "Interfaces",
47
 
                                NamingStyle = NamingStyle.PascalCase,
48
 
                                RequiredPrefixes = new [] { "I" }
49
 
                        };
50
 
 
51
 
                        yield return new NamingRule(AffectedEntity.CustomAttributes) {
52
 
                                Name = "Attributes",
53
 
                                NamingStyle = NamingStyle.PascalCase,
54
 
                                RequiredSuffixes = new [] { "Attribute" }
55
 
                        };
56
 
                        
57
 
                        yield return new NamingRule(AffectedEntity.CustomEventArgs) {
58
 
                                Name = "Event Arguments",
59
 
                                NamingStyle = NamingStyle.PascalCase,
60
 
                                RequiredSuffixes = new [] { "EventArgs" }
61
 
                        };
62
 
                        
63
 
                        yield return new NamingRule(AffectedEntity.CustomExceptions) {
64
 
                                Name = "Exceptions",
65
 
                                NamingStyle = NamingStyle.PascalCase,
66
 
                                RequiredSuffixes = new [] { "Exception" }
67
 
                        };
68
 
 
69
 
                        yield return new NamingRule(AffectedEntity.Methods) {
70
 
                                Name = "Methods",
71
 
                                NamingStyle = NamingStyle.PascalCase
72
 
                        };
73
 
 
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
79
 
                        };
80
 
 
81
 
                        yield return new NamingRule(AffectedEntity.Field) {
82
 
                                Name = "Fields (Non Private)",
83
 
                                NamingStyle = NamingStyle.PascalCase,
84
 
                                VisibilityMask = Modifiers.Public | Modifiers.Protected | Modifiers.Internal
85
 
                        };
86
 
                        
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
92
 
                        };
93
 
 
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
100
 
                        };
101
 
                        
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
108
 
                        };
109
 
                        
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
116
 
                        };
117
 
 
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
122
 
                        };
123
 
 
124
 
                        yield return new NamingRule(AffectedEntity.Property) {
125
 
                                Name = "Properties",
126
 
                                NamingStyle = NamingStyle.PascalCase
127
 
                        };
128
 
 
129
 
                        yield return new NamingRule(AffectedEntity.Event) {
130
 
                                Name = "Events",
131
 
                                NamingStyle = NamingStyle.PascalCase
132
 
                        };
133
 
 
134
 
                        yield return new NamingRule(AffectedEntity.EnumMember) {
135
 
                                Name = "Enum Members",
136
 
                                NamingStyle = NamingStyle.PascalCase
137
 
                        };
138
 
 
139
 
                        yield return new NamingRule(AffectedEntity.Parameter) {
140
 
                                Name = "Parameters",
141
 
                                NamingStyle = NamingStyle.CamelCase
142
 
                        };
143
 
 
144
 
                        yield return new NamingRule(AffectedEntity.TypeParameter) {
145
 
                                Name = "Type Parameters",
146
 
                                NamingStyle = NamingStyle.PascalCase,
147
 
                                RequiredPrefixes = new [] { "T" }
148
 
                        };
149
 
                }
150
 
        }
151
 
}
152