Skip to content

Fix 671 pre-existing mypy type errors #245

Description

@anchapin

Summary

The codebase has 671 mypy type checking errors that are pre-existing in the main branch. These errors are blocking the CI Type Check job.

Current Status

  • Lint: ✅ Passing
  • Type Check: ❌ 671 errors
  • E2E Tests: ✅ Passing
  • Security Scan: ✅ Passing

Error Categories

The main categories of errors include:

  1. Invalid base class "Base" - Many SQLAlchemy models have issues with not being recognized as a valid type (valid-type, misc errors)
  2. Union attribute errors - Optional types having None checks but still accessed without proper handling (union-attr)
  3. Name redefinitions - Properties defined multiple times (no-redef)
  4. Missing type stubs - Third-party libraries without type stubs (import-untyped)
  5. Assignment type mismatches - Incompatible types in assignment (assignment)

Files with Most Errors

    • Multiple Base class issues
    • Multiple Base class issues
    • Multiple issues
    • Base class issues
    • Base class issues
    • Union attribute errors
    • Type assignment issues
    • Missing stubs and type issues

Recommendation

These errors have likely accumulated over time and should be addressed systematically. Options include:

  1. Fix incrementally - Address errors file by file
  2. Add to ignore list - Add pre-existing errors to mypy ignore list in pyproject.toml (like we did for lint)
  3. Enable strict mode gradually - Consider enabling stricter mypy settings incrementally

Verification

Run locally with:

mypy src/ --config-file=pyproject.toml

See CI run for current status: https://github.com/anchapin/ArbitrageAI/actions/runs/22770689934

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions