check-webkit-style should check the order of #imports as well as #includes
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Jun 2014 05:51:13 +0000 (05:51 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 28 Jun 2014 05:51:13 +0000 (05:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134428

Reviewed by Dan Bernstein.

* Scripts/webkitpy/style/checkers/cpp.py:
Allow "import" in addition to "include", so that the sort order of headers in ObjC files is checked.

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

Tools/ChangeLog
Tools/Scripts/webkitpy/style/checkers/cpp.py

index 9f824e66531723592175f413498de797f43bf4e3..fcbf67a4374c1ea6693e83ef4031219804b1a875 100644 (file)
@@ -1,3 +1,13 @@
+2014-06-27  Tim Horton  <timothy_horton@apple.com>
+
+        check-webkit-style should check the order of #imports as well as #includes
+        https://bugs.webkit.org/show_bug.cgi?id=134428
+
+        Reviewed by Dan Bernstein.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        Allow "import" in addition to "include", so that the sort order of headers in ObjC files is checked.
+
 2014-06-27  Michał Pakuła vel Rutka  <m.pakula@samsung.com>
 
         [EFL] Remove efl-wk2 from baseline search path
index ea59783ca086b8180c7292af8b53f4744d57385e..1b9e0da4ebb0aeb6bb6be6d6fca9c23245007033 100644 (file)
@@ -2771,8 +2771,8 @@ def check_style(clean_lines, line_number, file_extension, class_state, file_stat
     check_enum_casing(clean_lines, line_number, enum_state, error)
 
 
-_RE_PATTERN_INCLUDE_NEW_STYLE = re.compile(r'#include +"[^/]+\.h"')
-_RE_PATTERN_INCLUDE = re.compile(r'^\s*#\s*include\s*([<"])([^>"]*)[>"].*$')
+_RE_PATTERN_INCLUDE_NEW_STYLE = re.compile(r'#(?:include|import) +"[^/]+\.h"')
+_RE_PATTERN_INCLUDE = re.compile(r'^\s*#\s*(?:include|import)\s*([<"])([^>"]*)[>"].*$')
 # Matches the first component of a filename delimited by -s and _s. That is:
 #  _RE_FIRST_COMPONENT.match('foo').group(0) == 'foo'
 #  _RE_FIRST_COMPONENT.match('foo.cpp').group(0) == 'foo'