Title: [125952] trunk/Tools
Revision
125952
Author
commit-qu...@webkit.org
Date
2012-08-17 17:08:21 -0700 (Fri, 17 Aug 2012)

Log Message

[chromium] Add a style check for #include "cc/..." in chromium files
https://bugs.webkit.org/show_bug.cgi?id=94382

Patch by James Robinson <jam...@chromium.org> on 2012-08-17
Reviewed by Adam Barth.

Adds a style check to make sure new chromium code follows the correct convention for including cc files.

* Scripts/webkitpy/style/checkers/cpp.py:
(check_include_line):
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(OrderOfIncludesTest.test_check_cc_includes):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (125951 => 125952)


--- trunk/Tools/ChangeLog	2012-08-18 00:06:39 UTC (rev 125951)
+++ trunk/Tools/ChangeLog	2012-08-18 00:08:21 UTC (rev 125952)
@@ -1,3 +1,17 @@
+2012-08-17  James Robinson  <jam...@chromium.org>
+
+        [chromium] Add a style check for #include "cc/..." in chromium files
+        https://bugs.webkit.org/show_bug.cgi?id=94382
+
+        Reviewed by Adam Barth.
+
+        Adds a style check to make sure new chromium code follows the correct convention for including cc files.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        (check_include_line):
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+        (OrderOfIncludesTest.test_check_cc_includes):
+
 2012-08-17  Ojan Vafai  <o...@chromium.org>
 
         Delete some dead code from the flakiness dashboard

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (125951 => 125952)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2012-08-18 00:06:39 UTC (rev 125951)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2012-08-18 00:08:21 UTC (rev 125952)
@@ -2747,6 +2747,10 @@
         error(line_number, 'build/include', 4,
               'wtf includes should be <wtf/file.h> instead of "wtf/file.h".')
 
+    if filename.find('/chromium/') != -1 and include.startswith('cc/CC'):
+        error(line_number, 'build/include', 4,
+              'cc includes should be "CCFoo.h" instead of "cc/CCFoo.h".')
+
     duplicate_header = include in include_state
     if duplicate_header:
         error(line_number, 'build/include', 4,

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (125951 => 125952)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2012-08-18 00:06:39 UTC (rev 125951)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2012-08-18 00:08:21 UTC (rev 125952)
@@ -2736,6 +2736,15 @@
                                          'wtf includes should be <wtf/file.h> instead of "wtf/file.h".'
                                          '  [build/include] [4]')
 
+    def test_check_cc_includes(self):
+        self.assert_language_rules_check('bar/chromium/foo.cpp',
+                                         '#include "config.h"\n'
+                                         '#include "foo.h"\n'
+                                         '\n'
+                                         '#include "cc/CCProxy.h"\n',
+                                         'cc includes should be "CCFoo.h" instead of "cc/CCFoo.h".'
+                                         '  [build/include] [4]')
+
     def test_classify_include(self):
         classify_include = cpp_style._classify_include
         include_state = cpp_style._IncludeState()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to