Skip to content

Commit

Permalink
Make node an optional argument to should_check_rule.
Browse files Browse the repository at this point in the history
Signed-off-by: Danila Fedorin <[email protected]>
  • Loading branch information
DanilaFe committed Oct 26, 2023
1 parent 86cf27a commit 959569a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/chapel-py/chplcheck/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def enable_rules(self, *rules):

self.SilencedRules = list(set(self.SilencedRules) - set(rules))

def _should_check_rule(self, node, rulename):
def _should_check_rule(self,rulename, node = None):
if rulename in self.SilencedRules:
return False

Expand All @@ -85,11 +85,11 @@ def _check_basic_rule(self, context, root, rule):

# If we should ignore the rule no matter the node, no reason to run
# a traversal and match the pattern.
if not self._should_check_rule(None, name):
if not self._should_check_rule(name):
return

for (node, _) in chapel.each_matching(root, nodetype):
if not self._should_check_rule(node, name):
if not self._should_check_rule(name, node):
continue

if not func(context, node):
Expand All @@ -100,7 +100,7 @@ def _check_advanced_rule(self, context, root, rule):

# If we should ignore the rule no matter the node, no reason to run
# a traversal and match the pattern.
if not self._should_check_rule(None, name):
if not self._should_check_rule(name):
return

for node in func(context, root):
Expand Down

0 comments on commit 959569a

Please sign in to comment.