misc: add black files/notes (#51575)

This commit is contained in:
Benjamin Dauvergne 2021-03-02 14:51:33 +01:00
parent 5b9bc1ff57
commit fe28a7938c
4 changed files with 26 additions and 1 deletions

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

@ -0,0 +1 @@
5b9bc1ff57cfb47458d629c15bcae28ae0bc141b

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

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

10
README
View File

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

View File

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