build: document and use isort and pyupgrade

This commit is contained in:
Frédéric Péters 2021-07-13 11:39:59 +02:00
parent 250ef2e74a
commit aec0edb0c8
3 changed files with 23 additions and 2 deletions

View File

@ -1,2 +1,4 @@
# trivial: apply black
ce7f2dd5000cf1eb462ae18aeeb5ab66913b452f
# trivial: apply isort & pyupgrade
250ef2e74ae674f7039318787ba85b63f2825c7d

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

@ -44,8 +44,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 parameters:
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