From a13c830f1b2d2051b62eaf9857d4a2cbfdf2ee9a Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Thu, 22 Jun 2017 12:02:53 +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: I0f2a0cccf459c5a353f777a2be352c0faa8b18e0 --- manage.py | 2 +- setup.py | 2 +- tools/install_venv.py | 2 +- tox.ini | 22 -------------------- zun_ui/content/container/__init__.py | 2 +- zun_ui/content/container/containers/panel.py | 2 +- zun_ui/test/settings.py | 4 ++-- 7 files changed, 7 insertions(+), 29 deletions(-) diff --git a/manage.py b/manage.py index 73ed1f9..258dadc 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/setup.py b/setup.py index 566d844..db202df 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ import setuptools # setuptools if some other modules registered functions in `atexit`. # solution from: http://bugs.python.org/issue15881#msg170215 try: - import multiprocessing # noqa + import multiprocessing # noqa: F401 except ImportError: pass 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 9c76974..19ed0ac 100644 --- a/tox.ini +++ b/tox.ini @@ -43,25 +43,3 @@ commands = sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenote 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/zun_ui/content/container/__init__.py b/zun_ui/content/container/__init__.py index 6957ce5..7a74177 100644 --- a/zun_ui/content/container/__init__.py +++ b/zun_ui/content/container/__init__.py @@ -11,4 +11,4 @@ # limitations under the License. # Register the REST API URLs so they can be called from the JavaScript files -import zun_ui.api.rest_api # noqa +import zun_ui.api.rest_api # noqa: F401 diff --git a/zun_ui/content/container/containers/panel.py b/zun_ui/content/container/containers/panel.py index 673c21a..5a8d9df 100644 --- a/zun_ui/content/container/containers/panel.py +++ b/zun_ui/content/container/containers/panel.py @@ -15,7 +15,7 @@ import horizon # This panel will be loaded from horizon, because specified in enabled file. # To register REST api, import below here. -from zun_ui.api import rest_api # noqa +from zun_ui.api import rest_api # noqa: F401 class Containers(horizon.Panel): diff --git a/zun_ui/test/settings.py b/zun_ui/test/settings.py index f8f03cd..b02ee16 100644 --- a/zun_ui/test/settings.py +++ b/zun_ui/test/settings.py @@ -11,8 +11,8 @@ # 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