changeset 93:4d32511949b8

A missing Reviewer line is not always detected If both a bugid and Summary line were present, jcheck would accept comments that were missing the Reviewer line. The fix is to increment the grammar index only when a line will actually be processed.
author jcoomes
date Thu, 10 Oct 2013 02:09:31 -0700
parents 15fb870a6eae
children 3125d498f453
files jcheck.py mktests.sh
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/jcheck.py	Fri Sep 20 17:17:44 2013 -0700
+++ b/jcheck.py	Thu Oct 10 02:09:31 2013 -0700
@@ -438,9 +438,12 @@
             lns = filter(checked_comment_line, lns)
 
         i = 0                           # Input index
-        gi = 0                          # Grammar index
+        gi = -1                         # Grammar index
         n = 0                           # Occurrence count
         while i < len(lns):
+            gi = gi + 1
+            if gi >= len(comment_grammar):
+                break
             ln = lns[i]
             st = comment_grammar[gi]
             n = 0
@@ -461,9 +464,6 @@
                 self.error(ctx, "Incomplete comment: Missing %s" % st.name)
             if n > st.max:
                 self.error(ctx, "Too many %ss" % st.name)
-            gi = gi + 1
-            if gi >= len(comment_grammar):
-                break
 
         if not self.cs_contributor and [self.cs_author] == self.cs_reviewers:
             self.error(ctx, "Self-reviews not permitted")
--- a/mktests.sh	Fri Sep 20 17:17:44 2013 -0700
+++ b/mktests.sh	Thu Oct 10 02:09:31 2013 -0700
@@ -143,6 +143,9 @@
 fail ci -m "$(bugid): A random bug"
 
 fail ci -m "$(bugid): A random bug
+Summary: Summary line with no Reviewed-by line"
+
+fail ci -m "$(bugid): A random bug
 Reviewed-by:"
 
 fail ci -m "$(bugid): A random bug