misc: add isort/pyupgrade notes (#60931)

This commit is contained in:
Paul Marillonnet 2022-01-21 13:09:38 +01:00 committed by Benjamin Dauvergne
parent 1bdee3d45e
commit 48c545bbee
3 changed files with 23 additions and 2 deletions

View File

@ -1,2 +1,4 @@
# trivial: apply black
7a234d5fe7ae6bee3ba1d0f688967e8e6cf209e3
# trivial: apply isort & pyupgrade
1abbbadd9469a3f2ff7eafb0ec6956c2b1c6763c

View File

@ -6,3 +6,13 @@ repos:
hooks:
- id: black
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
- repo: https://github.com/PyCQA/isort
rev: 5.7.0
hooks:
- id: isort
args: ['--profile', 'black', '--line-length', '110']
- repo: https://github.com/asottile/pyupgrade
rev: v2.20.0
hooks:
- id: pyupgrade
args: ['--keep-percent-format', '--py37-plus']

13
README
View File

@ -28,8 +28,17 @@ black is used to format the code, using thoses parameters:
black --target-version py37 --skip-string-normalization --line-length 110
There is .pre-commit-config.yaml to use pre-commit to automatically run black
before commits. (execute `pre-commit install` to install the git hook.)
isort is used to format the imports, using those parameter:
isort --profile black --line-length 110
pyupgrade is used to automatically upgrade syntax, using those parameters:
pyupgrade --keep-percent-format --py37-plus
There is .pre-commit-config.yaml to use pre-commit to automatically run black,
isort and pyupgrade before commits. (execute `pre-commit install` to install
the git hook.)
License