Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning for unused variables in class. #5782

Open
FracturedRodey opened this issue Nov 14, 2022 · 5 comments
Open

Warning for unused variables in class. #5782

FracturedRodey opened this issue Nov 14, 2022 · 5 comments

Comments

@FracturedRodey
Copy link

Describe the project you are working on

A 2D Game

Describe the problem or limitation you are having in your project

I want to know what variables are unused in my class. Using CTRL F for searching at the moment.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

See above

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Show a warning ala IntelliJ or something when the variable is never used.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Not sure if this can be done, no extension found.

Is there a reason why this should be core and not an add-on in the asset library?

It is an oveall improvement for every project.

@Mickeon
Copy link

Mickeon commented Nov 14, 2022

I am assuming that this Proposal refers to the properties created outside of method definitions.
I suppose it can be done, kinda. One unique thing with Godot's Objects is that you can dynamically call, set, get properties without even referring to them directly. So the warning may yield some false-positives.

This makes total sense for variables existing in a limited scope, however.

@TheDuriel
Copy link

Go to your project settings, gdscript, warnings, and enable said warning.

@Mickeon
Copy link

Mickeon commented Nov 14, 2022

There it is, then. This is no issue then, I gather?
image

Although, admittedly, discovering the warnings is a bit difficult, so I can understand this being missed.

@KoBeWi
Copy link
Member

KoBeWi commented Nov 14, 2022

It's enabled by default tho.

@Calinou
Copy link
Member

Calinou commented Nov 14, 2022

See godotengine/godot#23207.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants