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

Adopt black in pre-commit #98

Merged
merged 3 commits into from Sep 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/pull_request.yml
Expand Up @@ -14,10 +14,10 @@ jobs:
python-version: [3.6, 3.8, 3.9, "3.10"]
steps:
- name: Checkout Pylero
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set Up Python-${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -26,5 +26,7 @@ jobs:
pip install -U pip
pip install -U -r requirements.txt
pip install .

- name: Pre Commit Checks
uses: pre-commit/action@v2.0.0
uses: pre-commit/action@v3.0.0
if: ${{ matrix.python-version != '3.6' }}
18 changes: 7 additions & 11 deletions .pre-commit-config.yaml
@@ -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
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