https://bugs.webkit.org/show_bug.cgi?id=66425
authordslomov@google.com <dslomov@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Aug 2011 11:43:51 +0000 (11:43 +0000)
committerdslomov@google.com <dslomov@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Aug 2011 11:43:51 +0000 (11:43 +0000)
check-webkit-style should detect incorrectly formatted file change descriptions.
Description, if present, should be separated from colon with a space.

Reviewed by David Levin.

* Scripts/webkitpy/style/checkers/changelog.py: Fix.
* Scripts/webkitpy/style/checkers/changelog_unittest.py: Unit tests.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93297 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/style/checkers/changelog.py
Tools/Scripts/webkitpy/style/checkers/changelog_unittest.py

index a565d8c..e91f723 100644 (file)
@@ -1,3 +1,14 @@
+2011-08-18  Dmitry Lomov  <dslomov@google.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=66425
+        check-webkit-style should detect incorrectly formatted file change descriptions.
+        Description, if present, should be separated from colon with a space.
+
+        Reviewed by David Levin.
+
+        * Scripts/webkitpy/style/checkers/changelog.py: Fix.
+        * Scripts/webkitpy/style/checkers/changelog_unittest.py: Unit tests.
+
 2011-08-18  Adam Barth  <abarth@webkit.org>
 
         webkit-patch pretty-diff should be shown in main help
index bb857dc..acb4073 100644 (file)
@@ -54,6 +54,19 @@ class ChangeLogChecker(object):
             self.handle_style_error(first_line_checked,
                                     "changelog/bugnumber", 5,
                                     "ChangeLog entry has no bug number")
+        # check file change descriptions for style violations
+        line_no = first_line_checked - 1
+        for line in entry_lines:
+            line_no = line_no + 1
+            # filter file change descriptions
+            if not re.match('\s*\*\s', line):
+                continue
+            if re.search(':\s*$', line) or re.search(':\s', line):
+                continue
+            self.handle_style_error(line_no,
+                                    "changelog/filechangedescriptionwhitespace", 5,
+                                    "Need whitespace between colon and description")
+
 
     def check(self, lines):
         self._tab_checker.check(lines)
index 02296d3..842eaa1 100644 (file)
@@ -105,6 +105,23 @@ class ChangeLogCheckerTest(unittest.TestCase):
                           '\n'
                           '        No bug in this change.\n')
 
+    def test_file_descriptions(self):
+        self.assert_error(5, range(1, 20), 'changelog/filechangedescriptionwhitespace',
+                          '2011-01-01 Dmitry Lomov  <dslomov@google.com>\n'
+                          '        ExampleBug\n'
+                          '        http://bugs.webkit.org/show_bug.cgi?id=12345\n'
+                          '\n'
+                          '        *  Source/Tools/random-script.py:Fixed')
+        self.assert_error(6, range(1, 20), 'changelog/filechangedescriptionwhitespace',
+                          '2011-01-01 Dmitry Lomov  <dslomov@google.com>\n'
+                          '        ExampleBug\n'
+                          '        http://bugs.webkit.org/show_bug.cgi?id=12345\n'
+                          '\n'
+                          '        *  Source/Tools/another-file: Done\n'
+                          '        *  Source/Tools/random-script.py:Fixed\n'
+                          '        *  Source/Tools/one-morefile:\n')
+
+
     def test_no_error(self):
         self.assert_no_error([],
                              '2011-01-01  Patrick Gansterer  <paroga@paroga.com>\n'
@@ -150,6 +167,13 @@ class ChangeLogCheckerTest(unittest.TestCase):
                              '\n'
                              '2011-01-01  Patrick Gansterer  <paroga@paroga.com>\n'
                              '        No bug here!\n')
+        self.assert_no_error(range(1, 20),
+                             '2011-01-01  Patrick Gansterer  <paroga@paroga.com>\n'
+                             '        Example bug\n'
+                             '        https://bugs.webkit.org/show_bug.cgi?id=12345\n'
+                             '        * Source/WebKit/foo.cpp:    \n'
+                             '        * Source/WebKit/bar.cpp:\n'
+                             '        * Source/WebKit/foobar.cpp: Description\n')
 
 if __name__ == '__main__':
     unittest.main()