unused-block-argument
What it does
Section titled “What it does”Reports a block parameter that the block never reads. Names that start with _ and empty blocks are left alone. No fix.
Why it matters
Section titled “Why it matters”A block parameter that is never read is a value that the block was given for nothing, or a mistake in the block. A leading _ says that it is skipped on purpose, as when a hash is walked for its values only.
To fix, remove the parameter, or prefix its name with _.
Example
Section titled “Example”... xend[1].each { |i| i }[1].each { |i| 1 }def b(*) [1].map { |_v| 1 }end...Configuration
Section titled “Configuration”ruby: lint: rules: unused-block-argument: warn # off (default), warn, errorEnabled by the presets: ruby/rubocop.
Suppress one line with sudsy-disable-next-line unused-block-argument 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/UnusedBlockArgument |
full |