Skip to content

Add "<function> defined here" notes to more errors #4773

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

Open
msullivan opened this issue Mar 21, 2018 · 7 comments
Open

Add "<function> defined here" notes to more errors #4773

msullivan opened this issue Mar 21, 2018 · 7 comments

Comments

@msullivan
Copy link
Collaborator

mypy produces a nice " defined here" note when calling a function with unexpected kwargs, but in no other situation. We should consider adding the note to every function call typechecking failure.

Probably should wait until #4772 is fixed though?

@tommyjcarpenter
Copy link

tommyjcarpenter commented Apr 13, 2022

I find this confusing when using editor linters like Ale, without more info included other than "defined here". There will be a break point to the left of the def foo line and it just says "function foo defined here", like, "ok, so??" it doesn't give any additional context of why it is telling me this or what the problem is. Nicer would be "defined here but a caller is calling incorrectly" or something along those lines.

I came across this issue when googling what on earth this linter note even means.

@Sesota
Copy link

Sesota commented Oct 24, 2022

The comment above seems pretty reasonable. Please fix, Thanks.

@MatthieuToulemont
Copy link

Agreed with the comment from @tommyjcarpenter !

@udiNur
Copy link

udiNur commented Jun 7, 2024

I find this confusing when using editor linters like Ale, without more info included other than "defined here". There will be a break point to the left of the def foo line and it just says "function foo defined here", like, "ok, so??" it doesn't give any additional context of why it is telling me this or what the problem is. Nicer would be "defined here but a caller is calling incorrectly" or something along those lines.

I came across this issue when googling what on earth this linter note even means.

I completely agree. It's frustrating that the linter highlights the function definition rather than the incorrect calls to that function. On top of that, the user also gets a vague message like "function foo defined here," which doesn't provide any useful context. It would be much more helpful if it specified something like "defined here, but called incorrectly elsewhere." This lack of clarity led me to search for more information online to understand what the linter was trying to convey.

@tsheaff
Copy link

tsheaff commented Dec 8, 2024

CleanShot 2024-12-07 at 21 47 27

This even confuses an LLM. This is Cursor 3.5 Sonnet's "Fix in Composer" and the LLM is like "doesn't seem like an error to me, it's defined right here" which is, to be fair to Claude, exactly what I thought when I read it the first time too 😆

@BackSeat
Copy link

Came here to find out why mypy is telling me that my function is defined 'here'. Odd message. Now I understand what it means, but the message shouldn't need me to search to find out what it means.

@nonamethanks
Copy link

How can this be disabled? It's not really helpful and if anything it's extremely annoying in any IDE that was developed in the last century.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants