diff --git a/tools/check_i18n.py b/tools/check_i18n.py index 705b2d3dd..b33055172 100644 --- a/tools/check_i18n.py +++ b/tools/check_i18n.py @@ -21,7 +21,7 @@ import sys def is_localized(node): - """ Check message wrapped by _() """ + """Check message wrapped by _()""" if isinstance(node.parent, compiler.ast.CallFunc): if isinstance(node.parent.node, compiler.ast.Name): if node.parent.node.name == '_': @@ -119,7 +119,7 @@ if __name__ == '__main__': cfg_path = sys.argv[2] try: cfg_mod = imp.load_source('', cfg_path) - except: + except Exception: print >> sys.stderr, "Load cfg module failed" sys.exit(1) diff --git a/tools/i18n_cfg.py b/tools/i18n_cfg.py index 23894a938..92e707726 100644 --- a/tools/i18n_cfg.py +++ b/tools/i18n_cfg.py @@ -3,7 +3,7 @@ import re def is_log_callfunc(n): - """ LOG.xxx('hello %s' % xyz) and LOG('hello') """ + """LOG.xxx('hello %s' % xyz) and LOG('hello')""" if isinstance(n.parent, compiler.ast.Mod): n = n.parent if isinstance(n.parent, compiler.ast.CallFunc): @@ -16,7 +16,7 @@ def is_log_callfunc(n): def is_log_i18n_msg_with_mod(n): - """ LOG.xxx("Hello %s" % xyz) should be LOG.xxx("Hello %s", xyz) """ + """LOG.xxx("Hello %s" % xyz) should be LOG.xxx("Hello %s", xyz)""" if not isinstance(n.parent.parent, compiler.ast.Mod): return False n = n.parent.parent @@ -30,7 +30,7 @@ def is_log_i18n_msg_with_mod(n): def is_wrong_i18n_format(n): - """ Check _('hello %s' % xyz) """ + """Check _('hello %s' % xyz)""" if isinstance(n.parent, compiler.ast.Mod): n = n.parent if isinstance(n.parent, compiler.ast.CallFunc): diff --git a/tools/test-requires b/tools/test-requires index a92a6d26f..706f878d6 100644 --- a/tools/test-requires +++ b/tools/test-requires @@ -5,6 +5,7 @@ discover distribute>=0.6.24 fixtures>=0.3.12 flake8 +hacking mock>=1.0b1 mox==0.5.3 nose diff --git a/tox.ini b/tox.ini index 99cd84376..b638c0d42 100644 --- a/tox.ini +++ b/tox.ini @@ -38,8 +38,12 @@ commands = {posargs} # E711/E712 comparison to False should be 'if cond is False:' or 'if not cond:' # query = query.filter(Component.disabled == False) # E125 continuation line does not distinguish itself from next logical line -# H hacking.py - automatic checks of rules in HACKING.rst -ignore = E711,E712,E125,H +# H301 one import per line +# H302 import only modules +# TODO(marun) H404 multi line docstring should start with a summary +# TODO(marun) H901,902 use the not operator inline for clarity +# TODO(markmcclain) H202 assertRaises Exception too broad +ignore = E711,E712,E125,H301,H302,H404,H901,H902,H202 show-source = true builtins = _ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools