Skip to main content

SKY-T101 · Quality, structure and performance

Missing parameter type annotations

Low

The catalog gives no severity. Every finding is reported LOW.

A type annotation states what a parameter accepts (price: Decimal). SKY-T101 reports a public Python function or method with parameters that have no annotation, but only where the project has asked for annotations: when its own mypy settings require them, or when annotation advice is turned on.

Languages
Python
Turned on by
--quality, when the project's mypy settings require annotations or typing_coverage_advice = true is set under [tool.skylos]
Quality gate
counted toward the gate limits (full and diff scans). When it runs, it is listed and counted toward max_quality. A missing return type on the same function (SKY-T102) is shown in the same entry.
Needs
a mypy policy that requires annotations for the file (disallow_untyped_defs, disallow_incomplete_defs or strict), or typing_coverage_advice = true under [tool.skylos]
Finding type
advice
Catalog name
Missing type annotations
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

A type checker can only check what is annotated. apply_discount("19.99", 10) passes silently through an untyped function and fails at run time, in a project whose mypy settings were meant to catch exactly that.

What Skylos flags

app/pricing.py · PythonReported on line 6
"""Price calculations for the checkout.""" from decimal import Decimal  def apply_discount(price, percent):    return price * (Decimal(100) - percent) / Decimal(100)
pyproject.toml · TOML
[tool.mypy]files = ["app"]disallow_untyped_defs = true

What Skylos leaves alone

app/pricing.py · Python
"""Price calculations for the checkout.""" from decimal import Decimal  def apply_discount(price: Decimal, percent: Decimal) -> Decimal:    return _round_cents(price * (Decimal(100) - percent) / Decimal(100))  def _round_cents(value):    return value.quantize(Decimal("0.01"))

pyproject.toml: same as in the flagged example.

Why Skylos leaves it alone

The public function is fully annotated. The untyped helper's name starts with _, so it is private to the module and Skylos does not report it, although mypy itself would.

How Skylos decides

  1. Runs with --quality, once per Python module. Test code is skipped, and so are examples, benchmarks, a top-level docs folder and the root setup.py unless the mypy policy covers them.
  2. Looks at public functions: module-level functions and methods of module-level classes whose names do not start with _, limited to the names in __all__ when the module has a literal one. self, cls and pytest fixtures are left out, and a # type: comment counts as an annotation.
  3. Reads the project's mypy settings (mypy.ini, .mypy.ini, pyproject.toml, setup.cfg, and mypy commands in pre-commit or tox files). The file must be in the files mypy checks, given by files or a command's targets. disallow_untyped_defs or strict requires annotations on every public function; disallow_incomplete_defs alone only on functions that are already partly annotated.
  4. Without such a requirement it reports nothing, unless typing_coverage_advice = true is set under [tool.skylos]; then it reports functions that are explicitly part of an API, such as names in a literal __all__.
  5. Reports LOW on the def line, naming the untyped parameters.

How to fix it

Annotate every parameter, and the return type, so mypy can check each call.

app/pricing.py · Python · the fix, against the flagged file
"""Price calculations for the checkout.""" from decimal import Decimal  Removed: def apply_discount(price, percent):Added: def apply_discount(price: Decimal, percent: Decimal) -> Decimal:    return price * (Decimal(100) - percent) / Decimal(100)

When it can be wrong

  • It misses untyped private functions (names starting with _) and nested functions, which mypy's disallow_untyped_defs still rejects.
  • A mypy setup Skylos cannot read, such as a command in a Makefile or a CI script, does not count as a policy, so nothing is reported there.

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 def line (the reported line):

    Python
    def apply_discount(price, percent):  # skylos: ignore[SKY-T101] typed in a stub file
  • ignore = ["SKY-T101"] under [tool.skylos] turns the rule off for the project. A baseline accepts existing findings, but it records the absolute file path and the line, so an entry stops matching when the checkout moves or the line shifts.

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