@@ -104,12 +104,12 @@ public SwitchParameter Recurse
104104 /// </summary>
105105 [ Parameter ( Mandatory = false ) ]
106106 [ SuppressMessage ( "Microsoft.Performance" , "CA1819:PropertiesShouldNotReturnArrays" ) ]
107- public SwitchParameter ShowSuppressed
107+ public SwitchParameter SuppressedOnly
108108 {
109- get { return showSuppressed ; }
110- set { showSuppressed = value ; }
109+ get { return suppressedOnly ; }
110+ set { suppressedOnly = value ; }
111111 }
112- private bool showSuppressed ;
112+ private bool suppressedOnly ;
113113
114114 #endregion Parameters
115115
@@ -268,7 +268,7 @@ private void AnalyzeFile(string filePath)
268268 Token [ ] tokens = null ;
269269 ParseError [ ] errors = null ;
270270 List < DiagnosticRecord > diagnostics = new List < DiagnosticRecord > ( ) ;
271- List < DiagnosticRecord > suppressed = new List < DiagnosticRecord > ( ) ;
271+ List < SuppressedRecord > suppressed = new List < SuppressedRecord > ( ) ;
272272
273273 // Use a List of KVP rather than dictionary, since for a script containing inline functions with same signature, keys clash
274274 List < KeyValuePair < CommandInfo , IScriptExtent > > cmdInfoTable = new List < KeyValuePair < CommandInfo , IScriptExtent > > ( ) ;
@@ -341,10 +341,9 @@ private void AnalyzeFile(string filePath)
341341 // We want the Engine to continue functioning even if one or more Rules throws an exception
342342 try
343343 {
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 ) ;
348347 }
349348 catch ( Exception scriptRuleException )
350349 {
@@ -372,10 +371,9 @@ private void AnalyzeFile(string filePath)
372371 // We want the Engine to continue functioning even if one or more Rules throws an exception
373372 try
374373 {
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 ) ;
379377 }
380378 catch ( Exception tokenRuleException )
381379 {
@@ -403,10 +401,9 @@ private void AnalyzeFile(string filePath)
403401 // We want the Engine to continue functioning even if one or more Rules throws an exception
404402 try
405403 {
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 ) ;
410407 }
411408 catch ( Exception dscResourceRuleException )
412409 {
@@ -448,10 +445,9 @@ private void AnalyzeFile(string filePath)
448445 // We want the Engine to continue functioning even if one or more Rules throws an exception
449446 try
450447 {
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 ) ;
455451 }
456452 catch ( Exception dscResourceRuleException )
457453 {
@@ -509,7 +505,7 @@ private void AnalyzeFile(string filePath)
509505 //Output through loggers
510506 foreach ( ILogger logger in ScriptAnalyzer . Instance . Loggers )
511507 {
512- if ( ShowSuppressed )
508+ if ( SuppressedOnly )
513509 {
514510 foreach ( DiagnosticRecord suppressRecord in suppressed )
515511 {
0 commit comments