diff --git a/HACKING.rst b/HACKING.rst index 2034960..d61568e 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -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, diff --git a/hacking/core.py b/hacking/core.py index 61a5188..88c8961 100755 --- a/hacking/core.py +++ b/hacking/core.py @@ -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' diff --git a/setup.cfg b/setup.cfg index b59a1e6..9215d67 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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