* With pep8 1.3.3 the exclude logic monkey patch broke causing
tools/hacking to run on openstack/common code
* Also add .git to exclude list
Fix bug 1086410
Change-Id: Ifc50ac1963c50c338432bbb4b1e15cdf58ed2128
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
Only logical lines (does not include comments) should be checked for
alphabetical import order. This patch changes N306
(imports not in alphabetical order) to run on logical lines not physical lines.
Fixes bug 1071849
Change-Id: Ib2cb92f9eb82aeed1ff5879d3e38c8961b4f06cc
Right now, any line that starts with "from" (after whitespace
removal) is considered an import line. That assumption leads to
some unsavory parsing and crashing if the line doesn't match
the expected format.
This patch checks to make sure that the word "import" is in the line
as well as starting with "from", which at least gets us a bit closer
to a reasonable assumption.
Fixes bug 1071849
Change-Id: Iab666fcd04a9aaa3a490737a173ee3189b9b8329
First of all, our pep8 exclude was excluding openstack, to trap
for not doing pep8 checks on openstack/common, which comes from elsewhere.
But, pep8 strips filenames down to basename when doing exclude checks on
them, which makes no sense. To fix this, grab the two functions from pep8,
fix them, and monkeypatch them from within hacking.py.
Patch has been submitted upstream as:
https://github.com/jcrocholl/pep8/pull/111
Also, changed the exclude to catch just openstack/common.
Change-Id: If0b18ae828e74203f84a8b6f8b4ba0100b3bbc59
recent openstack-common brought in it's own def of _() which trips
up our checking that all _ calls contain a message string.
This explicitly excludes the definition of this in function from
that check.
Fixes LP Bug #1020792.
Change-Id: If647d77a5ae5560935bb2e032331c34b896b8614
i18n stands for internationalization, while l10n stands for
localization. l18n stands for nothing.
Change-Id: Iebfe2dcbc12919875c0ecee8aa9223dc107239d7
The latest release of pep8 adds stricter rules for extraneous
whitespace within lines. This patch also addresses these new
violations acoss the codebase.
Change-Id: Ib7e50281870473df1704ed50868c5c2e26bdb02e
* cleaner output
* fix bug 980009
* Fix N201
* N306: alphabetical order imports
* N401: docstring start
* N402: one line docstring start
* N403: multi line docstring end
* Until fixed, N40* will be disabled by default
Change-Id: I9addafdaa7a1f8fb950e14a5409f661dec6c7b87
Looks like this fixes all HACKING problems that were around.
Thanks to Dina Belova and Alexander Kovalev for this work.
Change-Id: I8157f0d4890184c1216aab63ef7180ee8b7a184d
Tests so far:
N101 TODO format
N201 Except format
N301 One import per line
N302 import only modules
N303 Invalid Import
N304 Relative Import
Change-Id: I33c021b842e7199b1f5f1f699ea17f7fa5f8ca49