summaryrefslogtreecommitdiff
path: root/usr/src/tools/onbld/Checks/Comments.py
diff options
context:
space:
mode:
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