File tree Expand file tree Collapse file tree 3 files changed +31
-26
lines changed Expand file tree Collapse file tree 3 files changed +31
-26
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+
3+ namespace Microsoft . Windows . PowerShell . ScriptAnalyzer . Generic
4+ {
5+ /// <summary>
6+ /// The attribute class to designate if a property is configurable or not.
7+ /// </summary>
8+ [ AttributeUsage ( AttributeTargets . Property ) ]
9+ public class ConfigurableRulePropertyAttribute : Attribute
10+ {
11+ /// <summary>
12+ /// Default value of the property that the attribute decorates.
13+ /// </summary>
14+ public object DefaultValue { get ; private set ; }
15+
16+ /// <summary>
17+ /// Initialize the attribute with the decorated property's default value.
18+ /// </summary>
19+ /// <param name="defaultValue"></param>
20+ public ConfigurableRulePropertyAttribute ( object defaultValue )
21+ {
22+ if ( defaultValue == null )
23+ {
24+ throw new ArgumentNullException ( nameof ( defaultValue ) , Strings . ConfigurableScriptRuleNRE ) ;
25+ }
26+
27+ DefaultValue = defaultValue ;
28+ }
29+ }
30+ }
Original file line number Diff line number Diff line change @@ -143,30 +143,4 @@ private Object GetDefaultValue(PropertyInfo property)
143143 return ( ( ConfigurableRulePropertyAttribute ) attr ) . DefaultValue ;
144144 }
145145 }
146-
147- /// <summary>
148- /// The attribute class to designate if a property is configurable or not.
149- /// </summary>
150- [ AttributeUsage ( AttributeTargets . Property , AllowMultiple = false ) ]
151- public class ConfigurableRulePropertyAttribute : Attribute
152- {
153- /// <summary>
154- /// Default value of the property that the attribute decorates.
155- /// </summary>
156- public object DefaultValue { get ; private set ; }
157-
158- /// <summary>
159- /// Initialize the attribute with the decorated property's default value.
160- /// </summary>
161- /// <param name="defaultValue"></param>
162- public ConfigurableRulePropertyAttribute ( object defaultValue )
163- {
164- if ( defaultValue == null )
165- {
166- throw new ArgumentNullException ( nameof ( defaultValue ) , Strings . ConfigurableScriptRuleNRE ) ;
167- }
168-
169- DefaultValue = defaultValue ;
170- }
171- }
172146}
Original file line number Diff line number Diff line change 7070 <Compile Include =" Commands\InvokeScriptAnalyzerCommand.cs" />
7171 <Compile Include =" Generic\AvoidCmdletGeneric.cs" />
7272 <Compile Include =" Generic\AvoidParameterGeneric.cs" />
73+ <Compile Include =" Generic\ConfigurableRuleProperty.cs" />
7374 <Compile Include =" Generic\ConfigurableScriptRule.cs" />
7475 <Compile Include =" Generic\ModuleDependencyHandler.cs" />
7576 <Compile Include =" Generic\CorrectionExtent.cs" />
You can’t perform that action at this time.
0 commit comments