Skip to content

Refine list type annotations and enable mypy checks for improved static analysis #1869

@sourcery-ai

Description

@sourcery-ai

There is a suggestion to refine the type annotations for list parameters in several functions (e.g., package_list, repo_list, and tags) to use explicit types such as List[str] or List[dict[str, str]] for improved readability and static analysis. However, these type annotations are currently inconsistent or missing throughout the codebase.

To address this, we should:

  • Audit the relevant files and functions to ensure all list parameters and return types have explicit and correct type annotations.
  • Import the necessary types from the typing module (e.g., List, Dict, Any, etc.).
  • Enable mypy static type checking on the affected files to enforce type safety and catch potential issues.
  • Fix any type errors that arise from enabling mypy.

This will improve code clarity and maintainability, and help catch bugs earlier in development.

Action items:

  1. Update type annotations for all relevant list parameters and return types in the codebase.
  2. Import required types from the typing module.
  3. Enable mypy checks on the affected files.
  4. Fix any type errors reported by mypy.

If possible, please create a dedicated PR for these changes.


I created this issue for @psegedy from #1868 (comment).

Tips and commands

Getting Help

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