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

Errors are not sorted by file #2144

Open
gvanrossum opened this issue Sep 15, 2016 · 6 comments
Open

Errors are not sorted by file #2144

gvanrossum opened this issue Sep 15, 2016 · 6 comments

Comments

@gvanrossum
Copy link
Member

gvanrossum commented Sep 15, 2016

I just noticed that when you run mypy on a large number of files, the errors don't come out sorted by filename, even if you pass the filenames in sorted order on the command line. I presume this is some kind of side effect of processing files in an order determined by the dependency graph.

Maybe we should just sort them all by filename? Or sort them back in the order in which they were passed on the command line (or expanded from packages/directories)?

It seems the Errors.sort_messages() method in mypy/errors.py could easily sort messages by filename; sorting them by original order would require the original order to be passed in to that function (not rocket science, but perhaps requiring some small refactoring).

@gvanrossum
Copy link
Member Author

(It's important not to attempt to sort the textual output, because it may contains note referring to other files in the import stack that led to a specific error.)

@elazarg
Copy link
Contributor

elazarg commented Sep 16, 2016

+1 on the command line order.

In general the output for mypy *.py is much easier to read than mypy something.py (though it's mainly because of the notes). I'd thought it should be the other way around.

@sebastian-philipp
Copy link

Yep, it makes updates of mypy reports hard to read:

https://gist.github.com/sebastian-philipp/25f70aae3b0d21b1a781c110a7ef8be4/revisions

@JukkaL
Copy link
Collaborator

JukkaL commented Mar 19, 2019

Mypy now does error streaming, i.e. errors are reported as soon as they are generated. Sorting errors is incompatible with streaming.

@sebastian-philipp
Copy link

yep, it would need to store the errors and print everything at the end after the last file finishes.

@gvanrossum
Copy link
Member Author

Well, it does still store them and print them later. They are printed after a file or a group of interconnected files (through import cycles) is processed. So they could be sorted within such a file (group).

Also, in daemon mode all errors come out at the very end (though we occasionally regret this) so it should be possible to sort them all.

sebastian-philipp added a commit to sebastian-philipp/ceph that referenced this issue May 23, 2019
Workaround for python/mypy#2144

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
sebastian-philipp added a commit to sebastian-philipp/ceph that referenced this issue May 28, 2019
Workaround for python/mypy#2144

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
sebastian-philipp added a commit to sebastian-philipp/ceph that referenced this issue May 28, 2019
Workaround for python/mypy#2144

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
ideepika pushed a commit to ideepika/ceph that referenced this issue Jun 25, 2019
Workaround for python/mypy#2144

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
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

5 participants