Commit 3303c76d authored by darin@apple.com's avatar darin@apple.com

Update style checker and tests to deal with override instead of OVERRIDE

https://bugs.webkit.org/show_bug.cgi?id=127175

Reviewed by Anders Carlsson.

* Scripts/webkitpy/style/checkers/cpp.py:
(check_braces): Use override instead of OVERRIDE.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest.test_brace_at_begin_of_line): Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f7a788fa
2014-01-20 Darin Adler <darin@apple.com>
Update style checker and tests to deal with override instead of OVERRIDE
https://bugs.webkit.org/show_bug.cgi?id=127175
Reviewed by Anders Carlsson.
* Scripts/webkitpy/style/checkers/cpp.py:
(check_braces): Use override instead of OVERRIDE.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest.test_brace_at_begin_of_line): Ditto.
2014-01-20 Alexey Proskuryakov <ap@apple.com>
EWS should provide better information to Dashboard via JSON
......
......@@ -2363,12 +2363,12 @@ def check_braces(clean_lines, line_number, error):
# ')', or ') const' and doesn't begin with 'if|for|while|switch|else'.
# We also allow '#' for #endif and '=' for array initialization.
previous_line = get_previous_non_blank_line(clean_lines, line_number)[0]
if ((not search(r'[;:}{)=]\s*$|\)\s*((const|OVERRIDE)\s*)?(->\s*\S+)?\s*$', previous_line)
if ((not search(r'[;:}{)=]\s*$|\)\s*((const|override)\s*)?(->\s*\S+)?\s*$', previous_line)
or search(r'\b(if|for|foreach|while|switch|else|NS_ENUM)\b', previous_line))
and previous_line.find('#') < 0):
error(line_number, 'whitespace/braces', 4,
'This { should be at the end of the previous line')
elif (search(r'\)\s*(((const|OVERRIDE)\s*)*\s*)?{\s*$', line)
elif (search(r'\)\s*(((const|override)\s*)*\s*)?{\s*$', line)
and line.count('(') == line.count(')')
and not search(r'\b(if|for|foreach|while|switch|NS_ENUM)\b', line)
and not match(r'\s+[A-Z_][A-Z_0-9]+\b', line)):
......
......@@ -1587,10 +1587,10 @@ class CppStyleTest(CppStyleTestBase):
'int foo() const {',
'Place brace on its own line for function definitions. [whitespace/braces] [4]')
self.assert_multi_line_lint(
'int foo() const OVERRIDE {',
'int foo() const override {',
'Place brace on its own line for function definitions. [whitespace/braces] [4]')
self.assert_multi_line_lint(
'int foo() OVERRIDE {',
'int foo() override {',
'Place brace on its own line for function definitions. [whitespace/braces] [4]')
self.assert_multi_line_lint(
'int foo() const\n'
......@@ -1598,7 +1598,7 @@ class CppStyleTest(CppStyleTestBase):
'}\n',
'')
self.assert_multi_line_lint(
'int foo() OVERRIDE\n'
'int foo() override\n'
'{\n'
'}\n',
'')
......
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