Skip to content

Rule: @warning_ignore with a name Godot does not know #7

Description

@eth0net

Where it is written

https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/warning_system.html

The names of the warnings to ignore match the names of the project settings. For example, to ignore the warning configured by the debug/gdscript/warnings/unused_variable project setting, use @warning_ignore("unused_variable").

What it would report

@warning_ignore("not_a_real_warning_name")
var y: int = 0

A name that matches no warning silently suppresses nothing. The author believes
a warning is handled; it is not, and no diagnostic says so. gdck check
reports the file clean today.

Same silent-failure shape as #3 — an annotation that looks right, does nothing,
and is never complained about.

Applies to @warning_ignore, @warning_ignore_start and
@warning_ignore_restore.

Could it be fixed automatically?

Only when the name is a near-miss of a real one, and even then it is a
suggestion rather than a fix the author did not choose. Report only.

Where it would be wrong

This one carries a maintenance cost rather than a false-positive risk: it needs
the list of valid warning names, that list is Godot's and moves between
versions, and a project on a newer Godot than the list would see correct code
reported. That is worse than saying nothing.

So it only makes sense with a decision about where the list comes from and what
happens when it is out of date — erring toward silence on an unknown name is
not an option, since an unknown name is the whole point of the rule. Possibly
the list belongs behind a configured Godot version, defaulting to the newest
gdck knows and reporting nothing if the project declares something newer.

Lower priority than #3 for that reason.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleA lint rule the style guide asks for

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions