Missing Annotations — E0001–E0009

Rules that flag code where type information is absent.

All Rules | Next: Type Safety


BSK-0001 — Missing parameter type annotation

Every function parameter must have an explicit type annotation.

# Error
def process(data) -> str:
    return data.upper()

# Correct
def process(data: str) -> str:
    return data.upper()

Real basilisk check output:

basilisk check output reporting BSK-0001 for an unannotated parameter


BSK-0002 — Missing return type annotation

Every function must declare its return type.

# Error
def get_user(user_id: int):
    return {"id": user_id}

# Correct
def get_user(user_id: int) -> dict[str, int]:
    return {"id": user_id}

Real basilisk check output:

basilisk check output reporting BSK-0002 for a missing return type


BSK-0003 — Missing variable type annotation

A module-level variable whose type cannot be inferred — for example an empty collection — must carry an explicit annotation.

# Error — element type cannot be inferred from an empty list
data = []

# Correct
data: list[str] = []

Real basilisk check output:

basilisk check output reporting BSK-0003 for an unannotated empty list


BSK-0004 — Missing *args or **kwargs annotation

Variadic arguments must be annotated.

# Error
def log(*args, **kwargs) -> None:
    print(args, kwargs)

# Correct
def log(*args: str, **kwargs: int) -> None:
    print(args, kwargs)

Real basilisk check output:

basilisk check output reporting BSK-0004 for unannotated *args and **kwargs


BSK-0005 — Missing class attribute annotation

A class attribute whose type cannot be inferred — for example an empty collection — must be explicitly annotated.

# Error — element type cannot be inferred from an empty list
class Registry:
    entries = []

# Correct
class Registry:
    entries: list[str] = []

Real basilisk check output:

basilisk check output reporting BSK-0005 for an unannotated class attribute