Skip to main content
Sometimes a diagnostic fires on a line that is actually correct. Instead of weakening the rule globally, you can suppress that single finding with an inline comment. The rest of your codebase keeps the protection, and readers can see exactly why the exception exists.

Suppression comment syntax

GLua recognizes several suppression styles in Lua comments. Suppressions take a diagnostic code — the kebab-case name shown in the Problems panel, such as unused-local. That is not the same as the camelCase settings key (unusedLocal) you would use in .glua.json. See the rule reference for both names.

Suppressions that do nothing

A suppression outlives the finding it was written for: the code gets fixed, the comment stays, and from then on it silently covers whatever appears on that line next. unused-suppression reports the ones that never silenced anything.
Write the code, not the settings key: unusedLocal where unused-local belonged is not a rule name, so it silences nothing. It is reported rather than quietly ignored, because a mistake here used to look like working protection.
A bare -- glua-ignore followed by prose still means “everything on the next line”, so an explanation after the directive is fine:

When to use suppressions

If an entire path (like lua/vendor/**) triggers the same diagnostic, prefer a config file override in .glua.json instead of scattering suppression comments.
Suppress the specific rule name when possible. Avoid -- glua-ignore without a rule name because it silences every diagnostic on that line and can hide real problems.

Not a suppression: -- glua-format-ignore

These comments silence diagnostics. The formatter has its own directive, -- glua-format-ignore, which leaves the statement below it exactly as written. They are unrelated: suppressing a rule does not stop the formatter, and a format-ignore does not silence anything.