-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Refactor check() #7288
Refactor check() #7288
Conversation
Pull Request Test Coverage Report for Build 2875868156
π - Coveralls |
This comment has been minimized.
This comment has been minimized.
de60d26
to
e79324d
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.
Looks good, I only have time for a quick partial review right now, sorry :)
pylint/lint/pylinter.py
Outdated
except astroid.AstroidError as ex: | ||
template_path = prepare_crash_report( | ||
ex, fileitem.filepath, self.crash_file_path | ||
) | ||
msg = get_fatal_error_message(fileitem.filepath, template_path) | ||
self.add_message( | ||
"astroid-error", args=(fileitem.filepath, msg), confidence=HIGH | ||
) |
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.
Not sure here, but did we remove the distinction between pylint error and astroid error ? It seems the "fatal" message can't be raised anymore.
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 think this still exists? It seems to be covered?
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 made a search for "fatal"
and found nothing. I think we'd raise an 'astroid-error' now instead of 'fatal' ? Maybe we don't need the distinction and can simplify (the suggestion of new error was to keep that behaviour)
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.
get_fatal_error_message
is just a helper message that returns a string that points to the template. I don't think we need to change anything here.
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 thinking of self.add_message("astroid-error",
, previously there was a self.add_message("fatal",
that is not raised anymore. I.e. The new code always raise an astroid-error, even when the error come from pylint or somewhere else like an OSError "no space in device", or something unexpected.
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.
Oh, my bad. I didn't read this correctly. You're right, this is a mistake. Fix incoming.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
assert not err | ||
files = tmpdir.listdir() | ||
assert len(files) == 1 | ||
assert "pylint-crash-20" in str(files[0]) |
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.
Will python/pylint still be relevant in 2100 ? If so we're creating work for the next generation of maintainers π
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.
Copied from the test above π
with open(files[0], encoding="utf8") as f: | ||
content = f.read() | ||
assert "Failed to import module spam." in content | ||
assert any(m.symbol == "fatal" for m in linter.reporter.messages) |
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.
Previous test makes no sense as this test tries to lint the current file. Since the crash report includes the current file in the report whatever you put in an assertion will always end up in the crash report as well.
Since the test doesn't matter that much anyway I thought replacing was best.
This comment has been minimized.
This comment has been minimized.
@Pierre-Sassoulas Gentle ping as this is very prone to creating merge conflicts and I'd like to merge quickyl |
π€ Effect of this PR on checked open source code: π€ Effect on pandas:
The following messages are no longer emitted:
Effect on sentry:
The following messages are no longer emitted:
This comment was generated for commit 1147c08 |
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.
LGTM ! Sorry for the delay, it was a little hard to review as it seems the code was moved around but the diff is not very helpful. And sometime it's more than moving around (like the fatal/astroid-error change).
No worries, just thought you might have missed this as you had reviewed more recent PRs. Thanks for the review π |
Type of Changes
Description
Refs #7263.
Blocked by #7286.