godotengine / godotengine/godot

Unused class variable warning does not have one for public class variable

Open
#96,155 2 comments 0 reactions 0 assignees View on GitHub
discussion documentation topic:gdscript
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproducible in Godot 4.3.stable

### System information

macOS 13.6.7 (Intel) - Godot v4.3.stable - Vulkan (Mobile)

### Issue description

In 3.5, the Unused Class Variable warning would trigger for unused public and private class member variables. Now in 4.x, this has been renamed to Unused Private Class Variable and only warns for private class variable.

### Steps to reproduce

Turn on warning for Unused Private Class Variable and Unused Variable in Project Settings > Debug > GDScript. Then type in a new script:

```
var some_public_var # This will not have a warning
var _some_private_var # This will have an UNUSED PRIVATE CLASS VARIABLE warning

func _ready():
var some_local_var # This will have an UNUSED VARIABLE warning
```

I apologize if this change was made because unused public class variables are ok to have, but the previous warning was very useful to find class variables I forgot to remove. I am not familiar with other languages to know if this is the convention elsewhere.

### Minimal reproduction project (MRP)

N/A

Contributor guide

Open the contributing guide

Research direction

Reproduce the behavior using Project Settings > Debug > GDScript and the script shown in the issue, comparing public and private class variables. Trace the GDScript warning handling to determine how public class variables should be treated; done means an unused public class variable receives the intended warning without changing the existing private and local variable warnings.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.