Add check for end of title line of commit messages

The end of the title line of commit messages should not end with a
period. This is because space is limited to 50 chars and because we
treat this line like the subject line of emails.

Add this incredibly nitpicky style check to avoid any doubt over what
the correct style is.

Change-Id: I162ed090fbaef4f111792fdb89b31c2cab993b22
This commit is contained in:
Mark McLoughlin
2013-06-20 10:30:07 +01:00
parent a6bef44f42
commit da408d997d
3 changed files with 23 additions and 1 deletions

View File

@@ -272,7 +272,8 @@ readable. Follow these guidelines:
The first line of the commit message should provide an accurate
description of the change, not just a reference to a bug or
blueprint. It must be followed by a single blank line.
blueprint. It must not end with a period and must be followed by
a single blank line.
If the change relates to a specific driver (libvirt, xenapi, qpid, etc...),
begin the first line of the commit message with the driver name, lowercased,

View File

@@ -779,6 +779,26 @@ class OnceGitCheckCommitTitleLength(GitCheck):
self.name)
class OnceGitCheckCommitTitlePeriodEnding(GitCheck):
"""Check the end of the first line of git commit messages.
The first line of git commit message should not end with a period.
H803 Commit message should not end with a period
"""
name = "GitCheckCommitTitlePeriodEnding"
def run_once(self):
title = self._get_commit_title()
if title.rstrip().endswith('.'):
return (
1, 0,
"H803: git commit title ('%s') should not end with period"
% title.strip(),
self.name)
class ProxyChecks(GlobalCheck):
"""Provide a mechanism for locally defined checks."""
name = 'ProxyChecker'

View File

@@ -43,6 +43,7 @@ flake8.extension =
H700 = hacking.core:hacking_localization_strings
H801 = hacking.core:OnceGitCheckCommitTitleBug
H802 = hacking.core:OnceGitCheckCommitTitleLength
H803 = hacking.core:OnceGitCheckCommitTitlePeriodEnding
H901 = hacking.core:hacking_is_not
H902 = hacking.core:hacking_not_in