From a0210f2b398c35a959be7497226d599a837a81bb Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Tue, 10 Sep 2024 16:46:56 -0700 Subject: [PATCH 1/3] use the subject node for locations Signed-off-by: Jade Abraham --- tools/chplcheck/src/rules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/chplcheck/src/rules.py b/tools/chplcheck/src/rules.py index 1bca2af9d86b..4bd42fe035f7 100644 --- a/tools/chplcheck/src/rules.py +++ b/tools/chplcheck/src/rules.py @@ -279,7 +279,7 @@ def ControlFlowParentheses( # Now, we should warn: there's a node in a conditional or # if/else, it has parentheses at the top level, but it doesn't need them. - return BasicRuleResult(node, data=subject) + return BasicRuleResult(subject, data=subject) @driver.fixit(ControlFlowParentheses) def RemoveControlFlowParentheses(context: Context, result: BasicRuleResult): From c38bb38c318573649ce182a0c60eb7298b4070fa Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Tue, 10 Sep 2024 16:47:05 -0700 Subject: [PATCH 2/3] fix basic rule check Signed-off-by: Jade Abraham --- tools/chplcheck/src/rule_types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/chplcheck/src/rule_types.py b/tools/chplcheck/src/rule_types.py index 18fd1ff67192..5e1557125dfe 100644 --- a/tools/chplcheck/src/rule_types.py +++ b/tools/chplcheck/src/rule_types.py @@ -226,7 +226,7 @@ def _check_single( # addition to the fixits in the result itself) # add the fixits from the hooks to the fixits from the rule fixits = self.run_fixit_hooks(context, result) + fixits - return (node, self.name, fixits) + return (result.node, self.name, fixits) def check( self, context: chapel.Context, root: chapel.AstNode From 77a7d5821aded4a07958235ab397163a397f2e84 Mon Sep 17 00:00:00 2001 From: Jade Abraham Date: Wed, 11 Sep 2024 09:40:27 -0700 Subject: [PATCH 3/3] fix spelling Signed-off-by: Jade Abraham --- tools/chplcheck/src/rules.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/chplcheck/src/rules.py b/tools/chplcheck/src/rules.py index 4bd42fe035f7..7ff472f6e080 100644 --- a/tools/chplcheck/src/rules.py +++ b/tools/chplcheck/src/rules.py @@ -289,7 +289,7 @@ def RemoveControlFlowParentheses(context: Context, result: BasicRuleResult): paren_loc = subject.parenth_location() assert paren_loc - # If parentheeses span multiple lines, don't provide a fixit, + # If parentheses span multiple lines, don't provide a fixit, # since the indentation would need more thought. start_line, start_col = paren_loc.start() end_line, end_col = paren_loc.end()