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: Ieeb62e8d66e626ab2e6cd506ce3a9854c69d5643
This commit is contained in:
Shu Muto 2017-06-22 13:59:39 +09:00
parent 158ea608a4
commit 32aeaeffe6
6 changed files with 6 additions and 28 deletions

View File

@ -13,4 +13,4 @@
# limitations under the License.
# Import REST modules here
from . import magnum # noqa
from . import magnum # noqa: F401

View File

@ -18,7 +18,7 @@ import horizon
# DO NOT REMOVE
# This needs for register url of REST API.
# Dashboard plugins load REST API from here.
from magnum_ui.api.rest import magnum # noqa
from magnum_ui.api.rest import magnum # noqa: F401
class Clusters(horizon.Panel):

View File

@ -13,8 +13,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

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

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

22
tox.ini
View File

@ -67,25 +67,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