Skip to main content

SKY-R101 · Quality, structure and performance

Python type-check policy

Medium

A type checker (mypy or pyright) reads type annotations and catches calls with the wrong kind of value before the code runs. SKY-R101 reports a repository that contains Python code but has no mypy or pyright configuration.

Languages
Python
Quality gate
counted toward the gate limits (full and diff scans). Advice that is measured on every --quality scan but not listed by default. It is listed, and counted toward max_quality, with --all-advice or when the rule is named in [tool.skylos.gate] rules. A diff scan checks it only when the change touches a policy file such as pyproject.toml.
Finding type
advice
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Without a configured checker, annotations are only comments: nothing stops a change that passes a string where a number is expected, and each developer runs a different check, or none, before pushing.

What Skylos flags

pyproject.toml · TOMLReported on line 1
[project]name = "shop"version = "1.0.0" [tool.ruff]line-length = 88
app/pricing.py · Python
"""Price helpers."""  def total(prices: list[float]) -> float:    return sum(prices)

What Skylos leaves alone

pyproject.toml: same as in the flagged example.

pyrightconfig.json · JSON
{  "include": ["app"],  "typeCheckingMode": "strict"}

app/pricing.py: same as in the flagged example.

Why Skylos leaves it alone

The type checker is configured in pyrightconfig.json instead of pyproject.toml. Skylos looks in every usual place, so the project has a type-check policy.

How Skylos decides

  1. Runs with --quality, once per scanned project. A diff scan runs it only when a policy file (such as pyproject.toml, setup.cfg, mypy.ini or pyrightconfig.json) is among the changed files.
  2. Checks that the project has at least one .py, .pyi or .pyw file, leaving out excluded folders and virtual environments.
  3. Looks for a type-checker policy at the project root: [tool.mypy] or [tool.pyright] in pyproject.toml, a mypy.ini file, a [mypy] section in .mypy.ini or setup.cfg, or a pyrightconfig.json file.
  4. When none exists, reports MEDIUM on line 1 of pyproject.toml, or on the project folder when there is no pyproject.toml.

How to fix it

Add a mypy or pyright configuration and run it in CI. Starting with the folders you control is fine; files says which code mypy checks.

pyproject.toml · TOML · the fix, against the flagged file
[project]name = "shop"version = "1.0.0" [tool.ruff]line-length = 88Added:  Added: [tool.mypy]Added: files = ["app"]Added: disallow_untyped_defs = true

When it can be wrong

  • A type checker configured only on the command line, in a Makefile or in a CI file, is not seen, so the project is reported.
  • A repository with only a few helper scripts in Python is reported like a Python application.

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

  • An inline marker in pyproject.toml does not work: with this comment on the reported line, the finding stays.

    TOML
    [project]  # skylos: ignore[SKY-R101] checked by pyright in CI
  • ignore = ["SKY-R101"] under [tool.skylos] turns the check off.

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