GDQuest / GDQuest/GDScript-formatter

Linter: "private-access" incorrectly triggers on access from static context within same class

Aperta
#269 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub
help wanted
Lingua principale
Rust
Stelle
455
Fork
39
Merge medio
1g 15h
PR unite (30g)
4

Descrizione

## 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...

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
godot, rust
Ambito
tooling
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.