SKY-U006 · Dead code
Unused parameter
A function parameter that the function body never reads. Callers still have to pass a value for it, but the value changes nothing.
- Languages
- Python
- Turned on by
skylos . --confidence 50(a default scan holds unused parameters back and says how many)- Quality gate
- counted toward the gate limits (full and diff scans). Counts toward
max_dead_code, which has no limit by default. At the default threshold no parameter is listed, so none is counted. - Finding type
- review
Why it matters
An ignored parameter often means a missing feature: in the example below callers ask for express shipping and are charged the normal rate. It also keeps a misleading argument alive at every call site.
What Skylos flags
"""Shipping cost rules.""" RATES = {"DE": 4.5, "FR": 5.0, "US": 12.0} def shipping_cost(weight_kg, country, express): rate = RATES.get(country, 9.99) return round(rate * weight_kg, 2)What Skylos leaves alone
"""Carrier price quotes.""" RATES = {"DE": 4.5, "FR": 5.0, "US": 12.0} class Carrier: def quote(self, weight_kg, country, express): raise NotImplementedError class PostalCarrier(Carrier): def quote(self, weight_kg, country, express): rate = RATES.get(country, 9.99) * weight_kg if express: rate += 15 return round(rate, 2)Why Skylos leaves it alone
Carrier.quote only raises NotImplementedError: it declares the signature that subclasses implement, so its parameters are not definitions at all. The subclass reads all three.
How Skylos decides
- Runs on every scan of Python code; no flag is needed. Each positional, keyword-only,
*argsand**kwargsparameter is a definition, except names starting with one underscore (_,_request), which mark a value as deliberately ignored. - Records no parameters for methods of a
Protocolclass, abstract or@overloadmethods, methods marked@override, functions defined underif TYPE_CHECKING:, and functions whose body is only a docstring,...,passorraise NotImplementedError. - Never reports
selfandcls, parameters of dunder methods, pytest hook and fixture parameters, Django command handler parameters, FastAPIDepends()andSecurity()parameters, parameters of known framework hooks such asemit(self, record)on a loggingHandler, and parameters of methods in classes namedBase*,*Base,*ABC,*Interfaceor*Adapter. - Skips test, example and benchmark paths and lines marked
# skylos: ignore[SKY-U006], then caps every remaining parameter at confidence 50, because a callback or override protocol can require it. With the default threshold of 60 none is listed and the summary says how many were held back.
How to fix it
Use the parameter, or remove it from the function and its callers. If a caller's signature requires it (a callback, a framework hook), rename it with a leading underscore, such as _express, to say it is ignored on purpose.
"""Shipping cost rules.""" RATES = {"DE": 4.5, "FR": 5.0, "US": 12.0} def shipping_cost(weight_kg, country, express):Removed: rate = RATES.get(country, 9.99)Removed: return round(rate * weight_kg, 2)Added: rate = RATES.get(country, 9.99) * weight_kgAdded: if express:Added: rate += 15Added: return round(rate, 2)When it can be wrong
- Callback parameters that a library passes positionally, such as
def on_message(client, userdata, message), are reported when the body ignores some of them; rename them with a leading underscore. - Unused parameters in TypeScript, JavaScript and other languages are not reported.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
On the line that holds the parameter (the
defline for a one-line signature), with a reason:Python def shipping_cost(weight_kg, country, express): # skylos: ignore[SKY-U006] v2 API[tool.skylos] ignore = ["SKY-U006"]turns the rule off for the project. Leaving--confidenceat its default of 60 hides every unused parameter too.