GDQuest / GDQuest/GDScript-formatter
Linter: "private-access" incorrectly triggers on access from static context within same class
- Vorherrschende Sprache
- Rust
- Sterne
- 455
- Forks
- 39
- Ø Merge
- 1 T. 15 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
## 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...
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- godot, rust
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 55/100