underscore-prefixed-variable-used
What it does
Section titled “What it does”Reports a variable whose name starts with _, which says it is unused, but that is read. No fix.
Why it matters
Section titled “Why it matters”A leading underscore tells the reader that the value is ignored. Reading it breaks that promise, and the next editor may remove the variable or the argument as unused.
To fix, drop the underscore, or stop reading the variable.
Example
Section titled “Example”def a(x, y)... _w = y puts _w xend...Configuration
Section titled “Configuration”ruby: lint: rules: underscore-prefixed-variable-used: warn # off (default), warn, errorEnabled by the presets: ruby/rubocop.
Suppress one line with sudsy-disable-next-line underscore-prefixed-variable-used in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| rubocop | Lint/UnderscorePrefixedVariableName |
full |