GDQuest / GDQuest/GDScript-formatter
Linter: "private-access" incorrectly triggers on access from static context within same class
- Dominant language
- Rust
- Stars
- 455
- Forks
- 39
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 4
Description
## Description
The rule `private-access` is triggered when accessing a private instance member from a static context within the same class. See the example below.
The rule message is "... should not be accessed *from outside its class*" which let me think this is not intentional and is a bug.
## Reproduce
```gdscript
class_name Foo
var _data: int
func _method() -> void:
pass
static func do(foo: Foo) -> void:
foo._data = 0
foo._method()
```
## Expected behaviour
No linter rule triggered.
## Observed behaviour
The above example triggers :
`[private-access] Private variable '_data' should not be accessed from outside its class`
`[private-access] Private method '_method' should not be accessed from outside its class`
But this is not an access from outside the class...
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the `private-access` diagnostics with the GDScript example in the issue, then trace the linter rule that handles private variables and methods. Verify how static context within the same class is classified. Done means the example produces no `private-access` diagnostics while accesses from outside the class remain checked.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- godot, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100