-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Description
Description
The cover parameter in the test command (defined in cre.py) is currently annotated as:
def test(cover: coverage.Coverage, test_names: List[str]) -> None:However, the cover argument is a boolean flag passed by Click (--cover/--no-cover) and should be annotated as bool.
Steps to Reproduce
- Open
cre.py. - Locate the
testfunction decorated with@app.cli.command(). - Inspect the type annotation for
cover.
Observed Behavior
coveris annotated ascoverage.Coverage.- Static type checkers like
mypymay report a mismatch or misleading type information.
Expected Behavior
covershould be annotated asbool:
def test(cover: bool, test_names: List[str]) -> None:- This matches Click’s boolean flag behavior and passes static type checks.
Additional Context
- The
Coverageobject is correctly created inside the function asCOV = coverage.coverage(...). - Changing the annotation does not affect runtime behavior.
- Improves code clarity, maintainability, and static analysis correctness.
Suggested Fix
- Update the type annotation in
cre.py:
def test(cover: bool, test_names: List[str]) -> None:- Run
mypyto verify no type errors. - Run all other tests to ensure nothing else is broken.
References
- OpenCRE CLI
testcommand: cre.py - Click flags documentation: Boolean Flags
Metadata
Metadata
Assignees
Labels
No labels