From aec0edb0c84758bc1c9ea7cd965d7b8311cbf9f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 13 Jul 2021 11:39:59 +0200 Subject: [PATCH] build: document and use isort and pyupgrade --- .git-blame-ignore-revs | 2 ++ .pre-commit-config.yaml | 10 ++++++++++ README | 13 +++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 505921d..ed2552d 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,4 @@ # trivial: apply black ce7f2dd5000cf1eb462ae18aeeb5ab66913b452f +# trivial: apply isort & pyupgrade +250ef2e74ae674f7039318787ba85b63f2825c7d diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a14705c..ce247d6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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'] diff --git a/README b/README index 405e4b2..9fc80ce 100644 --- a/README +++ b/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 -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