SKY-E002 · Dead code
Empty file
A Python file with no code at all, or with nothing but a docstring. Such files are usually left behind when code moves elsewhere.
- Languages
- Python
- Turned on by
skylos .(every scan)- Quality gate
- counted toward the gate limits (full and diff scans). Counts toward
max_dead_code, which has no limit by default, so it only fails a gate where you set one. - Finding type
- review
Why it matters
An empty module still imports without error, so nothing breaks and nobody notices it. Readers open it looking for the helpers its name promises, and new code may be added to the stale location.
What Skylos flags
"""Shared helpers for the billing app."""What Skylos leaves alone
"""Billing: invoices, payments and refunds."""def invoice_total(lines): return sum(line.amount for line in lines)Why Skylos leaves it alone
__init__.py marks billing as a package, so it may be empty or hold only the package docstring. Skylos also skips __main__.py and main.py.
How Skylos decides
- Runs in every scan, with no extra flag, on Python files that parse.
- Reports a file whose module body is empty (only comments, blank lines or nothing) or holds exactly one statement that is a string, the docstring.
- Skips files named
__init__.py,__main__.pyandmain.py, and, in a Django project, anadmin.pynext to the app's__init__.py. - Does not check whether other files import the module. Reports LOW on line 1, in the
unused_fileslist of the JSON output.
How to fix it
Delete the file, and remove any import of it. If the module is a planned home for new code, add that code, or say so in the docstring and suppress the finding.
When it can be wrong
- A deliberately empty module that other code imports, such as a settings override that is empty in the default configuration, is 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
[tool.skylos] ignore = ["SKY-E002"]turns the rule off for the project.An inline marker does not work for this rule: a
# skylos: ignore[SKY-E002](or a bare# skylos: ignore) on line 1 of the file is not read, and the file is still reported. Use the project setting above, or exclude the folder from the scan.