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

Always show the cause of error in dmypy suggest #7680

Merged
merged 4 commits into from Oct 10, 2019

Conversation

ilevkivskyi
Copy link
Member

This PR prints the type errors that prevented dmypy suggest from running. Since this will be mostly used by interactive tools, I don't pipe the errors though normal formatting and colors, but if you think it makes sense, then I can do this.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Showing errors should improve usability significantly, especially if there are 'fixme' types. Will the PyCharm mypy plugin be able to show the errors using the nice UX which allows quickly jumping to an error location?

If/when we document dmypy suggest, having colors could be worth it, but now this seems good enough to let us experiment with it.

if check_errors and res:
raise SuggestionFailure("Error while trying to load %s" % state.id)
# TODO: apply color and formatting to error messages?
raise SuggestionFailure("Error while trying to load %s:\n" % state.id + '\n'.join(res))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: The term 'load' here seems a bit inconsistent to me. What about "Error while processing..."? Or maybe leave the header out altogether -- just having the error messages should be clear enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will replace it with "Error while processing..."

@ilevkivskyi
Copy link
Member Author

Will the PyCharm mypy plugin be able to show the errors using the nice UX which allows quickly jumping to an error location?

I think so, it redirects stderr to stdout before parsing it (also it ignores every line without error: or note:). I can double-check.

@ilevkivskyi ilevkivskyi merged commit 2288371 into python:master Oct 10, 2019
@ilevkivskyi ilevkivskyi deleted the suggest-show-errors branch October 10, 2019 13:53
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.

None yet

2 participants