[Xfce4-commits] <midori:master> Group continuous lines of the same violation in check-style

Christian Dywan noreply at xfce.org
Sun Nov 18 16:52:09 CET 2012


Updating branch refs/heads/master
         to cdb395b2bca781d2d203bf7fdf056f45dedfc0ae (commit)
       from 86780866a76a1257b02fc92b6a6c2bcc0789c7c1 (commit)

commit cdb395b2bca781d2d203bf7fdf056f45dedfc0ae
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Nov 18 16:47:43 2012 +0100

    Group continuous lines of the same violation in check-style

 tools/check-style |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/tools/check-style b/tools/check-style
index 12a284e..e40116a 100755
--- a/tools/check-style
+++ b/tools/check-style
@@ -86,6 +86,8 @@ for filename_or_glob in sys.argv[1:]:
     for handle in handles:
         previous = ''
         i = 0
+        previous_i = 0
+        previous_violation = ''
         mode = ''
         filename = handle.name
         comment = False
@@ -103,6 +105,7 @@ for filename_or_glob in sys.argv[1:]:
                     filename = line[6:]
                     comment = False
                     curly = []
+                    previous_violation = ''
                     continue
                 if line[:2] == '@@':
                     i = int (line.split (' ')[2].split (',')[0][1:]) - 1
@@ -110,6 +113,7 @@ for filename_or_glob in sys.argv[1:]:
                 if line[0] == '-':
                     i = i -1
                 if line[0] != '+':
+                    previous_violation = ''
                     continue
                 line = line[1:]
 
@@ -117,6 +121,7 @@ for filename_or_glob in sys.argv[1:]:
             if previous == line == '':
                 print (fmt % (filename, i, 'Spurious blank line'))
                 previous = line
+                previous_violation = ''
                 continue
             previous = line
 
@@ -126,6 +131,7 @@ for filename_or_glob in sys.argv[1:]:
             if comment:
                 if '*/' in line and not '/*' in line:
                     comment = False
+                previous_violation = ''
                 continue
 
             cleaned = line
@@ -141,6 +147,7 @@ for filename_or_glob in sys.argv[1:]:
                     print (curly[-1][1])
                     print (line)
                     curly.pop()
+                    previous_violation = ''
                     continue
                 curly.pop()
 
@@ -157,6 +164,9 @@ for filename_or_glob in sys.argv[1:]:
             for violation in violations:
                 if violation[0].search (cleaned):
                     violated = True
+                    if previous_violation != '' and violation == previous_violation:
+                        continue
+                    previous_violation = violation
                     print (fmt % (filename, i, violation[1]))
             if violated:
                 print (line)


More information about the Xfce4-commits mailing list