This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch frazer/flake8
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit cac8ff387c02c1b588e3cecd0d4dd6dc44fcd02e
Author: Chandan Singh <[email protected]>
AuthorDate: Tue Nov 5 12:59:51 2019 +0000

    Add configuration to run Black
    
    Introduce two new tox environments - `format` and `format-check`. The
    `format` environment will reformat the code using `black` whereas the
    `format-check` envrionment will simply print the diff without modifying
    any files.
    
    Configure Black to use the same line lengths that we use
    currently, i.e. 119.
---
 pyproject.toml | 18 ++++++++++++++++++
 tox.ini        | 20 ++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/pyproject.toml b/pyproject.toml
index 4dd02d1..29f5589 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -7,3 +7,21 @@ requires = [
     "Cython"
 ]
 build-backend = "setuptools.build_meta"
+
+[tool.black]
+line-length = 119
+exclude = '''
+(
+  /(
+      \.eggs
+    | \.git
+    | \.mypy_cache
+    | \.tox
+    | _build
+    | build
+    | dist
+  )/
+  | src/buildstream/_fuse
+  | src/buildstream/_protos
+)
+'''
diff --git a/tox.ini b/tox.ini
index dffaf72..4cc7f3a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -103,6 +103,26 @@ setenv =
     COVERAGE_FILE = {toxinidir}/.coverage-reports/.coverage
 
 #
+# Code formatters
+#
+[testenv:format]
+skip_install = True
+deps =
+    black==19.10b0
+commands =
+    black {posargs: src tests}
+
+#
+# Code format checkers
+#
+[testenv:format-check]
+skip_install = True
+deps =
+    black==19.10b0
+commands =
+    black --check --diff {posargs: src tests}
+
+#
 # Running linters
 #
 [testenv:lint]

Reply via email to