Changeset 159872 in webkit


Ignore:
Timestamp:
Nov 29, 2013 6:32:53 AM (10 years ago)
Author:
commit-queue@webkit.org
Message:

check-webkit-style should check for extraneous newline between config.h and primary header.
https://bugs.webkit.org/show_bug.cgi?id=124821

Patch by Gergo Balogh <geryxyz@inf.u-szeged.hu> on 2013-11-29
Reviewed by Csaba Osztrogonác.

  • Scripts/webkitpy/style/checkers/cpp.py:

(check_include_line):

  • Scripts/webkitpy/style/checkers/cpp_unittest.py:

(OrderOfIncludesTest.test_check_line_break_after_own_header):
(OrderOfIncludesTest):
(OrderOfIncludesTest.test_check_line_break_before_own_header):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r159868 r159872  
     12013-11-29  Gergo Balogh  <geryxyz@inf.u-szeged.hu>
     2
     3        check-webkit-style should check for extraneous newline between config.h and primary header.
     4        https://bugs.webkit.org/show_bug.cgi?id=124821
     5
     6        Reviewed by Csaba Osztrogonác.
     7
     8        * Scripts/webkitpy/style/checkers/cpp.py:
     9        (check_include_line):
     10        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
     11        (OrderOfIncludesTest.test_check_line_break_after_own_header):
     12        (OrderOfIncludesTest):
     13        (OrderOfIncludesTest.test_check_line_break_before_own_header):
     14
    1152013-11-29  Jozsef Berta  <jberta@inf.u-szeged.hu>
    216
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r159612 r159872  
    28192819                                                           primary_header_exists)
    28202820
    2821     # Check to make sure we have a blank line after primary header.
     2821    # Check to make sure we have a blank line after and none before primary header.
    28222822    if not error_message and header_type == _PRIMARY_HEADER:
    2823          next_line = clean_lines.raw_lines[line_number + 1]
    2824          if not is_blank_line(next_line):
     2823        next_line = clean_lines.raw_lines[line_number + 1]
     2824        previous_line = clean_lines.raw_lines[line_number - 1]
     2825        if not is_blank_line(next_line):
    28252826            error(line_number, 'build/include_order', 4,
    2826                   'You should add a blank line after implementation file\'s own header.')
     2827                'You should add a blank line after implementation file\'s own header.')
     2828        if is_blank_line(previous_line):
     2829            error(line_number, 'build/include_order', 4,
     2830                'You should not add a blank line before implementation file\'s own header.')
    28272831
    28282832    # Check to make sure all headers besides config.h and the primary header are
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r159612 r159872  
    26452645                                         '')
    26462646
     2647    def test_check_line_break_before_own_header(self):
     2648        self.assert_language_rules_check('foo.cpp',
     2649                                         '#include "config.h"\n'
     2650                                         '\n'
     2651                                         '#include "foo.h"\n'
     2652                                         '\n'
     2653                                         '#include "bar.h"\n',
     2654                                         'You should not add a blank line before implementation file\'s own header.  [build/include_order] [4]')
     2655
     2656        self.assert_language_rules_check('foo.cpp',
     2657                                         '#include "config.h"\n'
     2658                                         '#include "foo.h"\n'
     2659                                         '\n'
     2660                                         '#include "bar.h"\n',
     2661                                         '')
     2662
    26472663    def test_check_preprocessor_in_include_section(self):
    26482664        self.assert_language_rules_check('foo.cpp',
Note: See TracChangeset for help on using the changeset viewer.