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
This commit is contained in:
Shu Muto 2017-06-22 12:02:53 +09:00
parent 1efb2069dd
commit a13c830f1b
7 changed files with 7 additions and 29 deletions

View File

@ -15,7 +15,7 @@
import os import os
import sys import sys
from django.core.management import execute_from_command_line # noqa from django.core.management import execute_from_command_line
if __name__ == "__main__": if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", os.environ.setdefault("DJANGO_SETTINGS_MODULE",

View File

@ -20,7 +20,7 @@ import setuptools
# setuptools if some other modules registered functions in `atexit`. # setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215 # solution from: http://bugs.python.org/issue15881#msg170215
try: try:
import multiprocessing # noqa import multiprocessing # noqa: F401
except ImportError: except ImportError:
pass pass

View File

@ -20,7 +20,7 @@
import os import os
import sys import sys
import install_venv_common as install_venv # noqa import install_venv_common as install_venv
def print_help(venv, root): def print_help(venv, root):

22
tox.ini
View File

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

@ -11,4 +11,4 @@
# limitations under the License. # limitations under the License.
# Register the REST API URLs so they can be called from the JavaScript files # 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

View File

@ -15,7 +15,7 @@ import horizon
# This panel will be loaded from horizon, because specified in enabled file. # This panel will be loaded from horizon, because specified in enabled file.
# To register REST api, import below here. # 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): class Containers(horizon.Panel):

View File

@ -11,8 +11,8 @@
# under the License. # under the License.
# Default to Horizons test settings to avoid any missing keys # Default to Horizons test settings to avoid any missing keys
from horizon.test.settings import * # noqa from horizon.test.settings import * # noqa: F403,H303
from openstack_dashboard.test.settings import * # noqa from openstack_dashboard.test.settings import * # noqa: F403,H303
# pop these keys to avoid log warnings about deprecation # pop these keys to avoid log warnings about deprecation
# update_dashboards will populate them anyway # update_dashboards will populate them anyway