Added CI for black/isort.
Change-Id: Ib93e64fe1584210d1fe5dce6e0455f0ade0dacca
This commit is contained in:
parent
37446042af
commit
c653d6a2c5
@ -9,3 +9,10 @@
|
||||
parent: tox
|
||||
vars:
|
||||
tox_envlist: py3
|
||||
|
||||
- job:
|
||||
name: tox-format
|
||||
parent: tox
|
||||
nodeset: ubuntu-bionic
|
||||
vars:
|
||||
tox_envlist: format
|
||||
|
@ -7,9 +7,12 @@
|
||||
jobs:
|
||||
- ara-server-ansible-integration:
|
||||
voting: false
|
||||
- tox-format
|
||||
- tox-py3
|
||||
- tox-pep8
|
||||
gate:
|
||||
jobs:
|
||||
- tox-format
|
||||
- tox-py3
|
||||
- tox-pep8
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
from ara.api import models
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.models import Group
|
||||
|
||||
from ara.api import models
|
||||
|
||||
|
||||
class RecordAdmin(admin.ModelAdmin):
|
||||
list_display = ("id", "key", "value", "type")
|
||||
|
@ -1,8 +1,8 @@
|
||||
# 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.utils.timezone
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
@ -15,14 +15,16 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import json
|
||||
import hashlib
|
||||
import json
|
||||
import logging
|
||||
import zlib
|
||||
from ara.api import models
|
||||
|
||||
from django.utils import timezone
|
||||
from rest_framework import serializers
|
||||
|
||||
from ara.api import models
|
||||
|
||||
DATE_FORMAT = "(iso-8601: 2016-05-06T17:20:25.749489-04:00)"
|
||||
DURATION_FORMAT = "([DD] [HH:[MM:]]ss[.uuuuuu])"
|
||||
logger = logging.getLogger("ara.api.serializers")
|
||||
|
@ -20,7 +20,6 @@ import factory
|
||||
from ara.api import models
|
||||
from ara.api.tests import utils
|
||||
|
||||
|
||||
# constants for things like compressed byte strings or objects
|
||||
FILE_CONTENTS = "---\n# Example file"
|
||||
HOST_FACTS = {"ansible_fqdn": "hostname", "ansible_distribution": "CentOS"}
|
||||
|
@ -18,8 +18,7 @@
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from ara.api import models, serializers
|
||||
from ara.api.tests import factories
|
||||
from ara.api.tests import utils
|
||||
from ara.api.tests import factories, utils
|
||||
|
||||
|
||||
class FileTestCase(APITestCase):
|
||||
|
@ -18,8 +18,7 @@
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from ara.api import models, serializers
|
||||
from ara.api.tests import factories
|
||||
from ara.api.tests import utils
|
||||
from ara.api.tests import factories, utils
|
||||
|
||||
|
||||
class HostTestCase(APITestCase):
|
||||
|
@ -18,8 +18,7 @@
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from ara.api import models, serializers
|
||||
from ara.api.tests import factories
|
||||
from ara.api.tests import utils
|
||||
from ara.api.tests import factories, utils
|
||||
|
||||
|
||||
class LabelTestCase(APITestCase):
|
||||
|
@ -16,6 +16,7 @@
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import datetime
|
||||
|
||||
from django.utils import timezone
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import datetime
|
||||
|
||||
from django.utils import timezone
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from ara.api import models, serializers
|
||||
from ara.api.tests import factories
|
||||
from ara.api.tests import utils
|
||||
from ara.api.tests import factories, utils
|
||||
|
||||
|
||||
class PlaybookTestCase(APITestCase):
|
||||
|
@ -18,8 +18,7 @@
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from ara.api import models, serializers
|
||||
from ara.api.tests import factories
|
||||
from ara.api.tests import utils
|
||||
from ara.api.tests import factories, utils
|
||||
|
||||
|
||||
class ResultTestCase(APITestCase):
|
||||
|
@ -16,12 +16,12 @@
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import datetime
|
||||
|
||||
from django.utils import timezone
|
||||
from rest_framework.test import APITestCase
|
||||
|
||||
from ara.api import models, serializers
|
||||
from ara.api.tests import factories
|
||||
from ara.api.tests import utils
|
||||
from ara.api.tests import factories, utils
|
||||
|
||||
|
||||
class TaskTestCase(APITestCase):
|
||||
|
@ -16,6 +16,7 @@
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from rest_framework_extensions.routers import ExtendedDefaultRouter
|
||||
|
||||
from ara.api import views
|
||||
|
||||
router = ExtendedDefaultRouter(trailing_slash=False)
|
||||
|
@ -1,8 +1,9 @@
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from envparse import env
|
||||
|
||||
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__))))
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
from django.urls import include, path
|
||||
from django.contrib import admin
|
||||
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [path("api/v1/", include("ara.api.urls")), path("admin/", admin.site.urls)]
|
||||
|
3
pyproject.toml
Normal file
3
pyproject.toml
Normal file
@ -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]
|
||||
skip_authors = 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
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
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 html
|
||||
|
||||
[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
|
||||
[testenv:format]
|
||||
commands =
|
||||
black --diff --check ara
|
||||
isort --recursive --check-only --diff --virtual-env {envdir} ara
|
||||
|
Loading…
x
Reference in New Issue
Block a user