SKY-T101 · Quality, structure and performance
Missing parameter type annotations
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 ortyping_coverage_advice = trueis 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_defsorstrict), ortyping_coverage_advice = trueunder[tool.skylos] - Finding type
- advice
- Catalog name
- Missing type annotations
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
"""Price calculations for the checkout.""" from decimal import Decimal def apply_discount(price, percent): return price * (Decimal(100) - percent) / Decimal(100)[tool.mypy]files = ["app"]disallow_untyped_defs = trueWhat Skylos leaves alone
"""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"))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
- Runs with
--quality, once per Python module. Test code is skipped, and so are examples, benchmarks, a top-leveldocsfolder and the rootsetup.pyunless the mypy policy covers them. - 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,clsand pytest fixtures are left out, and a# type:comment counts as an annotation. - 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 byfilesor a command's targets.disallow_untyped_defsorstrictrequires annotations on every public function;disallow_incomplete_defsalone only on functions that are already partly annotated. - Without such a requirement it reports nothing, unless
typing_coverage_advice = trueis set under[tool.skylos]; then it reports functions that are explicitly part of an API, such as names in a literal__all__. - Reports LOW on the
defline, naming the untyped parameters.
How to fix it
Annotate every parameter, and the return type, so mypy can check each call.
"""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'sdisallow_untyped_defsstill 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
defline (the reported line):Python def apply_discount(price, percent): # skylos: ignore[SKY-T101] typed in a stub fileignore = ["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.