KEMBAR78
Print and show error end locations by ilevkivskyi · Pull Request #13148 · python/mypy · GitHub
Skip to content

Conversation

ilevkivskyi
Copy link
Member

Using the flag --show-error-end the errors will be output like file:line:column:end_line:end_column, for example:

x: int = "no way"
main:1:10:1:17: error: Incompatible types in assignment (expression has type "str", variable has type "int")

This will be helpful for various tools to highlight error location. Also when run with --pretty mypy itself will highlight the full span of error context (except if it spans multiple lines, like Python 3.11 itself does). Examples:

Screenshot 2022-07-16 at 15 39 06

@ilevkivskyi ilevkivskyi requested a review from JukkaL July 16, 2022 14:59
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

2 similar comments
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Ivan Levkivskyi added 2 commits July 17, 2022 14:41
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@ilevkivskyi
Copy link
Member Author

@JukkaL All tests pass finally, you can review this now.

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.

Looks good! This makes error reporting more user friendly, and tracking the end line/column could be useful for other things as well in the future.

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.

2 participants