From 233df53ac6f97a08a75fe1c6ab6ee8313ed0cd27 Mon Sep 17 00:00:00 2001 From: Paul Marillonnet Date: Mon, 7 Feb 2022 18:24:50 +0100 Subject: [PATCH] misc: add codestyle files/notes (#61513) --- .git-blame-ignore-revs | 2 ++ .pre-commit-config.yaml | 18 ++++++++++++++++++ README | 22 ++++++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 .git-blame-ignore-revs create mode 100644 .pre-commit-config.yaml diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..fd3b8e2 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# codestyle: add black, isort, pyupgrade (#61513) +6006c9655793c895ce896c18770620e79a315038 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..225214f --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/psf/black + rev: 21.10b0 + 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 03f586e..bebc35f 100644 --- a/README +++ b/README @@ -8,6 +8,28 @@ Installation Install with `pip install authentic2-cut` +Code Style +========== + +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.) + Settings ========