@@ -55,7 +55,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
55
55
if ( cmdAst . GetCommandName ( ) == null ) continue ;
56
56
57
57
// Checks mandatory parameters.
58
- if ( ! IsMandatoryParameterExisted ( cmdAst ) )
58
+ if ( ! MandatoryParameterExists ( cmdAst ) )
59
59
{
60
60
yield return new DiagnosticRecord ( String . Format ( CultureInfo . CurrentCulture , Strings . UseCmdletCorrectlyError , cmdAst . GetCommandName ( ) ) ,
61
61
cmdAst . Extent , GetName ( ) , DiagnosticSeverity . Warning , fileName ) ;
@@ -68,7 +68,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
68
68
/// </summary>
69
69
/// <param name="cmdAst"></param>
70
70
/// <returns></returns>
71
- private bool IsMandatoryParameterExisted ( CommandAst cmdAst )
71
+ private bool MandatoryParameterExists ( CommandAst cmdAst )
72
72
{
73
73
CommandInfo cmdInfo = null ;
74
74
List < ParameterMetadata > mandParams = new List < ParameterMetadata > ( ) ;
@@ -88,9 +88,7 @@ private bool IsMandatoryParameterExisted(CommandAst cmdAst)
88
88
89
89
#region Compares parameter list and mandatory parameter list.
90
90
91
- cmdInfo = Helper . Instance . GetCommandInfo ( Helper . Instance . GetCmdletNameFromAlias ( cmdAst . GetCommandName ( ) ) )
92
- ?? Helper . Instance . GetCommandInfo ( cmdAst . GetCommandName ( ) ) ;
93
-
91
+ cmdInfo = Helper . Instance . GetCommandInfo ( cmdAst . GetCommandName ( ) ) ;
94
92
if ( cmdInfo == null || ( cmdInfo . CommandType != System . Management . Automation . CommandTypes . Cmdlet ) )
95
93
{
96
94
return true ;
@@ -109,7 +107,7 @@ private bool IsMandatoryParameterExisted(CommandAst cmdAst)
109
107
// If cannot find any mandatory parameter, it's not necessary to do a further check for current cmdlet.
110
108
try
111
109
{
112
- int noOfParamSets = cmdInfo . ParameterSets . Count ;
110
+ int noOfParamSets = cmdInfo . ParameterSets . Count ;
113
111
foreach ( ParameterMetadata pm in cmdInfo . Parameters . Values )
114
112
{
115
113
int count = 0 ;
@@ -163,7 +161,7 @@ private bool IsMandatoryParameterExisted(CommandAst cmdAst)
163
161
164
162
return returnValue ;
165
163
}
166
-
164
+
167
165
/// <summary>
168
166
/// GetName: Retrieves the name of this rule.
169
167
/// </summary>
0 commit comments