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 - Burst utils.py into a "utils" and "message" package #2654
Refactor - Burst utils.py into a "utils" and "message" package #2654
Conversation
de11d8a
to
b330c66
Compare
6601f05
to
f303185
Compare
Turn out the error came from the very first commit. I thought importing from a package init.py's file is not the same as importing from a file named like the package. I might have to put back everything into the same file because I have no clue how to fix those 3 errors. |
f303185
to
314aece
Compare
@PCManticore, do you have any idea why this commit break 3 functional tests ? I sure don't, and I opened this stackoverflow question regarding the problem. |
@Pierre-Sassoulas It's definitely not related to your changes. I recently reverted some changes in astroid which affects pylint as well. Feel free to ignore them until we sort this out. |
314aece
to
1760d34
Compare
@PCManticore, thank you for taking the time to answer. I should rebase less or test the master branch more :) So I guess this pull request is ready, it fails only for the same tests than the master branch. |
c5456c7
to
16c776c
Compare
I've been intending to review this PR, but it's so big that I can't find a big enough chunk of time to do so. I'll try to go over it over the weekend. |
@PCManticore sorry the git diff is very big but it's basically just :
I hope this help you review this pull request more easily. |
16c776c
to
757b2a5
Compare
Since this PR has been here for so long and all the tests pass I'd be ok with this being merged as is but I'd like @PCManticore to do the merging. I think this PR makes utils on the whole easier to read. Some post-merge thoughts:
Other non refactor thoughts:
|
Right, @brycepg I had the same idea than you about messages related classes. There is a lot about messages in utils. But, it could (should?) be in a message package. Yesterday I was about to create a message package little by little in order to make this giant PR in small easier step but I did not find the time. I can take post-merge thought into account pre-merge. :) Let me know what you think. Btw we DO end up with cyclical import as soon as we want to put checker related function back into the checker package. (I also agree that the mixins are hard to understand). |
Following review see : pylint-dev#2654 (comment)
eedeb55
to
bf7659f
Compare
Following review see : pylint-dev#2654 (comment)
My bad, |
Following review here : pylint-dev#2654
Following review see : pylint-dev#2654 (comment)
bf7659f
to
3de592c
Compare
I made a message package with message related class and constant but there was some conflict during rebase of the most recent change in the master branch. I won't have time to fix it today. |
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.
Hey @Pierre-Sassoulas Thanks for the ping. Just gave it a quick look and looks pretty amazing, thank you so much. Left a bunch of small comments, do you plan to add anything else or is the PR ready to go in? If so, we can merge it as soon as possible.
import textwrap | ||
|
||
|
||
def normalize_text(text, line_len=80, indent=""): |
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.
Seems odd to have a module just for this function, is there a way to move it somewhere else?
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.
It's used in a lot of places and I think there is a circular import problem (Like for WarningScope). It's probably possible to fix, but that require some design.
@@ -0,0 +1,376 @@ | |||
# -*- coding: utf-8 -*- |
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.
Feels odd to have an utils.py
inside an utils
package, but I don't have a better suggestion.
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.
This permit to change the from pylint import utils
to from pylint.utils import utils, AstWalker, ...
and the class can be imported one by one while still using the utils.function_name()
for functions. It makes some change elsewhere less painful. Ideally every utils function would be in a semantically significant module or package but there is a lot of those utility functions...
There is a lot of Message related class in Utils this warrant the creation of a new package. See also review for burst utils.py into a package here: pylint-dev#2654 (comment)
Taken from unittest_lint.py
For obvious reasons. See review here : pylint-dev#2654 (comment)
@PCManticore I made the requested change for the discussion I resolved, and I pushed a rebased version for review. There is two unresolved discussions (about the |
Following review see : #2654 (comment)
There is a lot of Message related class in Utils this warrant the creation of a new package. See also review for burst utils.py into a package here: #2654 (comment)
For obvious reasons. See review here : #2654 (comment)
@Pierre-Sassoulas Thank you so much for this cleanup! I don't have any strong opinions about |
Also fixed spelling in C0112 to C0116 messages following the review of pull-request pylint-dev#2036 by Ashley Whetter. See also pylint-dev#2075, pylint-dev#2077, pylint-dev#2262, pylint-dev#2654, pylint-dev#2805, pylint-dev#2809, pylint-dev#2844, pylint-dev#2992 and pylint-dev#3013 for full historical context.
Also fixed spelling in C0112 to C0116 messages following the review of pull-request pylint-dev#2036 by Ashley Whetter. See also pylint-dev#2075, pylint-dev#2077, pylint-dev#2262, pylint-dev#2654, pylint-dev#2805, pylint-dev#2809, pylint-dev#2844, pylint-dev#2992 and pylint-dev#3013 for full historical context.
Also fixed spelling in C0112 to C0116 messages following the review of pull-request pylint-dev#2036 by Ashley Whetter. See also pylint-dev#2075, pylint-dev#2077, pylint-dev#2262, pylint-dev#2654, pylint-dev#2805, pylint-dev#2809, pylint-dev#2844, pylint-dev#2992 and pylint-dev#3013 for full historical context.
Also fixed spelling in C0112 to C0116 messages following the review of pull-request pylint-dev#2036 by Ashley Whetter. See also pylint-dev#2075, pylint-dev#2077, pylint-dev#2262, pylint-dev#2654, pylint-dev#2805, pylint-dev#2809, pylint-dev#2844, pylint-dev#2992 and pylint-dev#3013 for full historical context.
this is due to pylint-dev/pylint#2654 moving symbols into different places.
utils.py was big enough that is could cause issue. This is done in order to reduce saving time with syntax aware IDE, and also to make finding a piece of code easier for developer. I think this PR could make development on utils.py easier in the future.