Skip to content

Enable and Fix Mypy Type Checking #162

@sergyDwhiz

Description

@sergyDwhiz

Mypy is configured in pyproject.toml and an improvement plan exists in MYPY_IMPROVEMENT_PLAN.md, but type checking is currently disabled in CI due to multiple type errors. This issue tracks the work needed to fix the existing errors and re-enable mypy in the CI pipeline.

Current Status

  • Mypy configuration exists and is valid.
  • CI integration is commented out.
  • Approximately 45 type errors are reported when running mypy manually.

Common issue categories:

  • Tests accessing attributes on possibly None values
  • Missing type hints on function parameters
  • Type inconsistencies in certain management commands
  • Miscellaneous small annotation and narrowing issues

Proposed Approach

  • Resolve the simpler errors (primarily in tests and management commands).
  • Address the remaining type errors across the codebase.
  • Lastly, re-enable mypy in CI, ensuring type checking becomes part of the standard workflow.

To view the current errors locally: run cd app && python3 -m mypy reviews --config-file=../pyproject.toml
This work should not affect runtime behavior; all changes will be confined to type hints and related adjustments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions