Skip to main content

SKY-U006 · Dead code

Unused parameter

No severity

Unused-code findings carry no severity in JSON. The terminal report shows them as LOW, SARIF as level note and GitLab as minor. Every unused parameter is capped at confidence 50, below the default threshold of 60, so it is only listed with --confidence 50 or lower.

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
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

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

shop/shipping.py · PythonReported on line 6
"""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

shop/carriers.py · Python
"""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

  1. Runs on every scan of Python code; no flag is needed. Each positional, keyword-only, *args and **kwargs parameter is a definition, except names starting with one underscore (_, _request), which mark a value as deliberately ignored.
  2. Records no parameters for methods of a Protocol class, abstract or @overload methods, methods marked @override, functions defined under if TYPE_CHECKING:, and functions whose body is only a docstring, ..., pass or raise NotImplementedError.
  3. Never reports self and cls, parameters of dunder methods, pytest hook and fixture parameters, Django command handler parameters, FastAPI Depends() and Security() parameters, parameters of known framework hooks such as emit(self, record) on a logging Handler, and parameters of methods in classes named Base*, *Base, *ABC, *Interface or *Adapter.
  4. 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.

shop/shipping.py · Python · the fix, against the flagged file
"""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 def line 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 --confidence at its default of 60 hides every unused parameter too.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.