@@ -19,133 +19,155 @@ namespace StyleCop.ReSharper.CodeCleanup
19
19
using JetBrains . ReSharper . Feature . Services . CodeCleanup ;
20
20
using JetBrains . Util ;
21
21
22
- /// <summary>
23
- /// The style cop descriptor.
24
- /// </summary>
25
- [ DisplayName ( "Fix StyleCop violations" ) ]
26
- [ Category ( CSharpCategory ) ]
27
- [ TypeConverter ( typeof ( ExpandableObjectConverter ) ) ]
28
- public class StyleCopDescriptor : CodeCleanupOptionDescriptor < StyleCopCodeCleanupOptions >
22
+ [ Category ( CSharpCategory ) ]
23
+ [ DisplayName ( "Fix StyleCop violations" ) ]
24
+ [ DefaultValue ( true ) ]
25
+ public class FixViolationsDescriptor : CodeCleanupBoolOptionDescriptor
29
26
{
30
- /// <summary>
31
- /// Initializes a new instance of the <see cref="StyleCopDescriptor"/> class.
32
- /// </summary>
33
- public StyleCopDescriptor ( )
34
- : base ( "StyleCop" )
27
+ public FixViolationsDescriptor ( )
28
+ : base ( "FixViolations" )
35
29
{
36
30
}
31
+ }
37
32
38
- /// <summary>
39
- /// Summarize the options for the Code Cleanup dialog
40
- /// </summary>
41
- /// <param name="profile">
42
- /// The selected profile
43
- /// </param>
44
- /// <returns>
45
- /// A string that summarizes the options
46
- /// </returns>
47
- public override string Present ( CodeCleanupProfile profile )
33
+ [ Category ( CSharpCategory ) ]
34
+ [ DisplayName ( "Create XML doc stubs" ) ]
35
+ [ DefaultValue ( false ) ]
36
+ public class CreateXmlDocStubsDescriptor : CodeCleanupBoolOptionDescriptor
37
+ {
38
+ public CreateXmlDocStubsDescriptor ( )
39
+ : base ( "CreateXmlDocStubs" )
48
40
{
49
- return profile . GetSetting ( this ) . ToString ( ) ;
50
41
}
42
+ }
51
43
52
- /// <summary>
53
- /// Save the options
54
- /// </summary>
55
- /// <param name="element">
56
- /// The parent XML element to add the options to
57
- /// </param>
58
- /// <param name="value">
59
- /// The options to save
60
- /// </param>
61
- public override void Save ( XmlElement element , StyleCopCodeCleanupOptions value )
62
- {
63
- element . CreateLeafElementWithValue (
64
- "FixViolations" ,
65
- value . FixViolations . ToString ( CultureInfo . InvariantCulture ) ) ;
66
- element . CreateLeafElementWithValue (
67
- "CreateXmlDocStubs" ,
68
- value . CreateXmlDocStubs . ToString ( CultureInfo . InvariantCulture ) ) ;
69
- }
44
+ ///// <summary>
45
+ ///// The style cop descriptor.
46
+ ///// </summary>
47
+ //[DisplayName("Fix StyleCop violations")]
48
+ //[Category(CSharpCategory)]
49
+ //[TypeConverter(typeof(ExpandableObjectConverter))]
50
+ //public class StyleCopDescriptor : CodeCleanupOptionDescriptor<StyleCopCodeCleanupOptions>
51
+ //{
52
+ // /// <summary>
53
+ // /// Initializes a new instance of the <see cref="StyleCopDescriptor"/> class.
54
+ // /// </summary>
55
+ // public StyleCopDescriptor()
56
+ // : base("StyleCop")
57
+ // {
58
+ // }
70
59
71
- /// <summary>
72
- /// Load the options
73
- /// </summary>
74
- /// <param name="element">
75
- /// The parent XML element
76
- /// </param>
77
- /// <returns>
78
- /// A loaded instance of the options
79
- /// </returns>
80
- public override StyleCopCodeCleanupOptions Load ( XmlElement element )
81
- {
82
- return new StyleCopCodeCleanupOptions
83
- {
84
- FixViolations = bool . Parse ( XmlUtil . ReadLeafElementValue ( element , "FixViolations" ) ) ,
85
- CreateXmlDocStubs = bool . Parse ( XmlUtil . ReadLeafElementValue ( element , "CreateXmlDocStubs" ) )
86
- } ;
87
- }
88
- }
60
+ // /// <summary>
61
+ // /// Summarize the options for the Code Cleanup dialog
62
+ // /// </summary>
63
+ // /// <param name="profile">
64
+ // /// The selected profile
65
+ // /// </param>
66
+ // /// <returns>
67
+ // /// A string that summarizes the options
68
+ // /// </returns>
69
+ // public override string Present(CodeCleanupProfile profile)
70
+ // {
71
+ // return profile.GetSetting(this).ToString();
72
+ // }
89
73
90
- /// <summary>
91
- /// Options for code cleanup
92
- /// </summary>
93
- public class StyleCopCodeCleanupOptions : ObservableObject
94
- {
95
- private bool fixViolations ;
96
- private bool createXmlDocStubs ;
74
+ // /// <summary>
75
+ // /// Save the options
76
+ // /// </summary>
77
+ // /// <param name="element">
78
+ // /// The parent XML element to add the options to
79
+ // /// </param>
80
+ // /// <param name="value">
81
+ // /// The options to save
82
+ // /// </param>
83
+ // public override void Save(XmlElement element, StyleCopCodeCleanupOptions value)
84
+ // {
85
+ // element.CreateLeafElementWithValue(
86
+ // "FixViolations",
87
+ // value.FixViolations.ToString(CultureInfo.InvariantCulture));
88
+ // element.CreateLeafElementWithValue(
89
+ // "CreateXmlDocStubs",
90
+ // value.CreateXmlDocStubs.ToString(CultureInfo.InvariantCulture));
91
+ // }
97
92
98
- /// <summary>
99
- /// Option to fix StyleCop violations
100
- /// </summary>
101
- [ DisplayName ( "Fix StyleCop violations" ) ]
102
- public bool FixViolations
103
- {
104
- get
105
- {
106
- return this . fixViolations ;
107
- }
108
- set
109
- {
110
- this . SetField ( ref this . fixViolations , value ) ;
111
- }
112
- }
93
+ // /// <summary>
94
+ // /// Load the options
95
+ // /// </summary>
96
+ // /// <param name="element">
97
+ // /// The parent XML element
98
+ // /// </param>
99
+ // /// <returns>
100
+ // /// A loaded instance of the options
101
+ // /// </returns>
102
+ // public override StyleCopCodeCleanupOptions Load(XmlElement element)
103
+ // {
104
+ // return new StyleCopCodeCleanupOptions
105
+ // {
106
+ // FixViolations = bool.Parse(XmlUtil.ReadLeafElementValue(element, "FixViolations")),
107
+ // CreateXmlDocStubs = bool.Parse(XmlUtil.ReadLeafElementValue(element, "CreateXmlDocStubs"))
108
+ // };
109
+ // }
110
+ //}
113
111
114
- /// <summary>
115
- /// Options to generate XML doc stubs
116
- /// </summary>
117
- [ DisplayName ( "Create XML doc stubs" ) ]
118
- public bool CreateXmlDocStubs
119
- {
120
- get
121
- {
122
- return this . createXmlDocStubs ;
123
- }
124
- set
125
- {
126
- this . SetField ( ref this . createXmlDocStubs , value ) ;
127
- }
128
- }
112
+ ///// <summary>
113
+ ///// Options for code cleanup
114
+ ///// </summary>
115
+ //public class StyleCopCodeCleanupOptions : ObservableObject
116
+ //{
117
+ // private bool fixViolations;
118
+ // private bool createXmlDocStubs;
129
119
130
- /// <summary>
131
- /// Initializes a new instance of the <see cref="StyleCopCodeCleanupOptions"/> class.
132
- /// </summary>
133
- public StyleCopCodeCleanupOptions ( )
134
- {
135
- this . FixViolations = true ;
120
+ // /// <summary>
121
+ // /// Option to fix StyleCop violations
122
+ // /// </summary>
123
+ // [DisplayName("Fix StyleCop violations")]
124
+ // public bool FixViolations
125
+ // {
126
+ // get
127
+ // {
128
+ // return this.fixViolations;
129
+ // }
130
+ // set
131
+ // {
132
+ // this.SetField(ref this.fixViolations, value);
133
+ // }
134
+ // }
136
135
137
- // TODO: What's the best default?
138
- // I like the argument that we shouldn't blindly create XML docs, but set
139
- // them properly, but it's nice to be able to fix up everything we can...
140
- this . CreateXmlDocStubs = false ;
141
- }
136
+ // /// <summary>
137
+ // /// Options to generate XML doc stubs
138
+ // /// </summary>
139
+ // [DisplayName("Create XML doc stubs")]
140
+ // public bool CreateXmlDocStubs
141
+ // {
142
+ // get
143
+ // {
144
+ // return this.createXmlDocStubs;
145
+ // }
146
+ // set
147
+ // {
148
+ // this.SetField(ref this.createXmlDocStubs, value);
149
+ // }
150
+ // }
142
151
143
- public override string ToString ( )
144
- {
145
- StringBuilder stringBuilder = new StringBuilder ( ) ;
146
- stringBuilder . Append ( this . FixViolations ? "Yes" : "No" ) ;
147
- stringBuilder . Append ( this . CreateXmlDocStubs ? " (create XML doc stubs)" : " (do not create XML doc stubs)" ) ;
148
- return stringBuilder . ToString ( ) ;
149
- }
150
- }
152
+ // /// <summary>
153
+ // /// Initializes a new instance of the <see cref="StyleCopCodeCleanupOptions"/> class.
154
+ // /// </summary>
155
+ // public StyleCopCodeCleanupOptions()
156
+ // {
157
+ // this.FixViolations = true;
158
+
159
+ // // TODO: What's the best default?
160
+ // // I like the argument that we shouldn't blindly create XML docs, but set
161
+ // // them properly, but it's nice to be able to fix up everything we can...
162
+ // this.CreateXmlDocStubs = false;
163
+ // }
164
+
165
+ // public override string ToString()
166
+ // {
167
+ // StringBuilder stringBuilder = new StringBuilder();
168
+ // stringBuilder.Append(this.FixViolations ? "Yes" : "No");
169
+ // stringBuilder.Append(this.CreateXmlDocStubs ? " (create XML doc stubs)" : " (do not create XML doc stubs)");
170
+ // return stringBuilder.ToString();
171
+ // }
172
+ //}
151
173
}
0 commit comments