From 64a6b4e8beb31ec6a55d4f6175f7c1a87630f929 Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Thu, 22 Jun 2017 14:08:12 +0900 Subject: [PATCH] hacking: Specify white list rules in noqa explicity If 'noqa' is specified all hacking checks are disabled. It is better to ignore specific rules explicitly rather than ignoring all. The recent flake8 supports this [1]. [1] http://flake8.pycqa.org/en/stable/user/ignoring-errors.html Change-Id: I4ea55a0b22f8d6c975dcc074403efe2565078e22 --- manage.py | 2 +- tools/install_venv.py | 2 +- tox.ini | 22 ---------------------- zaqar_ui/api/__init__.py | 2 +- zaqar_ui/api/rest/__init__.py | 2 +- zaqar_ui/content/queues/__init__.py | 2 +- zaqar_ui/test/settings.py | 4 ++-- 7 files changed, 7 insertions(+), 29 deletions(-) diff --git a/manage.py b/manage.py index 5818a6d..df691be 100755 --- a/manage.py +++ b/manage.py @@ -15,7 +15,7 @@ import os import sys -from django.core.management import execute_from_command_line # noqa +from django.core.management import execute_from_command_line if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", diff --git a/tools/install_venv.py b/tools/install_venv.py index e96521e..88b1963 100644 --- a/tools/install_venv.py +++ b/tools/install_venv.py @@ -20,7 +20,7 @@ import os import sys -import install_venv_common as install_venv # noqa +import install_venv_common as install_venv def print_help(venv, root): diff --git a/tox.ini b/tox.ini index 137f1f1..bfdedd3 100644 --- a/tox.ini +++ b/tox.ini @@ -60,25 +60,3 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules max-complexity = 20 -[hacking] -import_exceptions = collections.defaultdict, - django.conf.settings, - django.conf.urls.include, - django.conf.urls.patterns, - django.conf.urls.url, - django.core.urlresolvers.reverse, - django.core.urlresolvers.reverse_lazy, - django.template.loader.render_to_string, - django.test.utils.override_settings, - django.utils.datastructures.SortedDict, - django.utils.encoding.force_text, - django.utils.html.conditional_escape, - django.utils.html.escape, - django.utils.http.urlencode, - django.utils.safestring.mark_safe, - django.utils.translation.npgettext_lazy, - django.utils.translation.pgettext_lazy, - django.utils.translation.ugettext_lazy, - django.utils.translation.ungettext_lazy, - operator.attrgetter, - StringIO.StringIO diff --git a/zaqar_ui/api/__init__.py b/zaqar_ui/api/__init__.py index 1613ce2..b185f53 100644 --- a/zaqar_ui/api/__init__.py +++ b/zaqar_ui/api/__init__.py @@ -27,4 +27,4 @@ shouldn't need to understand the finer details of APIs for Keystone/Nova/Glance/Swift et. al. """ -from zaqar_ui.api import zaqar # noqa +from zaqar_ui.api import zaqar # noqa: F401 diff --git a/zaqar_ui/api/rest/__init__.py b/zaqar_ui/api/rest/__init__.py index 1313cb9..d42f488 100644 --- a/zaqar_ui/api/rest/__init__.py +++ b/zaqar_ui/api/rest/__init__.py @@ -21,4 +21,4 @@ in https://wiki.openstack.org/wiki/APIChangeGuidelines. """ # import REST API modules here -from zaqar_ui.api.rest import zaqar # noqa +from zaqar_ui.api.rest import zaqar # noqa: F401 diff --git a/zaqar_ui/content/queues/__init__.py b/zaqar_ui/content/queues/__init__.py index 1abbb24..7a8f5d6 100644 --- a/zaqar_ui/content/queues/__init__.py +++ b/zaqar_ui/content/queues/__init__.py @@ -13,4 +13,4 @@ # limitations under the License. # Register the REST API URLs so they can be called from the JavaScript files -import zaqar_ui.api.rest # noqa +import zaqar_ui.api.rest # noqa: F401 diff --git a/zaqar_ui/test/settings.py b/zaqar_ui/test/settings.py index b33d753..3d369c8 100644 --- a/zaqar_ui/test/settings.py +++ b/zaqar_ui/test/settings.py @@ -11,8 +11,8 @@ # limitations under the License. # Default to Horizons test settings to avoid any missing keys -from horizon.test.settings import * # noqa -from openstack_dashboard.test.settings import * # noqa +from horizon.test.settings import * # noqa: F403,H303 +from openstack_dashboard.test.settings import * # noqa: F403,H303 # pop these keys to avoid log warnings about deprecation # update_dashboards will populate them anyway