Browse Source

Add zuul job to run tox-format environment for executing black and isort

This will allow us to have more consistent and clean code.

Change-Id: I8a49053d016c52b7b44136a6a8f36f9ad12675c3
David Moreau Simard 6 months ago
parent
commit
001112df9f
No account linked to committer's email address
5 changed files with 32 additions and 10 deletions
  1. 2
    0
      .zuul.yaml
  2. 2
    0
      pyproject.toml
  3. 22
    0
      setup.cfg
  4. 2
    0
      test-requirements.txt
  5. 4
    10
      tox.ini

+ 2
- 0
.zuul.yaml View File

@@ -1,7 +1,9 @@
1 1
 - project:
2 2
     check:
3 3
       jobs:
4
+        - tox-format
4 5
         - tox-pep8
5 6
     gate:
6 7
       jobs:
8
+        - tox-format
7 9
         - tox-pep8

+ 2
- 0
pyproject.toml View File

@@ -0,0 +1,2 @@
1
+[tool.black]
2
+line-length = 120

+ 22
- 0
setup.cfg View File

@@ -53,3 +53,25 @@ universal = 1
53 53
 [pbr]
54 54
 skip_authors = True
55 55
 skip_changelog = True
56
+
57
+[flake8]
58
+# E123, E125 skipped as they are invalid PEP-8.
59
+# E741, short ambiguous variable names
60
+# H106 Don’t put vim configuration in source files
61
+# H203 Use assertIs(Not)None to check for None
62
+max-line-length = 120
63
+ignore = E123,E125,E741
64
+enable-extensions=H106,H203
65
+show-source = True
66
+exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
67
+
68
+[isort]
69
+known_first_party = ara
70
+default_section = THIRDPARTY
71
+skip = build,.git,.tox,.cache,.venv
72
+not_skip = __init__.py
73
+multi_line_output=3
74
+include_trailing_comma=True
75
+force_grid_wrap=0
76
+combine_as_imports=True
77
+line_length=88

+ 2
- 0
test-requirements.txt View File

@@ -3,3 +3,5 @@ coverage
3 3
 flake8
4 4
 sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
5 5
 sphinx-rtd-theme
6
+black==18.9b0 ; python_version >= '3.6' # Exact version for prerelease
7
+isort

+ 4
- 10
tox.ini View File

@@ -22,13 +22,7 @@ commands =
22 22
   flake8 ara
23 23
   bandit -r ara
24 24
 
25
-[flake8]
26
-# E123, E125 skipped as they are invalid PEP-8.
27
-# E741, short ambiguous variable names
28
-# H106 Don’t put vim configuration in source files
29
-# H203 Use assertIs(Not)None to check for None
30
-max-line-length = 120
31
-ignore = E123,E125,E741
32
-enable-extensions=H106,H203
33
-show-source = True
34
-exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
25
+[testenv:format]
26
+commands =
27
+    black --diff --check ara
28
+    isort --recursive --check-only --diff --virtual-env {envdir} ara

Loading…
Cancel
Save