@@ -49,7 +49,11 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
49
49
50
50
var functionDefinitionAsts = Helper . Instance . DscResourceFunctions ( ast ) . Cast < FunctionDefinitionAst > ( ) ;
51
51
52
+ // todo update logic to take keys into consideration
53
+ // todo write tests for same
54
+ // todo update documentation
52
55
var keys = GetKeys ( fileName ) ;
56
+
53
57
// Dictionary to keep track of Mandatory parameters and their presence in Get/Test/Set TargetResource cmdlets
54
58
var mandatoryParameters = new Dictionary < string , List < FunctionDefinitionAst > > ( StringComparer . OrdinalIgnoreCase ) ;
55
59
@@ -99,26 +103,22 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
99
103
100
104
// Get the mandatory parameter names that do not appear in all the DSC Resource cmdlets
101
105
IEnumerable < string > paramNames = mandatoryParameters . Where ( x => x . Value . Count < expectedTargetResourceFunctionNames . Count ) . Select ( x => x . Key ) ;
102
-
103
- if ( paramNames . Count ( ) > 0 )
106
+ foreach ( string paramName in paramNames )
104
107
{
105
- foreach ( string paramName in paramNames )
106
- {
107
- var functionsNotContainingParam = functionDefinitionAsts . Except ( mandatoryParameters [ paramName ] ) ;
108
+ var functionsNotContainingParam = functionDefinitionAsts . Except ( mandatoryParameters [ paramName ] ) ;
108
109
109
- foreach ( var funcDefnAst in functionsNotContainingParam )
110
- {
111
- yield return new DiagnosticRecord (
112
- string . Format (
113
- CultureInfo . InvariantCulture ,
114
- Strings . UseIdenticalMandatoryParametersDSCError ,
115
- paramName ,
116
- funcDefnAst . Name ) ,
117
- Helper . Instance . GetScriptExtentForFunctionName ( funcDefnAst ) ,
118
- GetName ( ) ,
119
- DiagnosticSeverity . Error ,
120
- fileName ) ;
121
- }
110
+ foreach ( var funcDefnAst in functionsNotContainingParam )
111
+ {
112
+ yield return new DiagnosticRecord (
113
+ string . Format (
114
+ CultureInfo . InvariantCulture ,
115
+ Strings . UseIdenticalMandatoryParametersDSCError ,
116
+ paramName ,
117
+ funcDefnAst . Name ) ,
118
+ Helper . Instance . GetScriptExtentForFunctionName ( funcDefnAst ) ,
119
+ GetName ( ) ,
120
+ DiagnosticSeverity . Error ,
121
+ fileName ) ;
122
122
}
123
123
}
124
124
}
0 commit comments