summaryrefslogtreecommitdiff
path: root/usr/src/tools/onbld/Checks/Comments.py
diff options
context:
space:
mode:
authorAndy Fiddaman <omnios@citrus-it.co.uk>2019-02-11 11:08:45 +0000
committerAndy Fiddaman <omnios@citrus-it.co.uk>2019-03-01 10:08:39 +0000
commit18ce2efc2fad1ecfa25d6faac23d49fb479d2f00 (patch)
treed9191bb0e5a142a48eb24d6fb9c7e8e42ed862d3 /usr/src/tools/onbld/Checks/Comments.py
parentd8fc057eca26611d58b48e7ed8fe8735d50c8cb5 (diff)
downloadillumos-joyent-18ce2efc2fad1ecfa25d6faac23d49fb479d2f00.tar.gz
10386 pbchk should catch capitalised "illumos"
10387 pbchk should check commit message spelling Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Gergő Mihály Doma <domag02@gmail.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/tools/onbld/Checks/Comments.py')
-rw-r--r--usr/src/tools/onbld/Checks/Comments.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/usr/src/tools/onbld/Checks/Comments.py b/usr/src/tools/onbld/Checks/Comments.py
index 4b4706618b..8285be2daa 100644
--- a/usr/src/tools/onbld/Checks/Comments.py
+++ b/usr/src/tools/onbld/Checks/Comments.py
@@ -26,17 +26,19 @@
#
# Copyright 2007, 2010 Richard Lowe
-# Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
#
# Check delta comments:
# - Have the correct form.
# - Have a synopsis matching that of the bug
# - Appear only once.
+# - Do not contain common spelling errors.
#
import re, sys
from onbld.Checks.DbLookups import BugDB
+from onbld.Checks.SpellCheck import spellcheck_line
bugre = re.compile(r'^(\d{2,7}) (.*)$')
@@ -71,12 +73,16 @@ def comchk(comments, check_db=True, output=sys.stderr):
'mutant': [],
'dup': [],
'nomatch': [],
- 'nonexistent': [] }
+ 'nonexistent': [],
+ 'spelling': [] }
bugs = {}
ret = 0
blanks = False
+ lineno = 0
for com in comments:
+ lineno += 1
+
# Our input must be newline-free, comments are line-wise.
if com.find('\n') != -1:
raise ValueError("newline in comment '%s'" % com)
@@ -89,6 +95,10 @@ def comchk(comments, check_db=True, output=sys.stderr):
blanks = True
continue
+ for err in spellcheck_line(com):
+ errors['spelling'].append(
+ 'comment line {} - {}'.format(lineno, err))
+
match = bugre.search(com)
if match:
if match.group(1) not in bugs:
@@ -179,4 +189,10 @@ def comchk(comments, check_db=True, output=sys.stderr):
output.write(" should be: '%s'\n" % err[1])
output.write(" is: '%s'\n" % err[2])
+ if errors['spelling']:
+ ret = 1
+ output.write("Spellcheck:\n")
+ for err in errors['spelling']:
+ output.write('{}\n'.format(err))
+
return ret