Commit 15bdd65e authored by levin@chromium.org's avatar levin@chromium.org

2011-02-18 David Levin <levin@chromium.org>

        Reviewed by Eric Seidel.

        check-webkit-style falsely complains about WebKitGTK+ public headers
        https://bugs.webkit.org/show_bug.cgi?id=54650

        * Scripts/webkitpy/style/checker.py: Add some exceptions for the gtk files.
        * Scripts/webkitpy/style/checkers/cpp.py: Restrict the checks for WEBKIT_API
          to the chromium directory (and improved the checks slightly).
        * Scripts/webkitpy/style/checkers/cpp_unittest.py: Added corresponding tests.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c30cd1b6
2011-02-18 David Levin <levin@chromium.org>
Reviewed by Eric Seidel.
check-webkit-style falsely complains about WebKitGTK+ public headers
https://bugs.webkit.org/show_bug.cgi?id=54650
* Scripts/webkitpy/style/checker.py: Add some exceptions for the gtk files.
* Scripts/webkitpy/style/checkers/cpp.py: Restrict the checks for WEBKIT_API
to the chromium directory (and improved the checks slightly).
* Scripts/webkitpy/style/checkers/cpp_unittest.py: Added corresponding tests.
2011-02-18 Dirk Pranke <dpranke@chromium.org>
Reviewed by James Robinson.
......
......@@ -144,13 +144,16 @@ _PATH_RULES_SPECIFIER = [
"Tools/MiniBrowser/qt"],
["-build/include"]),
([# The GTK+ APIs use GTK+ naming style, which includes
# lower-cased, underscore-separated values.
# lower-cased, underscore-separated values, whitespace before
# parens for function calls, and always having variable names.
# Also, GTK+ allows the use of NULL.
"Source/WebCore/bindings/scripts/test/GObject",
"WebKit/gtk/webkit/",
"Source/WebKit/gtk/webkit/",
"Tools/DumpRenderTree/gtk/"],
["-readability/naming",
"-readability/null"]),
"-readability/parameter_name",
"-readability/null",
"-whitespace/parens"]),
([# Header files in ForwardingHeaders have no header guards or
# exceptional header guards (e.g., WebCore_FWD_Debugger_h).
"/ForwardingHeaders/"],
......
......@@ -1582,8 +1582,8 @@ def check_function_definition(filename, file_extension, clean_lines, line_number
return
modifiers_and_return_type = function_state.modifiers_and_return_type()
if search(r'\bWEBKIT_API\b', modifiers_and_return_type):
if filename.find('chromium/public/') == -1:
if filename.find('/chromium/') != -1 and search(r'\bWEBKIT_API\b', modifiers_and_return_type):
if filename.find('/chromium/public/') == -1:
error(function_state.function_name_start_position.row, 'readability/webkit_api', 5,
'WEBKIT_API should only appear in the chromium public directory.')
elif not file_extension == "h":
......
......@@ -4337,25 +4337,25 @@ class WebKitStyleTest(CppStyleTestBase):
'+readability/webkit_api')
self.assertEquals('',
self.perform_lint('WEBKIT_API int foo();\n',
'chromium/public/test.h',
'WebKit/chromium/public/test.h',
webkit_api_error_rules))
self.assertEquals('WEBKIT_API should only be used in header files. [readability/webkit_api] [5]',
self.perform_lint('WEBKIT_API int foo();\n',
'chromium/public/test.cpp',
'WebKit/chromium/public/test.cpp',
webkit_api_error_rules))
self.assertEquals('WEBKIT_API should only appear in the chromium public directory. [readability/webkit_api] [5]',
self.perform_lint('WEBKIT_API int foo();\n',
'other/src/test.h',
'WebKit/chromium/src/test.h',
webkit_api_error_rules))
self.assertEquals('WEBKIT_API should not be used on a function with a body. [readability/webkit_api] [5]',
self.perform_lint('WEBKIT_API int foo() { }\n',
'chromium/public/test.h',
'WebKit/chromium/public/test.h',
webkit_api_error_rules))
self.assertEquals('WEBKIT_API should not be used on a function with a body. [readability/webkit_api] [5]',
self.perform_lint('WEBKIT_API inline int foo()\n'
'{\n'
'}\n',
'chromium/public/test.h',
'WebKit/chromium/public/test.h',
webkit_api_error_rules))
self.assertEquals('WEBKIT_API should not be used with a pure virtual function. [readability/webkit_api] [5]',
self.perform_lint('{}\n'
......@@ -4363,7 +4363,15 @@ class WebKitStyleTest(CppStyleTestBase):
'virtual\n'
'int\n'
'foo() = 0;\n',
'chromium/public/test.h',
'WebKit/chromium/public/test.h',
webkit_api_error_rules))
self.assertEquals('',
self.perform_lint('{}\n'
'WEBKIT_API\n'
'virtual\n'
'int\n'
'foo() = 0;\n',
'test.h',
webkit_api_error_rules))
def test_other(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment