Skip to content
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

Add missing code on mypy errors #721

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add missing code on mypy errors #721

wants to merge 1 commit into from

Conversation

sbrunner
Copy link
Member

Use mypy api to get the messages details

before:

prospector/blender.py:81:13: error(mypy): List comprehension has incompatible type List[Message]; expected List[str]  [misc]
prospector/blender.py:101:12: error(mypy): Incompatible return value type (got "list[str]", expected "list[Message]")  [return-value]

after:

prospector/blender.py:81:12: misc(mypy): List comprehension has incompatible type List[Message]; expected List[str].
prospector/blender.py:101:11: return-value(mypy): Incompatible return value type (got "list[str]", expected "list[Message]").

Description

Use the json formater, use the API to get the message individually.

Related Issue

fix #716

Motivation and Context

Have a better mypy integration

How Has This Been Tested?

Run on Prospector code with some errors

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@sbrunner
Copy link
Member Author

Is dmypy usefull?

@sbrunner sbrunner marked this pull request as ready for review January 29, 2025 16:31
Copy link
Collaborator

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

LGTM, the remark about the API is a nit.

.prospector.yml Show resolved Hide resolved
prospector/tools/mypy/__init__.py Show resolved Hide resolved
Use mypy api to get the messages details

before:
```
prospector/blender.py:81:13: error(mypy): List comprehension has incompatible type List[Message]; expected List[str]  [misc]
prospector/blender.py:101:12: error(mypy): Incompatible return value type (got "list[str]", expected "list[Message]")  [return-value]
```

after:
```
prospector/blender.py:81:12: misc(mypy): List comprehension has incompatible type List[Message]; expected List[str].
prospector/blender.py:101:11: return-value(mypy): Incompatible return value type (got "list[str]", expected "list[Message]").
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] mypy code are not whell catched
2 participants