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
This commit is contained in:
Akihiro Motoki 2017-05-26 16:27:13 +09:00
parent ffe0ddcdb2
commit 2a88471fe8
4 changed files with 4 additions and 27 deletions

View File

@ -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",

View File

@ -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

View File

@ -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):

View File

@ -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