[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

eric at webkit.org eric at webkit.org
Thu Feb 4 21:30:49 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit c36235d1acd951752b5221beb5f9e977f0c1c8a7
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 28 08:45:32 2010 +0000

    2010-01-28  Chris Jerdonek  <cjerdonek at webkit.org>
    
            Reviewed by Shinichiro Hamaji.
    
            In check-webkit-style, eliminated the dependency of
            processors/cpp_unittest.py on checker.py.
    
            https://bugs.webkit.org/show_bug.cgi?id=34205
    
            * Scripts/webkitpy/style/checker.py:
              - Addressed FIXME by removing STYLE_CATEGORIES data.
              - Added style_categories().
    
            * Scripts/webkitpy/style/checker_unittest.py:
              - Minor changes.
    
            * Scripts/webkitpy/style/processors/cpp.py:
              - Added categories attribute to CppProcessor class (data
                was originally checker.STYLE_CATEGORIES).
    
            * Scripts/webkitpy/style/processors/cpp_unittest.py:
              - Addressed FIXME by eliminating "import" from checker.py.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53990 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f28c2b3..352b796 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,26 @@
+2010-01-28  Chris Jerdonek  <cjerdonek at webkit.org>
+
+        Reviewed by Shinichiro Hamaji.
+
+        In check-webkit-style, eliminated the dependency of
+        processors/cpp_unittest.py on checker.py.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34205
+
+        * Scripts/webkitpy/style/checker.py:
+          - Addressed FIXME by removing STYLE_CATEGORIES data.
+          - Added style_categories().
+
+        * Scripts/webkitpy/style/checker_unittest.py:
+          - Minor changes.
+
+        * Scripts/webkitpy/style/processors/cpp.py:
+          - Added categories attribute to CppProcessor class (data
+            was originally checker.STYLE_CATEGORIES).
+
+        * Scripts/webkitpy/style/processors/cpp_unittest.py:
+          - Addressed FIXME by eliminating "import" from checker.py.
+
 2010-01-28  Anton Muhin  <antonm at chromium.org>
 
         Reviewed by Shinichiro Hamaji.
diff --git a/WebKitTools/Scripts/webkitpy/style/checker.py b/WebKitTools/Scripts/webkitpy/style/checker.py
index b35c970..6a07ada 100644
--- a/WebKitTools/Scripts/webkitpy/style/checker.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker.py
@@ -80,83 +80,6 @@ WEBKIT_DEFAULT_FILTER_RULES = [
     ]
 
 
-# FIXME: The STYLE_CATEGORIES show up in both file types cpp_style.py
-#        and text_style.py. Break this list into possibly overlapping
-#        sub-lists, and store each sub-list in the corresponding .py
-#        file. The file style.py can obtain the master list by taking
-#        the union. This will allow the unit tests for each file type
-#        to check that all of their respective style categories are
-#        represented -- without having to reference style.py or be
-#        aware of the existence of other file types.
-#
-# We categorize each style rule we print.  Here are the categories.
-# We want an explicit list so we can display a full list to the user.
-# If you add a new error message with a new category, add it to the list
-# here!  cpp_style_unittest.py should tell you if you forget to do this.
-STYLE_CATEGORIES = [
-    'build/class',
-    'build/deprecated',
-    'build/endif_comment',
-    'build/forward_decl',
-    'build/header_guard',
-    'build/include',
-    'build/include_order',
-    'build/include_what_you_use',
-    'build/namespaces',
-    'build/printf_format',
-    'build/storage_class',
-    'build/using_std',
-    'legal/copyright',
-    'readability/braces',
-    'readability/casting',
-    'readability/check',
-    'readability/comparison_to_zero',
-    'readability/constructors',
-    'readability/control_flow',
-    'readability/fn_size',
-    'readability/function',
-    'readability/multiline_comment',
-    'readability/multiline_string',
-    'readability/naming',
-    'readability/null',
-    'readability/streams',
-    'readability/todo',
-    'readability/utf8',
-    'runtime/arrays',
-    'runtime/casting',
-    'runtime/explicit',
-    'runtime/init',
-    'runtime/int',
-    'runtime/invalid_increment',
-    'runtime/max_min_macros',
-    'runtime/memset',
-    'runtime/printf',
-    'runtime/printf_format',
-    'runtime/references',
-    'runtime/rtti',
-    'runtime/sizeof',
-    'runtime/string',
-    'runtime/threadsafe_fn',
-    'runtime/virtual',
-    'whitespace/blank_line',
-    'whitespace/braces',
-    'whitespace/comma',
-    'whitespace/comments',
-    'whitespace/declaration',
-    'whitespace/end_of_line',
-    'whitespace/ending_newline',
-    'whitespace/indent',
-    'whitespace/labels',
-    'whitespace/line_length',
-    'whitespace/newline',
-    'whitespace/operators',
-    'whitespace/parens',
-    'whitespace/semicolon',
-    'whitespace/tab',
-    'whitespace/todo',
-    ]
-
-
 # Some files should be skipped when checking style. For example,
 # WebKit maintains some files in Mozilla style on purpose to ease
 # future merges.
@@ -181,6 +104,12 @@ SKIPPED_FILES_WITHOUT_WARNING = [
     ]
 
 
+def style_categories():
+    """Return the set of all categories used by check-webkit-style."""
+    # If other processors had categories, we would take their union here.
+    return CppProcessor.categories
+
+
 def webkit_argument_defaults():
     """Return the DefaultArguments instance for use by check-webkit-style."""
     return ArgumentDefaults(WEBKIT_DEFAULT_OUTPUT_FORMAT,
@@ -526,7 +455,8 @@ class ArgumentParser(object):
     def _exit_with_categories(self):
         """Exit and print the style categories and default filter rules."""
         self.doc_print('\nAll categories:\n')
-        for category in sorted(STYLE_CATEGORIES):
+        categories = style_categories()
+        for category in sorted(categories):
             self.doc_print('    ' + category + '\n')
 
         self.doc_print('\nDefault filter rules**:\n')
diff --git a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
index ab3bb4a..8aabeff 100755
--- a/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/checker_unittest.py
@@ -183,13 +183,14 @@ class WebKitArgumentDefaultsTest(unittest.TestCase):
     def test_filter_rules(self):
         defaults = self.defaults()
         already_seen = []
+        all_categories = style.style_categories()
         for rule in defaults.filter_rules:
             # Check no leading or trailing white space.
             self.assertEquals(rule, rule.strip())
             # All categories are on by default, so defaults should
             # begin with -.
             self.assertTrue(rule.startswith('-'))
-            self.assertTrue(rule[1:] in style.STYLE_CATEGORIES)
+            self.assertTrue(rule[1:] in all_categories)
             # Check no rule occurs twice.
             self.assertFalse(rule in already_seen)
             already_seen.append(rule)
diff --git a/WebKitTools/Scripts/webkitpy/style/processors/cpp.py b/WebKitTools/Scripts/webkitpy/style/processors/cpp.py
index 0ae2f6b..fd332c0 100644
--- a/WebKitTools/Scripts/webkitpy/style/processors/cpp.py
+++ b/WebKitTools/Scripts/webkitpy/style/processors/cpp.py
@@ -2902,6 +2902,75 @@ class CppProcessor(object):
 
     """Processes C++ lines for checking style."""
 
+    # This list is used to--
+    #
+    # (1) generate an explicit list of all possible categories,
+    # (2) unit test that all checked categories have valid names, and
+    # (3) unit test that all categories are getting unit tested.
+    #
+    categories = set([
+        'build/class',
+        'build/deprecated',
+        'build/endif_comment',
+        'build/forward_decl',
+        'build/header_guard',
+        'build/include',
+        'build/include_order',
+        'build/include_what_you_use',
+        'build/namespaces',
+        'build/printf_format',
+        'build/storage_class',
+        'build/using_std',
+        'legal/copyright',
+        'readability/braces',
+        'readability/casting',
+        'readability/check',
+        'readability/comparison_to_zero',
+        'readability/constructors',
+        'readability/control_flow',
+        'readability/fn_size',
+        'readability/function',
+        'readability/multiline_comment',
+        'readability/multiline_string',
+        'readability/naming',
+        'readability/null',
+        'readability/streams',
+        'readability/todo',
+        'readability/utf8',
+        'runtime/arrays',
+        'runtime/casting',
+        'runtime/explicit',
+        'runtime/init',
+        'runtime/int',
+        'runtime/invalid_increment',
+        'runtime/max_min_macros',
+        'runtime/memset',
+        'runtime/printf',
+        'runtime/printf_format',
+        'runtime/references',
+        'runtime/rtti',
+        'runtime/sizeof',
+        'runtime/string',
+        'runtime/threadsafe_fn',
+        'runtime/virtual',
+        'whitespace/blank_line',
+        'whitespace/braces',
+        'whitespace/comma',
+        'whitespace/comments',
+        'whitespace/declaration',
+        'whitespace/end_of_line',
+        'whitespace/ending_newline',
+        'whitespace/indent',
+        'whitespace/labels',
+        'whitespace/line_length',
+        'whitespace/newline',
+        'whitespace/operators',
+        'whitespace/parens',
+        'whitespace/semicolon',
+        'whitespace/tab',
+        'whitespace/todo',
+        ])
+
     def __init__(self, file_path, file_extension, handle_style_error, verbosity):
         """Create a CppProcessor instance.
 
diff --git a/WebKitTools/Scripts/webkitpy/style/processors/cpp_unittest.py b/WebKitTools/Scripts/webkitpy/style/processors/cpp_unittest.py
index 2aa38f3..fa67632 100644
--- a/WebKitTools/Scripts/webkitpy/style/processors/cpp_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/processors/cpp_unittest.py
@@ -44,17 +44,12 @@ import unittest
 import cpp as cpp_style
 from cpp import CppProcessor
 
-# FIXME: Remove the need to import anything from checker. See the
-#        FIXME notes near the STYLE_CATEGORIES definition for a
-#        suggestion on how to best do this.
-from .. checker import STYLE_CATEGORIES
-
 # This class works as an error collector and replaces cpp_style.Error
 # function for the unit tests.  We also verify each category we see
 # is in STYLE_CATEGORIES, to help keep that list up to date.
 class ErrorCollector:
-    _all_style_categories = STYLE_CATEGORIES
-    # This a list including all categories seen in any unit test.
+    _all_style_categories = CppProcessor.categories
+    # This is a list including all categories seen in any unit test.
     _seen_style_categories = {}
 
     def __init__(self, assert_fn):

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list