Skip to content

Commit 76635b9

Browse files
author
Kapil Borle
committed
Make ast and tokens members of the rule class
1 parent 0ab9182 commit 76635b9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

rules/UseSupportsShouldProcess.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules
2828
#endif
2929
class UseSupportsShouldProcess : ConfigurableRule
3030
{
31+
private Ast ast;
32+
private Token[] tokens;
3133
/// <summary>
3234
/// Analyzes the given ast to find if a function defines Confirm and/or WhatIf parameters manually
3335
/// instead of using SupportShouldProcess attribute.
@@ -43,10 +45,12 @@ public override IEnumerable<DiagnosticRecord> AnalyzeScript(Ast ast, string file
4345
}
4446

4547
// your code goes here
46-
return FindViolations(ast);
48+
this.ast = ast;
49+
this.tokens = Helper.Instance.Tokens;
50+
return FindViolations();
4751
}
4852

49-
private List<DiagnosticRecord> FindViolations(Ast ast)
53+
private List<DiagnosticRecord> FindViolations()
5054
{
5155
var foundAsts = ast.FindAll(x => x is FunctionDefinitionAst, true);
5256
var diagnosticRecords = new List<DiagnosticRecord>();

0 commit comments

Comments
 (0)