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

"Function is missing type annotation" error marks entire function instead of just marking the function signature line #262

Closed
avivz opened this issue Jan 30, 2024 · 1 comment
Assignees

Comments

@avivz
Copy link

avivz commented Jan 30, 2024

I use mypy in --strict mode which also reports when functions are missing type annotations as an error. The extension marks (via red underline) the entire function as erroneous, while it would be easier to understand if only the function definition is marked.

Looking at the logs I see that the end_line and end_character reported by mypy include the entire function scope, so solving this probably requires handling this specific error in a different way.

example:

image

image

@karthiknadig
Copy link
Member

We avoid re-interpreting responses for the ranges. Users might want to preserve the ranges as provided by mypy. Changing the range would mean that we will now have to provide a way to get the ranges as provided by mypy if users prefer that. This also means that we may have to provided configurability at rule level for each case. Additionally, if mypy makes changes to these ranges, then we will need to handle this on a per version basis.

We want to leave this to mypy to decide how these ranges are managed for the various cases. So, this is an ask for mypy, to change the range here to the function definition.

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

No branches or pull requests

3 participants