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

pre-commit configured and executed #434

Merged
merged 16 commits into from
May 18, 2021

Conversation

consideRatio
Copy link
Member

General maintenance to follow the common practice of having a pre-commit configuration setup for the JupyterHub org repo.

.flake8 Outdated
# E402: module level import not at top of file
# I100: Import statements are in the wrong order
# I101: Imported names are in the wrong order. Should be
ignore = E, C, W, F401, F403, F811, F841, E402, I100, I101, D400
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change necessary to deal with the black autoformatter? It seems like an unexpectedly long list of exclusions.

In general I think we should be as strict as possible except where it conflicts with the black formatter.

Copy link
Member

@manics manics May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually maybe this is fine, is it to with removing select = F?

Copy link
Member Author

@consideRatio consideRatio May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, i just copy pasted to mimic jupyterhub repo.

I recall Min being opinionated towards being relaxed unless it can cause problems in the flake8 checks. I'm personally inclined towards not needing to put in work to please flake8 unless it is something that can cause a bug.

Perhaps with black, some of these settings are automatically enforced though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore = E, C, W, F401, F841 seems to pass flake8

Of the remainder:

# F403: import *

Best to avoid in new code as it pollutes the namespace

# F811: redefinition of unused `name` from line `N`

Potential bug in new code, you've assigned a value to a variable and then assigned another value to that variable without using the first value

# E402: module level import not at top of file
# I100: Import statements are in the wrong order
# I101: Imported names are in the wrong order. Should be

These are presumably taken care of by id: reorder-python-imports?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consideRatio#1 cleans up the unused imports

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Makes sense to me!!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be a lot of work to make an old repo compliant with flake8, I suspect this is one reason for lots of exclusions. In general once the code is compliant it's not too difficult to keep it that way, I've had several bugs that were detected by flake8 before I'd even run my tests.

Arguably for a repo like oauthenticator where we don't run a lot of the code ourselves we should be even stricter as we're often merging solely based on code review, but that's a separate discussion 😄 . Shall we merge this PR?

.pre-commit-config.yaml Outdated Show resolved Hide resolved
.pre-commit-config.yaml Outdated Show resolved Hide resolved
@manics
Copy link
Member

manics commented May 17, 2021

A few minor comments, but as you can probably guess I'm in favour of pre-commit 😄

consideRatio and others added 4 commits May 17, 2021 21:17
Co-authored-by: Simon Li <orpheus+devel@gmail.com>
Remove unused imports, reduce flake8 exclusions list
@consideRatio consideRatio merged commit 93284e0 into jupyterhub:master May 18, 2021
@consideRatio
Copy link
Member Author

❤️ thank you soo much @manics for your thorough care and effort, i love it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants