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

Problematic docs for black use #2185

Closed
HectorMenezes opened this issue Jan 4, 2022 · 1 comment
Closed

Problematic docs for black use #2185

HectorMenezes opened this issue Jan 4, 2022 · 1 comment

Comments

@HectorMenezes
Copy link

HectorMenezes commented Jan 4, 2022

While following the documentation's quickstart in a project, I encountered the following error after running pre-commit with the .pre-commit-config.yaml provided there:

(precommit) ➜  precommit git:(main) ✗ pre-commit run --all-files
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
black....................................................................Failed
- hook id: black
- exit code: 123

error: cannot format src/main.py: Cannot parse: 2:16: if amazing_var := amazing_bool is None:
All done! 💥 💔 💥
1 file failed to reformat.

At first, I thought it was a problem with black, and it had been in fact, but it was fixed. I easily fixed by changing

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.3.0
    hooks:
    -   id: check-yaml
    -   id: end-of-file-fixer
    -   id: trailing-whitespace
-   repo: https://github.com/psf/black
    rev: 19.3b0
    hooks:
    -   id: black

to

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v2.3.0
    hooks:
    -   id: check-yaml
    -   id: end-of-file-fixer
    -   id: trailing-whitespace
-   repo: https://github.com/psf/black
    rev: stable
    hooks:
    -   id: black

It'd be a good idea to change that.

@asottile
Copy link
Member

asottile commented Jan 4, 2022

feel free to send a PR though your suggested configuration is not correct

you might also be interested in pre-commit autoupdate

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

No branches or pull requests

2 participants