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
Permit to lint to the end in case of crash on a file #4810
Permit to lint to the end in case of crash on a file #4810
Conversation
Pull Request Test Coverage Report for Build 1125212127
💛 - Coveralls |
058ebda
to
a734621
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this would be a good change. IMO there are multiple issues with it:
pylint
is in equal parts run locally an in CI environments. Especially larger projects only use CI. Artifacts aren't stored, thus it will be difficult to see the error if it's only written to a temp file.- I expect most devs won't appreciate an error file being written to their project directory. It's way too easy for it to be accidentally in the git repo.
- A fatal crash should really be the exception. We try our best to fix them as fast as we can. So they don't stay for long.
- Until the issue is fixed, the easiest solution (and probably the one most choose) would be to continue using an older version.
- I don't think this will increase bug reports.
pylint
is used by devs after all. If they don't open a new issue it's most likely that they don't care enough about it. In that case we shouldn't care either. If the issue is bigger, someone will open a new issue. - Devs might unknowingly share confidential code.
- Just having a lot of low quality issues will only increase our workload without providing much benefit. It's much easier to find a good solution if the one opening the issue is self invested and can help debug it if necessary.
Sorry for being that harsh on your idea, but at the moment I don't think we should implement it.
a734621
to
7d2852c
Compare
The created template is only part of the merge request. Right now if there is a crash on a single file in pylint, it just crash and it is literally unusable for the whole code base. This change also permit to have a fatal error message instead of a crash and pylint will work as intended on other files. |
I must be missing something. If you have a crash with a new pylint version, you're not going to use it in production. You'll stick with the old / working one until the issue is fixed. |
Right now if there is a single crash on a single file, it's impossible to use pylint for the whole codebase. A user might want to test the new pylint on their codebase. If a single file crash, it's better if they still can benefit of the new checkers and fixes for all the other files. Or they might add something to the codebase that make pylint crash after having been on a version for months. I mean I already had the case, and the previous version also had problems. What was I supposed to do ? Check each older version until I find one that seems to work ? Should I check multiple version of astroid for each of those old pylint too ? What I did - and what user with some respect for their time will do- was disable pylint for the project. If I was not already a fan, I would have thought about not using it at all for my next project. I think having the last version and a file to exclude is preferable. In particular consider the useless suppression. Is the user better off reverting to a previous version and adding back all the disable from the false positive we removed in the latest one ? What about a crash in the pylint version included in your vscode when you just started programming ? This is a user experience nightmare. Also once you handle the crash this way, you have to do something with the stacktrace or it won't be reported. And we might as well help the user make the report. Regarding your point:
If they want to report the issue they will reproduce locally, so not a problem.
True, we should write this in pylint cache or a tmp directory.
We're also parsing a language, which is no easy task. Crashes are bound to happen (think of gcc) and in fact do happens. There are 100 crashes issues currently, 8 are still opened.
See my main point, I don't think it's "easy". Also if you've been on a version for a long time and pylint start to crash reverting to an older version might create other problems.
The point is not to increase bug reports, the point is to make them possible to do at all while making pylint resilient, which is the main point. Printing the traceback in the middle of the report is not that elegant or user friendly. By the way the warning
They will be creating the issue themselves, so it's on them. I hope they will read the issue before reporting it. I'm pretty sure the one that are making minimal reproducible example because they can't share the code will continue to do so.
True, but contradictory with the point about this not increasing bug report. Also the template is of better quality than some issue we have right now. Imo if you help the reporter by pre-redacting the issue and pointing to the issue tracker, they will spend more time doing something useful before creating the issue and the quality will increase. Also see how plantuml is handling this problem similarly : http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuKh9B4bCv798pKi1yW00 |
My initial response to your proposal wasn't ideal. It might have been because it hasn't been an issue for me personally. If I remember correctly, it always continued even after encountering an exception. However that might be related to multithreading or I didn't recall it correctly. In case you still like to move forward with this one, I would appreciate if you could at least print the exception traceback as well. That way it wouldn't be buried in a log file that might not be accessible on a CI server. Here might be a good position for it: |
Right now the message for a crash would be:
Do you prefer to have:
Or:
Also, I checked the lib for tempdir and apparently you're not guaranteed that the user will be able to open a
https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile Do you have an alternative ? If not maybe it's better to have the file in the current directory where it will be visible and removed than in the cache where it will stay ad infinitum ? |
By the way I appreciated your constructive criticism and the final result will be better because of it ;) |
7d2852c
to
7bc6109
Compare
And add pre-filled issue template so it's easier to open an issue.
My gut feeling would be that option (1) would be a bit better, as the Regarding the file: Can't we use |
7bc6109
to
f132802
Compare
We have a shorter stacktrace printed because we print it earlier which is "nice", well as nice as a crash can be:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't review it if you merge it so quickly 😜
if error is not None: | ||
msg = get_fatal_error_message(filepath, template_path) | ||
if isinstance(error, AstroidError): | ||
symbol = "astroid-error" | ||
msg = (filepath, msg) | ||
else: | ||
symbol = "fatal" | ||
self.add_message(symbol, args=msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do everything in the except handler? That way you wouldn't need to reassign the exception.
Sorry I thought you already reviewed the full MR the first time 😅 I'm going to address your comment in another MR. |
Following review see pylint-dev#4810
Following review see #4810
Type of Changes
Description
Permit to lint to the end in case of crash on a file and add a pre-filled issue template so it's easier to open an issue.
Will permit to keep using pylint when there is a crash on a code base. Also easier issue and probably more report.
Related to all the issue with a crash that are opened and completely prevent pylint from being run on a code base. I've done that prior to #4775