@@ -190,7 +190,7 @@ public object Settings
190
190
private bool stopProcessing ;
191
191
192
192
/// <summary>
193
- /// Resolve DSC resoure dependency
193
+ /// Resolve DSC resource dependency
194
194
/// </summary>
195
195
[ Parameter ( Mandatory = false ) ]
196
196
public SwitchParameter ResolveDscResourceDependency
@@ -257,6 +257,21 @@ protected override void ProcessRecord()
257
257
}
258
258
}
259
259
260
+ protected override void EndProcessing ( )
261
+ {
262
+ ScriptAnalyzer . Instance . CleanUp ( ) ;
263
+ base . EndProcessing ( ) ;
264
+ }
265
+
266
+ protected override void StopProcessing ( )
267
+ {
268
+ ScriptAnalyzer . Instance . CleanUp ( ) ;
269
+ base . StopProcessing ( ) ;
270
+ }
271
+
272
+ #endregion
273
+
274
+ #region Methods
260
275
private void ProcessInput ( )
261
276
{
262
277
IEnumerable < DiagnosticRecord > diagnosticsList = Enumerable . Empty < DiagnosticRecord > ( ) ;
@@ -269,61 +284,26 @@ private void ProcessInput()
269
284
diagnosticsList = ScriptAnalyzer . Instance . AnalyzePath (
270
285
this . SessionState . Path . GetUnresolvedProviderPathFromPSPath ( p . Path ) ,
271
286
this . recurse ) ;
287
+ WriteToOutput ( diagnosticsList ) ;
272
288
}
273
289
}
274
290
else if ( String . Equals ( this . ParameterSetName , "ScriptDefinition" , StringComparison . OrdinalIgnoreCase ) )
275
291
{
276
292
diagnosticsList = ScriptAnalyzer . Instance . AnalyzeScriptDefinition ( scriptDefinition ) ;
293
+ WriteToOutput ( diagnosticsList ) ;
277
294
}
295
+ }
278
296
297
+ private void WriteToOutput ( IEnumerable < DiagnosticRecord > diagnosticRecords )
298
+ {
279
299
foreach ( ILogger logger in ScriptAnalyzer . Instance . Loggers )
280
300
{
281
- foreach ( DiagnosticRecord diagnostic in diagnosticsList )
301
+ foreach ( DiagnosticRecord diagnostic in diagnosticRecords )
282
302
{
283
303
logger . LogObject ( diagnostic , this ) ;
284
304
}
285
305
}
286
306
}
287
-
288
- protected override void EndProcessing ( )
289
- {
290
- ScriptAnalyzer . Instance . CleanUp ( ) ;
291
- base . EndProcessing ( ) ;
292
- }
293
-
294
- protected override void StopProcessing ( )
295
- {
296
- ScriptAnalyzer . Instance . CleanUp ( ) ;
297
- base . StopProcessing ( ) ;
298
- }
299
-
300
- #endregion
301
-
302
- #region Methods
303
-
304
- //private void ProcessPathOrScriptDefinition(string pathOrScriptDefinition)
305
- //{
306
- // IEnumerable<DiagnosticRecord> diagnosticsList = Enumerable.Empty<DiagnosticRecord>();
307
-
308
- // if (String.Equals(this.ParameterSetName, "File", StringComparison.OrdinalIgnoreCase))
309
- // {
310
- // diagnosticsList = ScriptAnalyzer.Instance.AnalyzePath(pathOrScriptDefinition, this.recurse);
311
- // }
312
- // else if (String.Equals(this.ParameterSetName, "ScriptDefinition", StringComparison.OrdinalIgnoreCase))
313
- // {
314
- // diagnosticsList = ScriptAnalyzer.Instance.AnalyzeScriptDefinition(pathOrScriptDefinition);
315
- // }
316
-
317
- // //Output through loggers
318
- // foreach (ILogger logger in ScriptAnalyzer.Instance.Loggers)
319
- // {
320
- // foreach (DiagnosticRecord diagnostic in diagnosticsList)
321
- // {
322
- // logger.LogObject(diagnostic, this);
323
- // }
324
- // }
325
- //}
326
-
327
307
#endregion
328
308
}
329
309
}
0 commit comments