Added CI for black/isort.
Change-Id: Ib93e64fe1584210d1fe5dce6e0455f0ade0dacca
This commit is contained in:
parent
37446042af
commit
c653d6a2c5
|
@ -9,3 +9,10 @@
|
||||||
parent: tox
|
parent: tox
|
||||||
vars:
|
vars:
|
||||||
tox_envlist: py3
|
tox_envlist: py3
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: tox-format
|
||||||
|
parent: tox
|
||||||
|
nodeset: ubuntu-bionic
|
||||||
|
vars:
|
||||||
|
tox_envlist: format
|
||||||
|
|
|
@ -7,9 +7,12 @@
|
||||||
jobs:
|
jobs:
|
||||||
- ara-server-ansible-integration:
|
- ara-server-ansible-integration:
|
||||||
voting: false
|
voting: false
|
||||||
|
- tox-format
|
||||||
- tox-py3
|
- tox-py3
|
||||||
- tox-pep8
|
- tox-pep8
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
|
- tox-format
|
||||||
- tox-py3
|
- tox-py3
|
||||||
- tox-pep8
|
- tox-pep8
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
from ara.api import models
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
|
|
||||||
|
from ara.api import models
|
||||||
|
|
||||||
|
|
||||||
class RecordAdmin(admin.ModelAdmin):
|
class RecordAdmin(admin.ModelAdmin):
|
||||||
list_display = ("id", "key", "value", "type")
|
list_display = ("id", "key", "value", "type")
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Generated by Django 2.1.1 on 2018-09-07 17:53
|
# Generated by Django 2.1.1 on 2018-09-07 17:53
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
import django.utils.timezone
|
import django.utils.timezone
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -15,14 +15,16 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import json
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import zlib
|
import zlib
|
||||||
from ara.api import models
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
|
from ara.api import models
|
||||||
|
|
||||||
DATE_FORMAT = "(iso-8601: 2016-05-06T17:20:25.749489-04:00)"
|
DATE_FORMAT = "(iso-8601: 2016-05-06T17:20:25.749489-04:00)"
|
||||||
DURATION_FORMAT = "([DD] [HH:[MM:]]ss[.uuuuuu])"
|
DURATION_FORMAT = "([DD] [HH:[MM:]]ss[.uuuuuu])"
|
||||||
logger = logging.getLogger("ara.api.serializers")
|
logger = logging.getLogger("ara.api.serializers")
|
||||||
|
|
|
@ -20,7 +20,6 @@ import factory
|
||||||
from ara.api import models
|
from ara.api import models
|
||||||
from ara.api.tests import utils
|
from ara.api.tests import utils
|
||||||
|
|
||||||
|
|
||||||
# constants for things like compressed byte strings or objects
|
# constants for things like compressed byte strings or objects
|
||||||
FILE_CONTENTS = "---\n# Example file"
|
FILE_CONTENTS = "---\n# Example file"
|
||||||
HOST_FACTS = {"ansible_fqdn": "hostname", "ansible_distribution": "CentOS"}
|
HOST_FACTS = {"ansible_fqdn": "hostname", "ansible_distribution": "CentOS"}
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
from ara.api import models, serializers
|
from ara.api import models, serializers
|
||||||
from ara.api.tests import factories
|
from ara.api.tests import factories, utils
|
||||||
from ara.api.tests import utils
|
|
||||||
|
|
||||||
|
|
||||||
class FileTestCase(APITestCase):
|
class FileTestCase(APITestCase):
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
from ara.api import models, serializers
|
from ara.api import models, serializers
|
||||||
from ara.api.tests import factories
|
from ara.api.tests import factories, utils
|
||||||
from ara.api.tests import utils
|
|
||||||
|
|
||||||
|
|
||||||
class HostTestCase(APITestCase):
|
class HostTestCase(APITestCase):
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
from ara.api import models, serializers
|
from ara.api import models, serializers
|
||||||
from ara.api.tests import factories
|
from ara.api.tests import factories, utils
|
||||||
from ara.api.tests import utils
|
|
||||||
|
|
||||||
|
|
||||||
class LabelTestCase(APITestCase):
|
class LabelTestCase(APITestCase):
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
from ara.api import models, serializers
|
from ara.api import models, serializers
|
||||||
from ara.api.tests import factories
|
from ara.api.tests import factories, utils
|
||||||
from ara.api.tests import utils
|
|
||||||
|
|
||||||
|
|
||||||
class PlaybookTestCase(APITestCase):
|
class PlaybookTestCase(APITestCase):
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
from ara.api import models, serializers
|
from ara.api import models, serializers
|
||||||
from ara.api.tests import factories
|
from ara.api.tests import factories, utils
|
||||||
from ara.api.tests import utils
|
|
||||||
|
|
||||||
|
|
||||||
class ResultTestCase(APITestCase):
|
class ResultTestCase(APITestCase):
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rest_framework.test import APITestCase
|
from rest_framework.test import APITestCase
|
||||||
|
|
||||||
from ara.api import models, serializers
|
from ara.api import models, serializers
|
||||||
from ara.api.tests import factories
|
from ara.api.tests import factories, utils
|
||||||
from ara.api.tests import utils
|
|
||||||
|
|
||||||
|
|
||||||
class TaskTestCase(APITestCase):
|
class TaskTestCase(APITestCase):
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from rest_framework_extensions.routers import ExtendedDefaultRouter
|
from rest_framework_extensions.routers import ExtendedDefaultRouter
|
||||||
|
|
||||||
from ara.api import views
|
from ara.api import views
|
||||||
|
|
||||||
router = ExtendedDefaultRouter(trailing_slash=False)
|
router = ExtendedDefaultRouter(trailing_slash=False)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from envparse import env
|
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
|
from envparse import env
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from django.urls import include, path
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.urls import include, path
|
||||||
|
|
||||||
urlpatterns = [path("api/v1/", include("ara.api.urls")), path("admin/", admin.site.urls)]
|
urlpatterns = [path("api/v1/", include("ara.api.urls")), path("admin/", admin.site.urls)]
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
[tool.black]
|
||||||
|
line-length = 120
|
||||||
|
exclude = '(migrations|ara/server/settings.py)'
|
22
setup.cfg
22
setup.cfg
|
@ -56,3 +56,25 @@ universal = 1
|
||||||
[pbr]
|
[pbr]
|
||||||
skip_authors = True
|
skip_authors = True
|
||||||
skip_changelog = True
|
skip_changelog = True
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
# E123, E125 skipped as they are invalid PEP-8.
|
||||||
|
# E741, short ambiguous variable names
|
||||||
|
# H106 Don’t put vim configuration in source files
|
||||||
|
# H203 Use assertIs(Not)None to check for None
|
||||||
|
max-line-length = 120
|
||||||
|
ignore = E123,E125,E741
|
||||||
|
enable-extensions=H106,H203
|
||||||
|
show-source = True
|
||||||
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ara/api/migrations
|
||||||
|
|
||||||
|
[isort]
|
||||||
|
known_first_party = ara
|
||||||
|
default_section = THIRDPARTY
|
||||||
|
skip = build,.git,.tox,.cache,.venv
|
||||||
|
not_skip = __init__.py
|
||||||
|
multi_line_output=3
|
||||||
|
include_trailing_comma=True
|
||||||
|
force_grid_wrap=0
|
||||||
|
combine_as_imports=True
|
||||||
|
line_length=88
|
||||||
|
|
|
@ -4,3 +4,5 @@ coverage
|
||||||
flake8
|
flake8
|
||||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||||
sphinx-rtd-theme
|
sphinx-rtd-theme
|
||||||
|
black==18.9b0 ; python_version >= '3.6' # Exact version for prerelease
|
||||||
|
isort
|
||||||
|
|
14
tox.ini
14
tox.ini
|
@ -58,13 +58,7 @@ commands =
|
||||||
coverage run -a {toxinidir}/manage.py test ara/api
|
coverage run -a {toxinidir}/manage.py test ara/api
|
||||||
coverage html
|
coverage html
|
||||||
|
|
||||||
[flake8]
|
[testenv:format]
|
||||||
# E123, E125 skipped as they are invalid PEP-8.
|
commands =
|
||||||
# E741, short ambiguous variable names
|
black --diff --check ara
|
||||||
# H106 Don’t put vim configuration in source files
|
isort --recursive --check-only --diff --virtual-env {envdir} ara
|
||||||
# H203 Use assertIs(Not)None to check for None
|
|
||||||
max-line-length = 120
|
|
||||||
ignore = E123,E125,E741
|
|
||||||
enable-extensions=H106,H203
|
|
||||||
show-source = True
|
|
||||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ara/api/migrations
|
|
||||||
|
|
Loading…
Reference in New Issue