Skip to content

Commit 1558425

Browse files
author
Quoc Truong
committed
Add support for file level suppression
1 parent 75d3557 commit 1558425

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Engine/Helper.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,14 @@ public bool HasSpecialVars(string varName)
615615
public Dictionary<string, List<RuleSuppression>> GetRuleSuppression(Ast ast)
616616
{
617617
List<RuleSuppression> ruleSuppressionList = new List<RuleSuppression>();
618+
619+
ScriptBlockAst sbAst = ast as ScriptBlockAst;
620+
621+
// Get rule suppression from the ast itself if it is scriptblockast
622+
if (sbAst != null && sbAst.ParamBlock != null && sbAst.ParamBlock.Attributes != null)
623+
{
624+
ruleSuppressionList.AddRange(RuleSuppression.GetSuppressions(sbAst.ParamBlock.Attributes, sbAst.Extent.StartOffset, sbAst.Extent.EndOffset));
625+
}
618626

619627
// Get rule suppression from functions
620628
IEnumerable<FunctionDefinitionAst> funcAsts = ast.FindAll(item => item is FunctionDefinitionAst, true).Cast<FunctionDefinitionAst>();

0 commit comments

Comments
 (0)