Skip to content

Commit 9399fcb

Browse files
author
Kapil Borle
committed
Reorder class members
1 parent 31070a9 commit 9399fcb

File tree

1 file changed

+72
-73
lines changed

1 file changed

+72
-73
lines changed

Rules/UseIdenticalMandatoryParametersDSC.cs

Lines changed: 72 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212

1313
using System;
1414
using System.Collections.Generic;
15-
using System.Linq;
16-
using System.Management.Automation.Language;
17-
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
18-
using Microsoft.PowerShell.DesiredStateConfiguration.Internal;
19-
using System.IO;
20-
using Microsoft.Management.Infrastructure;
21-
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions;
2215
#if !CORECLR
2316
using System.ComponentModel.Composition;
2417
#endif
2518
using System.Globalization;
19+
using System.IO;
20+
using System.Linq;
21+
using System.Management.Automation.Language;
22+
using Microsoft.Management.Infrastructure;
23+
using Microsoft.PowerShell.DesiredStateConfiguration.Internal;
24+
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions;
25+
using Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic;
2626

2727
namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
2828
{
@@ -84,6 +84,71 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
8484
}
8585
}
8686

87+
/// <summary>
88+
/// AnalyzeDSCClass: This function returns nothing in the case of dsc class.
89+
/// </summary>
90+
/// <param name="ast"></param>
91+
/// <param name="fileName"></param>
92+
/// <returns></returns>
93+
public IEnumerable<DiagnosticRecord> AnalyzeDSCClass(Ast ast, string fileName)
94+
{
95+
// For DSC Class based resource, this rule is N/A, since the Class Properties
96+
// are declared only once and available to Get(), Set(), Test() functions
97+
return Enumerable.Empty<DiagnosticRecord>();
98+
}
99+
100+
/// <summary>
101+
/// GetName: Retrieves the name of this rule.
102+
/// </summary>
103+
/// <returns>The name of this rule</returns>
104+
public string GetName()
105+
{
106+
return string.Format(CultureInfo.CurrentCulture, Strings.NameSpaceFormat, GetSourceName(), Strings.UseIdenticalMandatoryParametersDSCName);
107+
}
108+
109+
/// <summary>
110+
/// GetCommonName: Retrieves the Common name of this rule.
111+
/// </summary>
112+
/// <returns>The common name of this rule</returns>
113+
public string GetCommonName()
114+
{
115+
return string.Format(CultureInfo.CurrentCulture, Strings.UseIdenticalMandatoryParametersDSCCommonName);
116+
}
117+
118+
/// <summary>
119+
/// GetDescription: Retrieves the description of this rule.
120+
/// </summary>
121+
/// <returns>The description of this rule</returns>
122+
public string GetDescription()
123+
{
124+
return string.Format(CultureInfo.CurrentCulture, Strings.UseIdenticalMandatoryParametersDSCDescription);
125+
}
126+
127+
/// <summary>
128+
/// GetSourceType: Retrieves the type of the rule: builtin, managed or module.
129+
/// </summary>
130+
public SourceType GetSourceType()
131+
{
132+
return SourceType.Builtin;
133+
}
134+
135+
/// <summary>
136+
/// GetSeverity: Retrieves the severity of the rule: error, warning of information.
137+
/// </summary>
138+
/// <returns></returns>
139+
public RuleSeverity GetSeverity()
140+
{
141+
return RuleSeverity.Error;
142+
}
143+
144+
/// <summary>
145+
/// GetSourceName: Retrieves the module/assembly name the rule is from.
146+
/// </summary>
147+
public string GetSourceName()
148+
{
149+
return string.Format(CultureInfo.CurrentCulture, Strings.DSCSourceName);
150+
}
151+
87152
private IEnumerable<ParameterAst> GetMandatoryParameters(FunctionDefinitionAst functionDefinitionAst)
88153
{
89154
return functionDefinitionAst.GetParameterAsts()?.Where(IsParameterMandatory) ??
@@ -217,73 +282,7 @@ private FileInfo GetModuleManifest(string fileName)
217282

218283
return null;
219284
}
220-
221-
/// <summary>
222-
/// AnalyzeDSCClass: This function returns nothing in the case of dsc class.
223-
/// </summary>
224-
/// <param name="ast"></param>
225-
/// <param name="fileName"></param>
226-
/// <returns></returns>
227-
public IEnumerable<DiagnosticRecord> AnalyzeDSCClass(Ast ast, string fileName)
228-
{
229-
// For DSC Class based resource, this rule is N/A, since the Class Properties
230-
// are declared only once and available to Get(), Set(), Test() functions
231-
return Enumerable.Empty<DiagnosticRecord>();
232-
}
233-
234-
/// <summary>
235-
/// GetName: Retrieves the name of this rule.
236-
/// </summary>
237-
/// <returns>The name of this rule</returns>
238-
public string GetName()
239-
{
240-
return string.Format(CultureInfo.CurrentCulture, Strings.NameSpaceFormat, GetSourceName(), Strings.UseIdenticalMandatoryParametersDSCName);
241-
}
242-
243-
/// <summary>
244-
/// GetCommonName: Retrieves the Common name of this rule.
245-
/// </summary>
246-
/// <returns>The common name of this rule</returns>
247-
public string GetCommonName()
248-
{
249-
return string.Format(CultureInfo.CurrentCulture, Strings.UseIdenticalMandatoryParametersDSCCommonName);
250-
}
251-
252-
/// <summary>
253-
/// GetDescription: Retrieves the description of this rule.
254-
/// </summary>
255-
/// <returns>The description of this rule</returns>
256-
public string GetDescription()
257-
{
258-
return string.Format(CultureInfo.CurrentCulture, Strings.UseIdenticalMandatoryParametersDSCDescription);
259-
}
260-
261-
/// <summary>
262-
/// GetSourceType: Retrieves the type of the rule: builtin, managed or module.
263-
/// </summary>
264-
public SourceType GetSourceType()
265-
{
266-
return SourceType.Builtin;
267-
}
268-
269-
/// <summary>
270-
/// GetSeverity: Retrieves the severity of the rule: error, warning of information.
271-
/// </summary>
272-
/// <returns></returns>
273-
public RuleSeverity GetSeverity()
274-
{
275-
return RuleSeverity.Error;
276-
}
277-
278-
/// <summary>
279-
/// GetSourceName: Retrieves the module/assembly name the rule is from.
280-
/// </summary>
281-
public string GetSourceName()
282-
{
283-
return string.Format(CultureInfo.CurrentCulture, Strings.DSCSourceName);
284-
}
285285
}
286-
287286
}
288287

289288

0 commit comments

Comments
 (0)