Summary
Audit and eliminate all # type: ignore comments across the codebase by properly typing the underlying values. Currently there are ~50+ type: ignore comments, most due to:
-
Original function ClassVars typed as Any: Every plugin stores intercepted function references as ClassVar[Any]. When these are called in _GuardPassThrough handlers or deactivate() restores, mypy can't verify return types.
-
Method assignment ignores: Patching class methods with setattr or direct assignment triggers [method-assign] or [assignment] errors.
-
Untyped library stubs: Some dependencies lack type stubs (celery, botocore, paramiko, pika, cffi, grpc, pymemcache).
Proposed Approach
Original function ClassVars (highest impact)
Replace ClassVar[Any] with properly typed ClassVar[Callable[..., ReturnType] | None]:
# Before:
_original_connect: ClassVar[Any] = None
# After:
_original_connect: ClassVar[Callable[[socket.socket, tuple[str, int]], None] | None] = None
This eliminates no-any-return and ANN401 errors in one pass.
Method assignment
Use typing.cast or protocol types to satisfy mypy when assigning patched methods to class attributes.
Untyped libraries
Keep per-module ignore_missing_imports overrides in pyproject.toml (already configured). These can't be fixed without upstream stubs.
Scope
- All
src/bigfoot/plugins/*.py files
src/bigfoot/_context.py, src/bigfoot/_verifier.py
- Goal: zero
type: ignore comments that can be eliminated with proper typing
- Keep only genuinely unavoidable ignores (untyped 3rd-party libs, dynamic method patching where no Protocol can help)
Success Criteria
uv run mypy src/bigfoot/ reports 0 errors (or only untyped-library errors)
- No
# type: ignore[no-any-return] comments remain
- No
# type: ignore[assignment] comments that could be replaced with proper typing
- All existing tests still pass
Summary
Audit and eliminate all
# type: ignorecomments across the codebase by properly typing the underlying values. Currently there are ~50+type: ignorecomments, most due to:Original function ClassVars typed as
Any: Every plugin stores intercepted function references asClassVar[Any]. When these are called in_GuardPassThroughhandlers ordeactivate()restores, mypy can't verify return types.Method assignment ignores: Patching class methods with
setattror direct assignment triggers[method-assign]or[assignment]errors.Untyped library stubs: Some dependencies lack type stubs (celery, botocore, paramiko, pika, cffi, grpc, pymemcache).
Proposed Approach
Original function ClassVars (highest impact)
Replace
ClassVar[Any]with properly typedClassVar[Callable[..., ReturnType] | None]:This eliminates
no-any-returnandANN401errors in one pass.Method assignment
Use
typing.castor protocol types to satisfy mypy when assigning patched methods to class attributes.Untyped libraries
Keep per-module
ignore_missing_importsoverrides in pyproject.toml (already configured). These can't be fixed without upstream stubs.Scope
src/bigfoot/plugins/*.pyfilessrc/bigfoot/_context.py,src/bigfoot/_verifier.pytype: ignorecomments that can be eliminated with proper typingSuccess Criteria
uv run mypy src/bigfoot/reports 0 errors (or only untyped-library errors)# type: ignore[no-any-return]comments remain# type: ignore[assignment]comments that could be replaced with proper typing