Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions gdtoolkit/formatter/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
Unused because not applicable to functions:
- "unused_variable"
- "unused_local_constant"
- "shadowed_variable"
- "shadowed_variable_base_class"
- "missing_tool"
- "empty_file"
- "unused_private_class_variable"
Expand All @@ -39,6 +37,10 @@
- "function_used_as_property"
"""
_NON_STANDALONE_WARNING_IGNORES = [
# Variable name matches existing name in enclosing scope
"shadowed_variable",
# Variable name matches existing name in base class
"shadowed_variable_base_class",
# Variable used but never assigned.
"unassigned_variable",
# Variable never assigned but used in an assignment operation (+=, *=, etc).
Expand Down
9 changes: 9 additions & 0 deletions tests/formatter/test_function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest

from .common import format_and_compare


def test_ignore_shadowed_annotation_separated_from_func():
input_code = "\n".join(['@warning_ignore("shadowed_variable")', "func f():", "\tpass"])
expected_output_code = input_code + "\n"
format_and_compare(input_code, expected_output_code)
Loading