Summary
Module Explorer counts valid Enum/StrEnum members as untyped because they do not have explicit annotations. However, PEP 435 enum members are inferred from their assignments and must be left unannotated. Basilisk's own enums_members diagnostic correctly rejects the annotation that would otherwise satisfy the coverage metric.
This makes the type-coverage percentage impossible to reach 100% in projects that use enums correctly.
Minimal reproduction
from enum import StrEnum
class Status(StrEnum):
ACTIVE = "active"
INACTIVE = "inactive"
Steps to reproduce
- Open the file in a Basilisk workspace.
-
- Run
basilisk check — it passes.
-
- Expand the module and
Status in Module Explorer.
-
- Observe that
ACTIVE and INACTIVE are labeled untyped and reduce the module/workspace coverage percentage.
-
- Attempt to add an explicit annotation:
class Status(StrEnum):
ACTIVE: str = "active"
- Run
basilisk check again.
Actual behavior
The valid plain enum members are counted as untyped. Adding an annotation produces the expected error:
error[enums_members]: Enum member `ACTIVE` in `Status` should not have an explicit type annotation
The diagnostic correctly notes that enum members have an inferred Literal[Status.ACTIVE] type.
Expected behavior
Enum members should either:
- Count as typed using their inferred
Literal[EnumClass.MEMBER] type, or
-
- Be excluded from the explicit-annotation coverage denominator.
The coverage metric should not require syntax that the type specification and Basilisk itself prohibit.
Impact
In a real Python 3.12 project, Module Explorer reports 33 enum members as untyped across otherwise fully annotated modules. This lowers raw workspace coverage and forces downstream coverage gates to special-case enum members.
Environment
- Basilisk / VS Code extension: 0.38.0
-
-
Summary
Module Explorer counts valid
Enum/StrEnummembers as untyped because they do not have explicit annotations. However, PEP 435 enum members are inferred from their assignments and must be left unannotated. Basilisk's ownenums_membersdiagnostic correctly rejects the annotation that would otherwise satisfy the coverage metric.This makes the type-coverage percentage impossible to reach 100% in projects that use enums correctly.
Minimal reproduction
Steps to reproduce
basilisk check— it passes.Statusin Module Explorer.ACTIVEandINACTIVEare labeleduntypedand reduce the module/workspace coverage percentage.basilisk checkagain.Actual behavior
The valid plain enum members are counted as untyped. Adding an annotation produces the expected error:
The diagnostic correctly notes that enum members have an inferred
Literal[Status.ACTIVE]type.Expected behavior
Enum members should either:
Literal[EnumClass.MEMBER]type, orThe coverage metric should not require syntax that the type specification and Basilisk itself prohibit.
Impact
In a real Python 3.12 project, Module Explorer reports 33 enum members as untyped across otherwise fully annotated modules. This lowers raw workspace coverage and forces downstream coverage gates to special-case enum members.
Environment