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

Update pre-commit documentation #8545

Merged
merged 1 commit into from
Nov 7, 2023
Merged

Update pre-commit documentation #8545

merged 1 commit into from
Nov 7, 2023

Conversation

charliermarsh
Copy link
Member

I got some feedback on Mastodon that it wasn't clear how to use the linter and formatter together in pre-commit (mostly in the pre-commit repo's documentation, which is even less clear, but the two should be consistent).

@charliermarsh charliermarsh added the documentation Improvements or additions to documentation label Nov 7, 2023
require reformatting.
Ruff's lint hook should be placed run _before_ Ruff's formatter hook, as well as _before_ Black,
isort, and other formatting tools, as Ruff's fix behavior can output code changes that require
reformatting.
Copy link
Member Author

Choose a reason for hiding this comment

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

@zanieb -- I'm a little nervous about this change, is there any scenario in which this would be wrong?

Copy link
Member

Choose a reason for hiding this comment

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

Well.. if you're using format rules? Like E501 would have false positives if you ran it before Black.

Copy link
Member Author

Choose a reason for hiding this comment

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

But wouldn't Black then cause file changes, which would require you to re-run pre-commit? Or are there modes where people run pre-commit with allowed changes?

Copy link
Member

Choose a reason for hiding this comment

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

Ruff would fail first, Black wouldn't run.

@charliermarsh charliermarsh merged commit ce549e7 into main Nov 7, 2023
16 checks passed
@charliermarsh charliermarsh deleted the charlie/pre-commit branch November 7, 2023 18:40
@zanieb
Copy link
Member

zanieb commented Nov 8, 2023

#8567 adds auto-update of these versions

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

Successfully merging this pull request may close these issues.

None yet

2 participants