Modified: trunk/Tools/ChangeLog (160646 => 160647)
--- trunk/Tools/ChangeLog 2013-12-16 18:01:07 UTC (rev 160646)
+++ trunk/Tools/ChangeLog 2013-12-16 18:04:13 UTC (rev 160647)
@@ -1,3 +1,16 @@
+2013-12-16 Gergo Balogh <[email protected]>
+
+ Resolve inconsistant style warning caused by r160319.
+ https://bugs.webkit.org/show_bug.cgi?id=125772
+
+ Reviewed by Darin Adler.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_for_extra_new_line_at_eof):
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (CppStyleTest.test_newline_at_eof):
+ (CppStyleTest.test_extra_newlines_at_eof):
+
2013-12-16 Eva Balazsfalvi <[email protected]>
Remove mock_drt.py: parse_options() - --test-shell and --pixel-tests=<path>
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (160646 => 160647)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2013-12-16 18:01:07 UTC (rev 160646)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2013-12-16 18:04:13 UTC (rev 160647)
@@ -983,9 +983,14 @@
"""
# The array lines() was created by adding two newlines to the
# original file (go figure), then splitting on \n.
- if len(lines) > 3 and not lines[-3]:
- error(len(lines) - 2, 'whitespace/ending_newline', 5,
- 'There was more than one newline at the end of the file.')
+ # len(lines) < 3 means that the original file contain one or less lines,
+ # so there is no way to be 'more then one newline at the end'.
+ # The case when the -2. line is non-empty should addressed in the
+ # check_for_missing_new_line_at_eof so it can be ignored here.
+ if len(lines) > 3:
+ if not lines[-2] and not lines[-3]:
+ error(len(lines) - 2, 'whitespace/ending_newline', 5,
+ 'There was more than one newline at the end of the file.')
def check_for_multiline_comments_and_strings(clean_lines, line_number, error):
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (160646 => 160647)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2013-12-16 18:01:07 UTC (rev 160646)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2013-12-16 18:04:13 UTC (rev 160647)
@@ -1936,7 +1936,9 @@
' [whitespace/ending_newline] [5]'))
do_test(self, '// Newline\n// at EOF\n', False)
+ do_test(self, '// Newline2\n\n// at EOF\n', False)
do_test(self, '// No newline\n// at EOF', True)
+ do_test(self, '// No newline2\n\n// at EOF', True)
def test_extra_newlines_at_eof(self):
def do_test(self, data, too_many_newlines):
@@ -1951,7 +1953,9 @@
' [whitespace/ending_newline] [5]'))
do_test(self, '// No Newline\n// at EOF', False)
+ do_test(self, '// No Newline2\n\n// at EOF', False)
do_test(self, '// One Newline\n// at EOF\n', False)
+ do_test(self, '// One Newline2\n\n// at EOF\n', False)
do_test(self, '// Two Newlines\n// at EOF\n\n', True)
do_test(self, '// Three Newlines\n// at EOF\n\n\n', True)