diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..460eccd --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +5b9bc1ff57cfb47458d629c15bcae28ae0bc141b diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a14705c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,8 @@ +# 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: 20.8b1 + hooks: + - id: black + args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110'] diff --git a/README b/README index a4b0d09..40cbbcb 100644 --- a/README +++ b/README @@ -318,6 +318,16 @@ Unit tests are written using pytest and launched using tox, and can be run with: tox +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.) + Remarks ======= diff --git a/tox.ini b/tox.ini index e82d302..0764ac4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = coverage-py2-dj111-{pg,sqlite},coverage-py3-dj{111,22}-{pg,sqlite} +envlist = black,coverage-py2-dj111-{pg,sqlite},coverage-py3-dj{111,22}-{pg,sqlite} toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/django-mellon/ [testenv] @@ -59,6 +59,12 @@ commands = ./getlasso3.sh django-admin {posargs:--help} +[testenv:black] +skip_install = true +deps = + pre-commit +commands = + pre-commit run black --all-files --show-diff-on-failure [pytest] junit_family=legacy