diff options
author | Dan Smith <danms@us.ibm.com> | 2012-11-08 15:37:44 -0800 |
---|---|---|
committer | Dan Smith <danms@us.ibm.com> | 2012-11-12 12:37:33 -0800 |
commit | 9471282626e004296351a4a97fb51209a53e7f42 (patch) | |
tree | 1021b8a2bc0637cfa04fa7fb12b6cde592c5682d /tools/hacking.py | |
parent | f0b67f77818fa8a0c0201212ba71344ebe7881cb (diff) | |
download | nova-9471282626e004296351a4a97fb51209a53e7f42.tar.gz nova-9471282626e004296351a4a97fb51209a53e7f42.tar.xz nova-9471282626e004296351a4a97fb51209a53e7f42.zip |
Ban db import from nova/virt
This makes hacking.py complain if someone adds something like:
from nova import db
into any of the files in nova/virt/* (aside from the fake.py file).
It also removes the rest of the dangling db imports that are no
longer needed.
Yay!
Change-Id: Iba3d53b87e65e33a55f8e5033b5d1d33b28d12f7
Diffstat (limited to 'tools/hacking.py')
-rwxr-xr-x | tools/hacking.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/hacking.py b/tools/hacking.py index a22e1c6ff..91d8fde60 100755 --- a/tools/hacking.py +++ b/tools/hacking.py @@ -271,6 +271,13 @@ def nova_import_alphabetical(logical_line, line_number, lines): % (split_previous[1], split_line[1])) +def nova_import_no_db_in_virt(logical_line, filename): + if ("nova/virt" in filename and + not filename.endswith("fake.py") and + "nova import db" in logical_line): + yield (0, "NOVA N307: nova.db import not allowed in nova/virt/*") + + def nova_docstring_start_space(physical_line): """Check for docstring not start with space. |