[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:45:51 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit c84987ac32b395eeb23a74f47f7814d7f345ed49
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 16 05:03:43 2009 +0000

    2009-10-15  James Robinson  <jamesr at google.com>
    
            Reviewed by David Levin.
    
            Updates check-webkit-style to reflect that code inside a namespace should not be indented, even in a header file.
    
            https://bugs.webkit.org/show_bug.cgi?id=30426
    
            * Scripts/modules/cpp_style.py:
            * Scripts/modules/cpp_style_unittest.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49669 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 5f91f97..31f1508 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,14 @@
+2009-10-15  James Robinson  <jamesr at google.com>
+
+        Reviewed by David Levin.
+
+        Updates check-webkit-style to reflect that code inside a namespace should not be indented, even in a header file.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30426
+
+        * Scripts/modules/cpp_style.py:
+        * Scripts/modules/cpp_style_unittest.py:
+
 2009-10-15  Brian Weinstein  <bweinstein at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebKitTools/Scripts/modules/cpp_style.py b/WebKitTools/Scripts/modules/cpp_style.py
index 0c9dfa0..43e1866 100644
--- a/WebKitTools/Scripts/modules/cpp_style.py
+++ b/WebKitTools/Scripts/modules/cpp_style.py
@@ -1701,47 +1701,26 @@ def check_namespace_indentation(filename, clean_lines, line_number, file_extensi
 
     namespace_indentation = namespace_match.group('namespace_indentation')
 
-    is_header_file = file_extension == 'h'
-    is_implementation_file = not is_header_file
     line_offset = 0
 
-    if is_header_file:
-        inner_indentation = namespace_indentation + ' ' * 4
-
-        for current_line in clean_lines.raw_lines[line_number + 1:]:
-            line_offset += 1
-
-            # Skip not only empty lines but also those with preprocessor directives.
-            # Goto labels don't occur in header files, so no need to check for those.
-            if current_line.strip() == '' or current_line.startswith('#'):
-                continue
-
-            if not current_line.startswith(inner_indentation):
-                # If something unindented was discovered, make sure it's a closing brace.
-                if not current_line.startswith(namespace_indentation + '}'):
-                    error(filename, line_number + line_offset, 'whitespace/indent', 4,
-                          'In a header, code inside a namespace should be indented.')
-                break
-
-    if is_implementation_file:
-        for current_line in clean_lines.raw_lines[line_number + 1:]:
-            line_offset += 1
+    for current_line in clean_lines.raw_lines[line_number + 1:]:
+        line_offset += 1
 
-            # Skip not only empty lines but also those with (goto) labels.
-            # The goto label regexp accepts spaces or the beginning of a
-            # comment (if anything) after the initial colon.
-            if current_line.strip() == '' or match(r'\w+\s*:([\s\/].*)?$', current_line):
-                continue
+        # Skip not only empty lines but also those with (goto) labels.
+        # The goto label regexp accepts spaces or the beginning of a
+        # comment (if anything) after the initial colon.
+        if current_line.strip() == '' or match(r'\w+\s*:([\s\/].*)?$', current_line):
+            continue
 
-            remaining_line = current_line[len(namespace_indentation):]
-            if not match(r'\S', remaining_line):
-                error(filename, line_number + line_offset, 'whitespace/indent', 4,
-                      'In an implementation file, code inside a namespace should not be indented.')
+        remaining_line = current_line[len(namespace_indentation):]
+        if not match(r'\S', remaining_line):
+            error(filename, line_number + line_offset, 'whitespace/indent', 4,
+                  'Code inside a namespace should not be indented.')
 
-            # Just check the first non-empty line in any case, because
-            # otherwise we would need to count opened and closed braces,
-            # which is obviously a lot more complicated.
-            break
+        # Just check the first non-empty line in any case, because
+        # otherwise we would need to count opened and closed braces,
+        # which is obviously a lot more complicated.
+        break
 
 
 def check_using_std(filename, clean_lines, line_number, error):
diff --git a/WebKitTools/Scripts/modules/cpp_style_unittest.py b/WebKitTools/Scripts/modules/cpp_style_unittest.py
index 322356e..0ad8e05 100644
--- a/WebKitTools/Scripts/modules/cpp_style_unittest.py
+++ b/WebKitTools/Scripts/modules/cpp_style_unittest.py
@@ -2806,29 +2806,29 @@ class WebKitStyleTest(CppStyleTestBase):
             'Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]')
         # FIXME: No tests for 8-spaces.
 
-        # 3. In a header, code inside a namespace should be indented.
+        # 3. In a header, code inside a namespace should not be indented.
         self.assert_multi_line_lint(
             'namespace WebCore {\n\n'
-            '    class Document {\n'
-            '        int myVariable;\n'
-            '    };\n'
+            'class Document {\n'
+            '    int myVariable;\n'
+            '};\n'
             '}',
             '',
             'foo.h')
         self.assert_multi_line_lint(
             'namespace OuterNamespace {\n'
-            '    namespace InnerNamespace {\n'
-            '        class Document {\n'
-            '        };\n'
-            '    };\n'
+            'namespace InnerNamespace {\n'
+            'class Document {\n'
+            '};\n'
+            '};\n'
             '}',
             '',
             'foo.h')
         self.assert_multi_line_lint(
             'namespace WebCore {\n'
             '#if 0\n'
-            '    class Document {\n'
-            '    };\n'
+            'class Document {\n'
+            '};\n'
             '#endif\n'
             '}',
             '',
@@ -2838,8 +2838,7 @@ class WebKitStyleTest(CppStyleTestBase):
             'class Document {\n'
             '};\n'
             '}',
-            'In a header, code inside a namespace should be indented.'
-            '  [whitespace/indent] [4]',
+            '',
             'foo.h')
 
         # 4. In an implementation file (files with the extension .cpp, .c
@@ -2881,7 +2880,7 @@ class WebKitStyleTest(CppStyleTestBase):
             'namespace WebCore {\n'
             '    Document::Foo() { }\n'
             '}',
-            'In an implementation file, code inside a namespace should not be indented.'
+            'Code inside a namespace should not be indented.'
             '  [whitespace/indent] [4]',
             'foo.cpp')
 
@@ -3246,7 +3245,7 @@ class WebKitStyleTest(CppStyleTestBase):
             '')
         self.assert_multi_line_lint(
             'namespace WebCore {\n'
-            '    int foo;\n'
+            'int foo;\n'
             '};\n',
             '')
         self.assert_multi_line_lint(

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list