Skip to content

Conversation

@Pennycook
Copy link
Contributor

Related issues

Proposed changes

  • Fix errors reported by mypy due to broken or inconsistent type hints.
  • Fix a few minor bugs and/or confusing patterns caused by variables redefined with a new type.
  • Add mypy to GitHub Actions to ensure that we don't introduce any new broken type hints.

For now, run with the default configuration and no arguments.

This configuration will detect errors and inconsistencies in type hints, but
will not complain about missing or incomplete type hints.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook added this to the 2.x milestone Aug 4, 2025
@Pennycook Pennycook requested review from Copilot and swright87 August 4, 2025 12:57
@Pennycook Pennycook added the ci/cd GitHub Actions, pre-commit hooks, etc label Aug 4, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes broken type hints throughout the codebase to resolve mypy errors and improves type safety. The changes address inconsistent type annotations, missing type information, and variable redefinition issues that could lead to confusion.

  • Updates type annotations to use modern union syntax and more precise types
  • Fixes variable shadowing issues where variables were redefined with different types
  • Adds mypy to pre-commit hooks to prevent future type hint regressions

Reviewed Changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
codebasin/util.py Updated parameter types to accept both str and PathLike, fixed string operations on path objects
codebasin/report.py Corrected type annotations for setmap parameters and return types, fixed variable shadowing
codebasin/preprocessor.py Fixed incorrect type annotation for lines field
codebasin/finder.py Updated setmap type annotation to be more precise
codebasin/config.py Replaced Self with explicit return types, updated action method signatures
codebasin/main.py Fixed variable shadowing issue with lines variable
codebasin/init.py Added proper type annotations and type casting for JSON loading
.pre-commit-config.yaml Added mypy hook with necessary type stub dependencies

Copy link

@swright87 swright87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@Pennycook Pennycook merged commit fb73ac2 into P3HPC:main Aug 4, 2025
4 checks passed
@Pennycook Pennycook deleted the ci/type-hints branch August 4, 2025 14:00
@Pennycook Pennycook mentioned this pull request Aug 4, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd GitHub Actions, pre-commit hooks, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants