misc: add codestyle files/notes (#61513)

This commit is contained in:
Paul Marillonnet 2022-02-07 18:24:50 +01:00
parent 6006c96557
commit 233df53ac6
3 changed files with 42 additions and 0 deletions

2
.git-blame-ignore-revs Normal file
View File

@ -0,0 +1,2 @@
# codestyle: add black, isort, pyupgrade (#61513)
6006c9655793c895ce896c18770620e79a315038

18
.pre-commit-config.yaml Normal file
View File

@ -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']

22
README
View File

@ -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
========