diff --git a/Makefile b/Makefile index d1f2f03dd365..5a2426925854 100644 --- a/Makefile +++ b/Makefile @@ -228,6 +228,9 @@ pep8: pyflakes: pyflakes awx/ +check: + flake8 + # Run all API unit tests. test: $(PYTHON) manage.py test -v2 awx.main.tests diff --git a/awx/__init__.py b/awx/__init__.py index 69798f7c0008..723c25e5fca9 100644 --- a/awx/__init__.py +++ b/awx/__init__.py @@ -12,7 +12,7 @@ # Check for the presence/absence of "devonly" module to determine if running # from a source code checkout or release packaage. try: - import awx.devonly + import awx.devonly # noqa MODE = 'development' except ImportError: # pragma: no cover MODE = 'production' @@ -57,7 +57,7 @@ def prepare_env(): import six sys.modules['django.utils.six'] = sys.modules['six'] django.utils.six = sys.modules['django.utils.six'] - from django.utils import six + from django.utils import six # noqa # Use the AWX_TEST_DATABASE_* environment variables to specify the test # database settings to use when management command is run as an external # program via unit tests. diff --git a/awx/api/generics.py b/awx/api/generics.py index 344d67b28a56..2e7f07a753d7 100644 --- a/awx/api/generics.py +++ b/awx/api/generics.py @@ -4,18 +4,15 @@ # Python import inspect import logging -import json import time # Django from django.http import Http404 from django.conf import settings -from django.contrib.auth.models import User from django.db import connection from django.shortcuts import get_object_or_404 from django.template.loader import render_to_string from django.utils.safestring import mark_safe -from django.utils.timezone import now # Django REST Framework from rest_framework.authentication import get_authorization_header @@ -27,8 +24,8 @@ from rest_framework import views # AWX -from awx.main.models import * -from awx.main.utils import * +from awx.main.models import * # noqa +from awx.main.utils import * # noqa __all__ = ['APIView', 'GenericAPIView', 'ListAPIView', 'SimpleListAPIView', 'ListCreateAPIView', 'SubListAPIView', 'SubListCreateAPIView', diff --git a/awx/urls.py b/awx/urls.py index e34cf24a4639..0ed703c9360d 100644 --- a/awx/urls.py +++ b/awx/urls.py @@ -1,20 +1,17 @@ # Copyright (c) 2014 AnsibleWorks, Inc. # All Rights Reserved. -from django.conf import settings -from django.conf.urls import * +from django.conf.urls import url, patterns, include handler403 = 'awx.main.views.handle_403' handler404 = 'awx.main.views.handle_404' handler500 = 'awx.main.views.handle_500' urlpatterns = patterns('', - url(r'', include('awx.ui.urls', namespace='ui', app_name='ui')), - url(r'^api/', include('awx.api.urls', namespace='api', app_name='api')), -) + url(r'', include('awx.ui.urls', namespace='ui', app_name='ui')), + url(r'^api/', include('awx.api.urls', namespace='api', app_name='api'))) urlpatterns += patterns('awx.main.views', - url(r'^403.html$', 'handle_403'), - url(r'^404.html$', 'handle_404'), - url(r'^500.html$', 'handle_500'), -) + url(r'^403.html$', 'handle_403'), + url(r'^404.html$', 'handle_404'), + url(r'^500.html$', 'handle_500')) diff --git a/awx/wsgi.py b/awx/wsgi.py index 8e676cb7ca97..d616c0400401 100644 --- a/awx/wsgi.py +++ b/awx/wsgi.py @@ -14,9 +14,7 @@ from awx import prepare_env prepare_env() -import os import logging -from django.conf import settings from awx import __version__ as tower_version logger = logging.getLogger('awx.main.models.jobs') try: diff --git a/setup.cfg b/setup.cfg index 5eb8ec9ecbb6..60a00cde1e79 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,3 +15,7 @@ # W293 - Blank line contains whitespace ignore=E201,E203,E221,E225,E231,E241,E251,E261,E265,E302,E303,E501,W291,W391,W293 exclude=awx/lib/site-packages,awx/ui,awx/api/urls.py,awx/main/migrations,awx/main/tests/data + +[flake8] +ignore=E201,E203,E221,E225,E231,E241,E251,E261,E265,E302,E303,E501,W291,W391,W293 +exclude=awx/lib/site-packages,awx/ui,awx/api/urls.py,awx/main/migrations,awx/main/tests/data diff --git a/setup.py b/setup.py index 21e43e440d81..85dd2ee0badb 100755 --- a/setup.py +++ b/setup.py @@ -3,10 +3,12 @@ # Copyright (c) 2014 AnsibleWorks, Inc. # All Rights Reserved. -import os, datetime, glob, sys, shutil -from distutils import log -from setuptools import setup, find_packages -from setuptools.command.sdist import sdist as _sdist +import os +import datetime +import glob +import sys +import shutil +from setuptools import setup from awx import __version__ @@ -113,26 +115,22 @@ def proc_data_files(data_files): ], }, data_files = proc_data_files([ - ("%s" % homedir, ["config/wsgi.py", - "awx/static/favicon.ico", - ]), - ("%s" % webconfig, ["config/awx-httpd-80.conf", - "config/awx-httpd-443.conf", - "config/awx-munin.conf", - ]), - ("%s" % sharedir, ["tools/scripts/request_tower_configuration.sh",]), - ("%s" % munin_plugin_path, ["tools/munin_monitors/tower_jobs", - "tools/munin_monitors/callbackr_alive", - "tools/munin_monitors/celery_alive", - "tools/munin_monitors/postgres_alive", - "tools/munin_monitors/redis_alive", - "tools/munin_monitors/socketio_alive", - "tools/munin_monitors/taskmanager_alive"]), - ("%s" % munin_plugin_conf_path, ["config/awx_munin_tower_jobs"]), - ("%s" % sysinit, ["tools/scripts/ansible-tower"]), - ("%s" % sosconfig, ["tools/sosreport/tower.py"]), - ] - ), + ("%s" % homedir, ["config/wsgi.py", + "awx/static/favicon.ico"]), + ("%s" % webconfig, ["config/awx-httpd-80.conf", + "config/awx-httpd-443.conf", + "config/awx-munin.conf"]), + ("%s" % sharedir, ["tools/scripts/request_tower_configuration.sh",]), + ("%s" % munin_plugin_path, ["tools/munin_monitors/tower_jobs", + "tools/munin_monitors/callbackr_alive", + "tools/munin_monitors/celery_alive", + "tools/munin_monitors/postgres_alive", + "tools/munin_monitors/redis_alive", + "tools/munin_monitors/socketio_alive", + "tools/munin_monitors/taskmanager_alive"]), + ("%s" % munin_plugin_conf_path, ["config/awx_munin_tower_jobs"]), + ("%s" % sysinit, ["tools/scripts/ansible-tower"]), + ("%s" % sosconfig, ["tools/sosreport/tower.py"])]), options = { 'egg_info': { 'tag_build': build_timestamp,