-
Couldn't load subscription status.
- Fork 10
Fix broken type hints #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
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]>
There was a problem hiding this 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 |
There was a problem hiding this 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
Related issues
Proposed changes
mypydue to broken or inconsistent type hints.mypyto GitHub Actions to ensure that we don't introduce any new broken type hints.