summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2021-03-02 13:51:33 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2021-03-02 14:50:59 (GMT)
commitfe28a7938c992d5044e7d0276b2712746dce1ad1 (patch)
treeaeb40147e5a5f19d37b9b0af31ed26e56df96c97
parent5b9bc1ff57cfb47458d629c15bcae28ae0bc141b (diff)
downloaddjango-mellon-main.zip
django-mellon-main.tar.gz
django-mellon-main.tar.bz2
misc: add black files/notes (#51575)HEADv1.23main
-rw-r--r--.git-blame-ignore-revs1
-rw-r--r--.pre-commit-config.yaml8
-rw-r--r--README10
-rw-r--r--tox.ini8
4 files changed, 26 insertions, 1 deletions
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