-
Notifications
You must be signed in to change notification settings - Fork 615
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
add flake8 pre-commit #1689
add flake8 pre-commit #1689
Conversation
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Meh, it's hell to track this down now. I assume that autopep8 removed an unused variable. |
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Not sure why this happened, but we well we're using black with pre-commit now anyways so w/e. Does this need fixing? |
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.
Main thing: Can you get rid of the line length change and re-request review?
scanpy.tests.blackdiff
This file got deleted, so I'm actually kinda surprised you're only getting a warning. Whatever this check is can be removed.
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
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.
Left a fair amount of comments and definitely didn't get everything.
Commit process
I think this review process will be easier if you can limit changes from one flake error type to a single commit.
This will make it easier to:
- Evaluate rules on their own. Sometimes rules aren't totally clear. I'm quite confused by some of the times you've used
# noqa: F821
- Lets me know what rule the line was violating
- Revert changes if we decide we want to deactivate a particular rule. There are a few instances of this already, and I'd like to minimize the pain of this process.
This may be kinda hard to do now, but does this sound like a reasonable way to go forward?
Rules I don't like
- I don't like replacing
x == False
withnot x
in all cases. Sometimes a variable could be a container, and an error should be thrown. I think cases have to be evaluated for this. - Whats with changing from single letter variables inside expressions? Seems fine to me.
- `lambda's also are generally fine.
- Whats up with removing leading
#
s from comments?
Process for bugs
So, some of the things you've adding a # noqa
to look like bugs. I think we need to have a plan in place for doing something about these. Do you have any suggestions?
About the commit process: That's far far too much work to do it like you suggested. I don't have the time for this. About the rules:
This should be covered by tests. In any case it is not good style and a violation.
They are redefinitions of earlier variables and trip up flake8. We can call them whatever we want as long it s not
See comment at the section.
The noqa ignore a rule for a specific line. I did not want to "fix" these things myself since Python is a dynamic language and you never know what happens :) Ideally we eventually get rid of all noqas, but not in this PR and not by me. I don't know the internals well enough to know whether this could have any side effects. |
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
@ivirshup tried to address all comments and made changes when necessary. |
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
@ivirshup I would keep the noqas. They are very easily searchable across the whole project and can be fixed later. To me the PR is fine now. Any final wishes? |
As a general point about this PR: to me, the fair amount of the work of turning on flake8 deciding on the rules. Perhaps we should start with a subset of files then? I realize you did not come to the meeting where we talked about this, so perhaps there is a difference of expectations here, but we agreed to be conservative about the rules we turned on in Going through everything to make sure changes are correctly reverted is also takes a lot of time for me as the reviewer. I'd also like to limit that. You said you used some automated tools to get faster compliance. What were these? In general, I would prefer to have a formatter that automatically ran than a tool that told me I formatted something wrong.
I'm pretty strongly against this.
Yes, lets ignore this.
I will try and take a closer look at these changes. I'm particularly concerned that there will be cases where possible values are |
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Co-authored-by: Isaac Virshup <[email protected]>
Co-authored-by: Isaac Virshup <[email protected]>
Co-authored-by: Isaac Virshup <[email protected]>
Signed-off-by: Zethson <[email protected]>
Co-authored-by: Isaac Virshup <[email protected]>
Co-authored-by: Isaac Virshup <[email protected]>
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Co-authored-by: Isaac Virshup <[email protected]>
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
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.
Thanks for the changes, just a few minor things I've added suggestions for and the paga
variables.
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
Signed-off-by: Zethson <[email protected]>
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, thanks for all the work!
We should add a release note for this at some point, I'm just not sure where yet, probably a section for dev practices. Could you suggest a line for that?
I was unsure about the variable naming for PAGA, so I've decided to revert that. I couldn't get flake8 to call it a redefinition.
🎉 |
I intervened a couple of times manually and switched off a couple of checks, but it should be a strong improvement.
Signed-off-by: Zethson [email protected]