Skip to content

Commit 1eee0cb

Browse files
committed
Fix formatting of shadowed_variable* annotations, fixes #375
1 parent 355dd4b commit 1eee0cb

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
### Changed
99
- Fixed formatting of `@warning_ignore_start` and `@warning_ignore_restore`
10+
- Fixed formatting of `shadowed_variable*` ignore annotations
1011

1112
## [4.3.4] 2025-06-29
1213

gdtoolkit/formatter/annotation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
Unused because not applicable to functions:
2727
- "unused_variable"
2828
- "unused_local_constant"
29-
- "shadowed_variable"
30-
- "shadowed_variable_base_class"
3129
- "missing_tool"
3230
- "empty_file"
3331
- "unused_private_class_variable"
@@ -50,6 +48,10 @@
5048
"unused_parameter",
5149
# A global class or function has the same name as variable.
5250
"shadowed_global_identifier",
51+
# Variable name matches existing name in enclosing scope.
52+
"shadowed_variable",
53+
# Variable name matches existing name in base class.
54+
"shadowed_variable_base_class",
5355
# Code after a return statement.
5456
"unreachable_code",
5557
# Pattern in a match statement after a catch all pattern (wildcard or bind).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@warning_ignore("shadowed_variable")
2+
func foo(id: int, name: String) -> void:
3+
self.id = id
4+
self.name = name
5+
6+
@warning_ignore("shadowed_variable_base_class")
7+
func bar(id: int, name: String) -> void:
8+
self.id = id
9+
self.name = name
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@warning_ignore("shadowed_variable")
2+
func foo(id: int, name: String) -> void:
3+
self.id = id
4+
self.name = name
5+
6+
7+
@warning_ignore("shadowed_variable_base_class")
8+
func bar(id: int, name: String) -> void:
9+
self.id = id
10+
self.name = name

0 commit comments

Comments
 (0)