@@ -1172,7 +1172,6 @@ public Dictionary<string, List<RuleSuppression>> GetRuleSuppression(Ast ast)
11721172 }
11731173
11741174#if ! PSV3
1175-
11761175 // Get rule suppression from classes
11771176 IEnumerable < TypeDefinitionAst > typeAsts = ast . FindAll ( item => item is TypeDefinitionAst , true ) . Cast < TypeDefinitionAst > ( ) ;
11781177
@@ -1181,7 +1180,14 @@ public Dictionary<string, List<RuleSuppression>> GetRuleSuppression(Ast ast)
11811180 ruleSuppressionList . AddRange ( GetSuppressionsClass ( typeAst ) ) ;
11821181 }
11831182
1184- #endif
1183+ // Get rule suppression from configuration definitions
1184+ IEnumerable < ConfigurationDefinitionAst > configDefAsts = ast . FindAll ( item => item is ConfigurationDefinitionAst , true ) . Cast < ConfigurationDefinitionAst > ( ) ;
1185+
1186+ foreach ( var configDefAst in configDefAsts )
1187+ {
1188+ ruleSuppressionList . AddRange ( GetSuppressionsConfiguration ( configDefAst ) ) ;
1189+ }
1190+ #endif // !PSV3
11851191
11861192 ruleSuppressionList . Sort ( ( item , item2 ) => item . StartOffset . CompareTo ( item2 . StartOffset ) ) ;
11871193
@@ -1199,6 +1205,27 @@ public Dictionary<string, List<RuleSuppression>> GetRuleSuppression(Ast ast)
11991205 return results ;
12001206 }
12011207
1208+ /// <summary>
1209+ /// Returns a list of rule suppressions from the configuration
1210+ /// </summary>
1211+ /// <param name="configDefAst"></param>
1212+ /// <returns></returns>
1213+ internal List < RuleSuppression > GetSuppressionsConfiguration ( ConfigurationDefinitionAst configDefAst )
1214+ {
1215+ var result = new List < RuleSuppression > ( ) ;
1216+ if ( configDefAst == null || configDefAst . Body == null )
1217+ {
1218+ return result ;
1219+ }
1220+ var attributeAsts = configDefAst . FindAll ( x => x is AttributeAst , true ) . Cast < AttributeAst > ( ) ;
1221+ result . AddRange ( RuleSuppression . GetSuppressions (
1222+ attributeAsts ,
1223+ configDefAst . Extent . StartOffset ,
1224+ configDefAst . Extent . EndOffset ,
1225+ configDefAst ) ) ;
1226+ return result ;
1227+ }
1228+
12021229 /// <summary>
12031230 /// Returns a list of rule suppressions from the function
12041231 /// </summary>
0 commit comments