Skip to content

Commit 260f4f4

Browse files
authored
fix: Fix unused-variable reported on the FOR loop variable with type (#1706)
1 parent 7a542ef commit 260f4f4

14 files changed

Lines changed: 15 additions & 17 deletions

File tree

docs/releasenotes/8.0.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
```
4444
Found 1 issue.
45-
1 fixable with the ``--fix`` option.
45+
1 fixable with the '--fix' option.
4646
```
4747

4848
Currently, I have added a few new rules with fixes and implemented fix for a few old rules.

src/robocop/linter/reports/print_issues.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def print_run_summary(self, diagnostics: Diagnostics, run_stats: RunStatistic) -
291291
summary = f"Found {len(diagnostics.diagnostics)} issue{suffix}."
292292
could_fix = len(diagnostics.fixable_diagnostics())
293293
if could_fix > 0:
294-
summary += f"\n{could_fix} fixable with the ``--fix`` option."
294+
summary += f"\n{could_fix} fixable with the '--fix' option."
295295
self.console.print(summary)
296296

297297
def _print_diffs(self, modified_files: list[SourceFile]) -> None:

src/robocop/linter/rules/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ def visit_For(self, node: For) -> None: # noqa: N802
14601460
for token in node.header.get_tokens(Token.ARGUMENT, "OPTION"): # Token.Option does not exist for RF3 and RF4
14611461
self.find_not_nested_variable(token.value, can_be_escaped=False)
14621462
for token in node.header.get_tokens(Token.VARIABLE):
1463-
self.handle_assign_variable(token, ignore_var_conversion=False)
1463+
self.handle_assign_variable(token)
14641464
self.generic_visit(node)
14651465
self.ignore_overwriting = False
14661466
self.in_loop = False

tests/cache/test_cache_integration.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,12 @@ def test_cache_with_fixable_rule(self, tmp_path, capsys):
278278
# Assert - first run not yet cached, all issues
279279
assert "Used cached results" not in out1
280280
assert len(result1) == 3
281-
assert "1 fixable with the ``--fix`` option." in out1
281+
assert "1 fixable with the '--fix' option." in out1
282282

283283
# Assert - second run cached, all issues
284284
assert "Used cached results" in out2
285285
assert len(result2) == 3
286-
assert "1 fixable with the ``--fix`` option." in out2
286+
assert "1 fixable with the '--fix' option." in out2
287287

288288
# Assert - third run not cached, only unfixable issues in results (fixable goes to diff)
289289
assert "Used cached results" not in out3 # we didn't use cache since we generated diff
@@ -293,7 +293,7 @@ def test_cache_with_fixable_rule(self, tmp_path, capsys):
293293
# Assert - fourth run cached, all issues (no changes from diff)
294294
assert "Used cached results" in out4
295295
assert len(result4) == 3
296-
assert "1 fixable with the ``--fix`` option." in out4
296+
assert "1 fixable with the '--fix' option." in out4
297297

298298
# Assert - fifth run not cached, only unfixable issues in results (fixable are fixed)
299299
assert "Used cached results" not in out5
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
test.robot:2:1 [W] DEPR07 'Force Tags' is deprecated, use 'Test Tags' instead
22

33
Found 1 issue.
4-
1 fixable with the ``--fix`` option.
4+
1 fixable with the '--fix' option.

tests/linter/rules/deprecated/deprecated_force_tags/expected_output_extended.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ test.robot:2:1 DEPR07 'Force Tags' is deprecated, use 'Test Tags' instead
66
|
77

88
Found 1 issue.
9-
1 fixable with the ``--fix`` option.
9+
1 fixable with the '--fix' option.

tests/linter/rules/deprecated/deprecated_return_keyword/expected_extended.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ test.robot:4:5 DEPR10 'BuiltIn.Return From Keyword' is deprecated, use 'RETURN'
1818
|
1919

2020
Found 2 issues.
21-
2 fixable with the ``--fix`` option.
21+
2 fixable with the '--fix' option.

tests/linter/rules/deprecated/deprecated_return_keyword/expected_output.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ test.robot:3:5 [W] DEPR10 'Return From Keyword If' is deprecated, use 'IF and RE
22
test.robot:4:5 [W] DEPR10 'BuiltIn.Return From Keyword' is deprecated, use 'RETURN' instead
33

44
Found 2 issues.
5-
2 fixable with the ``--fix`` option.
5+
2 fixable with the '--fix' option.

tests/linter/rules/deprecated/deprecated_return_setting/expected_extended.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,4 @@ test_fix.robot:60:5 DEPR11 '[Return]' is deprecated, use 'RETURN' instead
7272
|
7373

7474
Found 8 issues.
75-
8 fixable with the ``--fix`` option.
75+
8 fixable with the '--fix' option.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
test.robot:6:5 [W] DEPR11 '[Return]' is deprecated, use 'RETURN' instead
22

33
Found 1 issue.
4-
1 fixable with the ``--fix`` option.
4+
1 fixable with the '--fix' option.

0 commit comments

Comments
 (0)