From 2a88471fe8f55e1c6b29b67d65d01262ab2d0d59 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Fri, 26 May 2017 16:27:13 +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/latest/user/ignoring-errors.html Change-Id: Ic4df7f19764e304e5975385fa2cac7dc3c42c80b --- {{cookiecutter.repo_name}}/manage.py | 2 +- {{cookiecutter.repo_name}}/tox.ini | 23 ------------------- .../content/{{cookiecutter.panel}}s/panel.py | 2 +- .../test/settings.py | 4 ++-- 4 files changed, 4 insertions(+), 27 deletions(-) diff --git a/{{cookiecutter.repo_name}}/manage.py b/{{cookiecutter.repo_name}}/manage.py index e23fa80..bb75327 100755 --- a/{{cookiecutter.repo_name}}/manage.py +++ b/{{cookiecutter.repo_name}}/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/{{cookiecutter.repo_name}}/tox.ini b/{{cookiecutter.repo_name}}/tox.ini index d5859af..d4812fd 100644 --- a/{{cookiecutter.repo_name}}/tox.ini +++ b/{{cookiecutter.repo_name}}/tox.ini @@ -65,26 +65,3 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen [flake8] exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,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/{{cookiecutter.repo_name}}/{{cookiecutter.module_name}}/content/{{cookiecutter.panel}}s/panel.py b/{{cookiecutter.repo_name}}/{{cookiecutter.module_name}}/content/{{cookiecutter.panel}}s/panel.py index 3fe938c..2864df3 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.module_name}}/content/{{cookiecutter.panel}}s/panel.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.module_name}}/content/{{cookiecutter.panel}}s/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 {{cookiecutter.module_name}}.api import rest_api # noqa +from {{cookiecutter.module_name}}.api import rest_api # noqa: F401 class {{cookiecutter.panel_func}}s(horizon.Panel): diff --git a/{{cookiecutter.repo_name}}/{{cookiecutter.module_name}}/test/settings.py b/{{cookiecutter.repo_name}}/{{cookiecutter.module_name}}/test/settings.py index 4f64344..9c40524 100644 --- a/{{cookiecutter.repo_name}}/{{cookiecutter.module_name}}/test/settings.py +++ b/{{cookiecutter.repo_name}}/{{cookiecutter.module_name}}/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