Skip to content

no-unused-underscored-keyword-parameter

Remove unused underscore-prefixed keyword-only parameters instead of hiding them from lint.

Why

A keyword-only parameter requires callers to use its declared name. Prefixing an unused input with an underscore silences unused-argument lint while retaining an input whose value has no effect. Removing the dead input and its callers keeps the callable's interface honest.

Fix

Remove the unused keyword-only parameter and update callers together. If an external contract requires the input, preserve its required spelling and use a narrow, reasoned unused-argument suppression. Do not erase a precise callback signature with **kwargs or add dummy reads to silence this warning.

Examples

Before — flagged A private helper's unused singleton keyword has no contract or retained value
app/sink.py
def _emit(*, _unused: bool = True):
return "ready"
_emit()
_emit(_unused=False)
After — preferred The callable exposes only inputs it uses
app/sink.py
def emit():
return "ready"