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
This commit is contained in:
parent
f0b67f7781
commit
9471282626
@ -33,6 +33,7 @@ Imports
|
||||
- Do not import objects, only modules (*)
|
||||
- Do not import more than one module per line (*)
|
||||
- Do not make relative imports
|
||||
- Do not make new nova.db imports in nova/virt/*
|
||||
- Order your imports by the full module path
|
||||
- Organize your imports according to the following template
|
||||
|
||||
|
@ -22,7 +22,6 @@ import os
|
||||
import uuid
|
||||
|
||||
from nova import config
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
|
@ -15,9 +15,6 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
from nova import db
|
||||
|
||||
|
||||
class VirtAPI(object):
|
||||
def instance_update(self, context, instance_uuid, updates):
|
||||
"""Perform an instance update operation on behalf of a virt driver
|
||||
|
@ -48,7 +48,6 @@ from eventlet import timeout
|
||||
|
||||
from nova import config
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
|
@ -24,7 +24,6 @@ import logging
|
||||
from nova.compute import task_states
|
||||
from nova.compute import vm_states
|
||||
from nova import context
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import notifications
|
||||
from nova.openstack.common import jsonutils
|
||||
|
@ -23,7 +23,6 @@ import urlparse
|
||||
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova import config
|
||||
from nova import db
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova.openstack.common import cfg
|
||||
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user