build: document and use isort and pyupgrade
This commit is contained in:
parent
250ef2e74a
commit
aec0edb0c8
|
@ -1,2 +1,4 @@
|
||||||
# trivial: apply black
|
# trivial: apply black
|
||||||
ce7f2dd5000cf1eb462ae18aeeb5ab66913b452f
|
ce7f2dd5000cf1eb462ae18aeeb5ab66913b452f
|
||||||
|
# trivial: apply isort & pyupgrade
|
||||||
|
250ef2e74ae674f7039318787ba85b63f2825c7d
|
||||||
|
|
|
@ -6,3 +6,13 @@ repos:
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
|
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
13
README
|
@ -44,8 +44,17 @@ black is used to format the code, using thoses parameters:
|
||||||
|
|
||||||
black --target-version py37 --skip-string-normalization --line-length 110
|
black --target-version py37 --skip-string-normalization --line-length 110
|
||||||
|
|
||||||
There is .pre-commit-config.yaml to use pre-commit to automatically run black
|
isort is used to format the imports, using those parameters:
|
||||||
before commits. (execute `pre-commit install` to install the git hook.)
|
|
||||||
|
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
|
License
|
||||||
|
|
Loading…
Reference in New Issue