summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJoe Gordon <jogo@cloudscaling.com>2012-08-21 10:00:17 -0700
committerJoe Gordon <jogo@cloudscaling.com>2012-08-22 10:52:05 -0700
commit6109970e2a5598fd32049bcd5b3fd49b332a843d (patch)
tree11a9d8e111ebbb7b39701627340291daeff3e077 /tools
parent5dc0039c85957502db36b7da5558f9449cd03ada (diff)
downloadnova-6109970e2a5598fd32049bcd5b3fd49b332a843d.tar.gz
nova-6109970e2a5598fd32049bcd5b3fd49b332a843d.tar.xz
nova-6109970e2a5598fd32049bcd5b3fd49b332a843d.zip
Fix hacking.py git checks to propagate errors
Now when N801 or N802 is hit tools/hacking.py will return -1. Fix bug 1039697 Change-Id: I9f6950a4396ae82861e5de0e4f3ba8b482c4fdf8
Diffstat (limited to 'tools')
-rwxr-xr-xtools/hacking.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/hacking.py b/tools/hacking.py
index 88d074794..096cf7786 100755
--- a/tools/hacking.py
+++ b/tools/hacking.py
@@ -436,7 +436,7 @@ def once_git_check_commit_title():
"""
#Get title of most recent commit
- subp = subprocess.Popen(['git', 'log', '--pretty=%s', '-1'],
+ subp = subprocess.Popen(['git', 'log', '--no-merges', '--pretty=%s', '-1'],
stdout=subprocess.PIPE)
title = subp.communicate()[0]
if subp.returncode:
@@ -450,20 +450,24 @@ def once_git_check_commit_title():
'([Bb]lue[Pp]rint|[Bb][Pp])[\s\#:]*([A-Za-z0-9\\-]+)')
GIT_REGEX = re.compile(git_keywords)
+ error = False
#NOTE(jogo) if match regex but over 3 words, acceptable title
if GIT_REGEX.search(title) is not None and len(title.split()) <= 3:
print ("N801: git commit title ('%s') should provide an accurate "
"description of the change, not just a reference to a bug "
"or blueprint" % title.strip())
+ error = True
if len(title.decode('utf-8')) > 72:
print ("N802: git commit title ('%s') should be under 50 chars"
% title.strip())
+ error = True
+ return error
if __name__ == "__main__":
#include nova path
sys.path.append(os.getcwd())
#Run once tests (not per line)
- once_git_check_commit_title()
+ once_error = once_git_check_commit_title()
#NOVA error codes start with an N
pep8.ERRORCODE_REGEX = re.compile(r'[EWN]\d{3}')
add_nova()
@@ -473,6 +477,7 @@ if __name__ == "__main__":
pep8.input_dir = input_dir
try:
pep8._main()
+ sys.exit(once_error)
finally:
if len(_missingImport) > 0:
print >> sys.stderr, ("%i imports missing in this test environment"