From a333be8fe4ec0abc49e85d0c689b8ffba2a473eb Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Fri, 17 May 2013 12:54:12 -0700 Subject: Switch to flake8+hacking. Remove a bunch of local custom scripts. Replace with configurable external tools. Use local hacking checks for nova specifics. Change-Id: I75a01375ba0ec36d2ff05abc47abe0a3f225eda5 --- nova/hacking/__init__.py | 0 nova/hacking/checks.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 nova/hacking/__init__.py create mode 100644 nova/hacking/checks.py (limited to 'nova/hacking') diff --git a/nova/hacking/__init__.py b/nova/hacking/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/nova/hacking/checks.py b/nova/hacking/checks.py new file mode 100644 index 000000000..49fbf15f4 --- /dev/null +++ b/nova/hacking/checks.py @@ -0,0 +1,31 @@ +# Copyright (c) 2012, Cloudscaling +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + + +def import_no_db_in_virt(logical_line, filename): + """Check for db calls from nova/virt + + As of grizzly-2 all the database calls have been removed from + nova/virt, and we want to keep it that way. + + N307 + """ + if "nova/virt" in filename and not filename.endswith("fake.py"): + if logical_line.startswith("from nova import db"): + yield (0, "N307: nova.db import not allowed in nova/virt/*") + + +def factory(register): + register(import_no_db_in_virt) -- cgit