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 definitions' line and column reported are wrong if the function has a decorator #24

Closed
gforcada opened this issue Apr 3, 2018 · 2 comments

Comments

@gforcada
Copy link
Owner

gforcada commented Apr 3, 2018

See #22 (comment) for the details.

So far it seems that the ast module does not provide that information.

An upstream bug to CPython has been created for that: https://bugs.python.org/issue33211

/cc @dhood

@gforcada gforcada changed the title function definitions function definitions' line and column reported are wrong if the function has a decorator Apr 3, 2018
@dhood
Copy link

dhood commented Apr 4, 2018

following on from #22 (comment):

What we can do meanwhile would be to create a new error message (say A003) explaining the situation, only if the function definition has a decorator. Would that be an optimal solution? I would rather not like to parse the file manually and search for the correct spot going line by line just for this corner case... I'm open to pull requests that do that though

personally given how verbose the error message was I didn't find it too difficult to identify the source of the problem even with the decorator being mistakenly reported.
we're tossing up whether or not to noqa this error, and when we do so we usually prefer to noqa a specific error code.
If I understand your suggestion correctly a user would have to noqa different error codes if they add/remove a decorator, which perhaps is enough reason (combined with the already descriptive error message) to not bother splitting it out

@gforcada
Copy link
Owner Author

gforcada commented Apr 4, 2018

@dhood thanks for chimming in, given what I see on the upstream report in cpython I would close, at least by now, as a WONTFIX.

@gforcada gforcada closed this as completed Apr 4, 2018
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

2 participants