summaryrefslogtreecommitdiffstats
path: root/tools/hacking.py
diff options
context:
space:
mode:
authorJoe Gordon <jogo@cloudscaling.com>2012-03-05 14:03:46 -0800
committerJoe Gordon <jogo@cloudscaling.com>2012-03-05 14:09:57 -0800
commite8bc00eff22288c31a8ea36bf1faaa362d60d3cd (patch)
tree9b9cd26a4fd8db86dcf481ea229555d52a42e51c /tools/hacking.py
parent5f9cee0c9c95b61d548730e7918e5c623301b3b1 (diff)
downloadnova-e8bc00eff22288c31a8ea36bf1faaa362d60d3cd.tar.gz
nova-e8bc00eff22288c31a8ea36bf1faaa362d60d3cd.tar.xz
nova-e8bc00eff22288c31a8ea36bf1faaa362d60d3cd.zip
Add assertRaises check to tools/hacking.py as N202
Change-Id: I25113bcc73ff642cae146f0558f319684b4568d0
Diffstat (limited to 'tools/hacking.py')
-rwxr-xr-xtools/hacking.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/hacking.py b/tools/hacking.py
index 19317ef8f..75c795b9c 100755
--- a/tools/hacking.py
+++ b/tools/hacking.py
@@ -59,6 +59,16 @@ def nova_except_format(logical_line):
return 6, "NOVA N201: no 'except:' at least use 'except Exception:'"
+def nova_except_format(logical_line):
+ """
+ nova HACKING guide recommends not using assertRaises(Exception...):
+ Do not use overly broad Exception type
+ N202
+ """
+ if logical_line.startswith("self.assertRaises(Exception"):
+ return 1, "NOVA N202: assertRaises Exception too broad"
+
+
def nova_one_import_per_line(logical_line):
"""
nova HACKING guide recommends one import per line: