@@ -104,12 +104,12 @@ public SwitchParameter Recurse
104
104
/// </summary>
105
105
[ Parameter ( Mandatory = false ) ]
106
106
[ SuppressMessage ( "Microsoft.Performance" , "CA1819:PropertiesShouldNotReturnArrays" ) ]
107
- public SwitchParameter ShowSuppressed
107
+ public SwitchParameter SuppressedOnly
108
108
{
109
- get { return showSuppressed ; }
110
- set { showSuppressed = value ; }
109
+ get { return suppressedOnly ; }
110
+ set { suppressedOnly = value ; }
111
111
}
112
- private bool showSuppressed ;
112
+ private bool suppressedOnly ;
113
113
114
114
#endregion Parameters
115
115
@@ -268,7 +268,7 @@ private void AnalyzeFile(string filePath)
268
268
Token [ ] tokens = null ;
269
269
ParseError [ ] errors = null ;
270
270
List < DiagnosticRecord > diagnostics = new List < DiagnosticRecord > ( ) ;
271
- List < DiagnosticRecord > suppressed = new List < DiagnosticRecord > ( ) ;
271
+ List < SuppressedRecord > suppressed = new List < SuppressedRecord > ( ) ;
272
272
273
273
// Use a List of KVP rather than dictionary, since for a script containing inline functions with same signature, keys clash
274
274
List < KeyValuePair < CommandInfo , IScriptExtent > > cmdInfoTable = new List < KeyValuePair < CommandInfo , IScriptExtent > > ( ) ;
@@ -341,10 +341,9 @@ private void AnalyzeFile(string filePath)
341
341
// We want the Engine to continue functioning even if one or more Rules throws an exception
342
342
try
343
343
{
344
- var records = scriptRule . AnalyzeScript ( ast , filePath ) . ToList ( ) ;
345
- Helper . Instance . SuppressRule ( scriptRule . GetName ( ) , ruleSuppressions , records ) ;
346
- diagnostics . AddRange ( records . Where ( record => record . Suppression == null ) ) ;
347
- suppressed . AddRange ( records . Where ( record => record . Suppression != null ) ) ;
344
+ var records = Helper . Instance . SuppressRule ( scriptRule . GetName ( ) , ruleSuppressions , scriptRule . AnalyzeScript ( ast , filePath ) . ToList ( ) ) ;
345
+ diagnostics . AddRange ( records . Item2 ) ;
346
+ suppressed . AddRange ( records . Item1 ) ;
348
347
}
349
348
catch ( Exception scriptRuleException )
350
349
{
@@ -372,10 +371,9 @@ private void AnalyzeFile(string filePath)
372
371
// We want the Engine to continue functioning even if one or more Rules throws an exception
373
372
try
374
373
{
375
- var records = tokenRule . AnalyzeTokens ( tokens , fileName ) . ToList ( ) ;
376
- Helper . Instance . SuppressRule ( tokenRule . GetName ( ) , ruleSuppressions , records ) ;
377
- diagnostics . AddRange ( records . Where ( record => record . Suppression == null ) ) ;
378
- suppressed . AddRange ( records . Where ( record => record . Suppression != null ) ) ;
374
+ var records = Helper . Instance . SuppressRule ( tokenRule . GetName ( ) , ruleSuppressions , tokenRule . AnalyzeTokens ( tokens , filePath ) . ToList ( ) ) ;
375
+ diagnostics . AddRange ( records . Item2 ) ;
376
+ suppressed . AddRange ( records . Item1 ) ;
379
377
}
380
378
catch ( Exception tokenRuleException )
381
379
{
@@ -403,10 +401,9 @@ private void AnalyzeFile(string filePath)
403
401
// We want the Engine to continue functioning even if one or more Rules throws an exception
404
402
try
405
403
{
406
- var records = dscResourceRule . AnalyzeDSCClass ( ast , filePath ) . ToList ( ) ;
407
- Helper . Instance . SuppressRule ( dscResourceRule . GetName ( ) , ruleSuppressions , records ) ;
408
- diagnostics . AddRange ( records . Where ( record => record . Suppression == null ) ) ;
409
- suppressed . AddRange ( records . Where ( record => record . Suppression != null ) ) ;
404
+ var records = Helper . Instance . SuppressRule ( dscResourceRule . GetName ( ) , ruleSuppressions , dscResourceRule . AnalyzeDSCClass ( ast , filePath ) . ToList ( ) ) ;
405
+ diagnostics . AddRange ( records . Item2 ) ;
406
+ suppressed . AddRange ( records . Item1 ) ;
410
407
}
411
408
catch ( Exception dscResourceRuleException )
412
409
{
@@ -448,10 +445,9 @@ private void AnalyzeFile(string filePath)
448
445
// We want the Engine to continue functioning even if one or more Rules throws an exception
449
446
try
450
447
{
451
- var records = dscResourceRule . AnalyzeDSCResource ( ast , filePath ) . ToList ( ) ;
452
- Helper . Instance . SuppressRule ( dscResourceRule . GetName ( ) , ruleSuppressions , records ) ;
453
- diagnostics . AddRange ( records . Where ( record => record . Suppression == null ) ) ;
454
- suppressed . AddRange ( records . Where ( record => record . Suppression != null ) ) ;
448
+ var records = Helper . Instance . SuppressRule ( dscResourceRule . GetName ( ) , ruleSuppressions , dscResourceRule . AnalyzeDSCResource ( ast , filePath ) . ToList ( ) ) ;
449
+ diagnostics . AddRange ( records . Item2 ) ;
450
+ suppressed . AddRange ( records . Item1 ) ;
455
451
}
456
452
catch ( Exception dscResourceRuleException )
457
453
{
@@ -509,7 +505,7 @@ private void AnalyzeFile(string filePath)
509
505
//Output through loggers
510
506
foreach ( ILogger logger in ScriptAnalyzer . Instance . Loggers )
511
507
{
512
- if ( ShowSuppressed )
508
+ if ( SuppressedOnly )
513
509
{
514
510
foreach ( DiagnosticRecord suppressRecord in suppressed )
515
511
{
0 commit comments