Skip to content

Commit

Permalink
Adopt black in pre-commit
Browse files Browse the repository at this point in the history
Update using black for formatting python code, automatically apply
change in the pre-commit hook.

More info about black:
https://black.readthedocs.io/en/stable/

Signed-off-by: Wayne Sun <gsun@redhat.com>
  • Loading branch information
waynesun09 committed Sep 15, 2022
1 parent adaf63a commit 87fb12a
Show file tree
Hide file tree
Showing 77 changed files with 2,842 additions and 2,525 deletions.
18 changes: 7 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
# configuration for pre-commit git hooks
files: ^(src/pylero)
exclude: '^docs'
repos:
- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
rev: v3.8.2
hooks:
- id: reorder-python-imports
language_version: python3
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.3.0
hooks:
- id: trailing-whitespace
language_version: python3
- id: end-of-file-fixer
language_version: python3
- id: debug-statements
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
- id: detect-private-key
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: flake8
language_version: python3
- id: black
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ $ pip install pre-commit
$ pre-commit autoupdate && pre-commit run -a
```

Pre-commit will ensure that the changes you made are not in violation of PEP8 standards.
Pre-commit will ensure that the changes you made are not in violation of PEP8 standards and automatically apply black fixes.

We recommend `autopep8` to fix any pre-commit failures by running below or you are free to use any formatters which can resolve pre-commit failures with least possible diff.
We recommend `black` to automatically fix any pre-commit failures.

``` python
$ pip install autopep8
$ autopep8 --in-place <edited_file.py>
$ pip install black
$ black <edited_file.py>
```

## Fedora RPM package build
Expand Down

0 comments on commit 87fb12a

Please sign in to comment.