GDQuest / GDQuest/GDScript-formatter

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

オープン
#269 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る
help wanted
主要言語
Rust
スター
455
フォーク
39
平均マージ
1日 15時間
マージ済み PR(30日)
4

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、issue にある GDScript の例で `private-access` 診断を再現し、次にプライベート変数とメソッドを処理する linter ルールを追跡します。同じクラス内の静的コンテキストがどのように分類されるかを確認します。例で `private-access` 診断が生成されず、クラス外からのアクセスについては引き続きチェックされれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
godot, rust
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。