| OLD | NEW |
| 1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
| 2 # | 2 # |
| 3 # Copyright (C) 2009, 2010, 2012 Google Inc. All rights reserved. | 3 # Copyright (C) 2009, 2010, 2012 Google Inc. All rights reserved. |
| 4 # Copyright (C) 2009 Torch Mobile Inc. | 4 # Copyright (C) 2009 Torch Mobile Inc. |
| 5 # Copyright (C) 2009 Apple Inc. All rights reserved. | 5 # Copyright (C) 2009 Apple Inc. All rights reserved. |
| 6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) | 6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
| 7 # | 7 # |
| 8 # Redistribution and use in source and binary forms, with or without | 8 # Redistribution and use in source and binary forms, with or without |
| 9 # modification, are permitted provided that the following conditions are | 9 # modification, are permitted provided that the following conditions are |
| 10 # met: | 10 # met: |
| (...skipping 3139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3150 | 3150 |
| 3151 # We want to ensure that headers appear in the right order: | 3151 # We want to ensure that headers appear in the right order: |
| 3152 # 1) for implementation files: config.h, primary header, blank line, alphabe
tically sorted | 3152 # 1) for implementation files: config.h, primary header, blank line, alphabe
tically sorted |
| 3153 # 2) for header files: alphabetically sorted | 3153 # 2) for header files: alphabetically sorted |
| 3154 # The include_state object keeps track of the last type seen | 3154 # The include_state object keeps track of the last type seen |
| 3155 # and complains if the header types are out of order or missing. | 3155 # and complains if the header types are out of order or missing. |
| 3156 error_message = include_state.check_next_include_order(header_type, | 3156 error_message = include_state.check_next_include_order(header_type, |
| 3157 file_extension == "h"
, | 3157 file_extension == "h"
, |
| 3158 primary_header_exists
) | 3158 primary_header_exists
) |
| 3159 | 3159 |
| 3160 # Normally including a _CONFIG_HEADER in another header file would be an err
or | |
| 3161 # but not when included in a precompile header since that one will need it. | |
| 3162 if error_message and "config.h" in error_message and "precompile" in filenam
e.lower(): | |
| 3163 error_message = None | |
| 3164 | |
| 3165 # Check to make sure we have a blank line after primary header. | 3160 # Check to make sure we have a blank line after primary header. |
| 3166 if not error_message and header_type == _PRIMARY_HEADER: | 3161 if not error_message and header_type == _PRIMARY_HEADER: |
| 3167 next_line = clean_lines.raw_lines[line_number + 1] | 3162 next_line = clean_lines.raw_lines[line_number + 1] |
| 3168 if not is_blank_line(next_line): | 3163 if not is_blank_line(next_line): |
| 3169 error(line_number, 'build/include_order', 4, | 3164 error(line_number, 'build/include_order', 4, |
| 3170 'You should add a blank line after implementation file\'s own
header.') | 3165 'You should add a blank line after implementation file\'s own
header.') |
| 3171 | 3166 |
| 3172 # Check to make sure all headers besides config.h and the primary header are | 3167 # Check to make sure all headers besides config.h and the primary header are |
| 3173 # alphabetically sorted. Skip Qt's moc files. | 3168 # alphabetically sorted. Skip Qt's moc files. |
| 3174 if not error_message and header_type == _OTHER_HEADER: | 3169 if not error_message and header_type == _OTHER_HEADER: |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4187 | 4182 |
| 4188 def check(self, lines): | 4183 def check(self, lines): |
| 4189 _process_lines(self.file_path, self.file_extension, lines, | 4184 _process_lines(self.file_path, self.file_extension, lines, |
| 4190 self.handle_style_error, self.min_confidence) | 4185 self.handle_style_error, self.min_confidence) |
| 4191 | 4186 |
| 4192 | 4187 |
| 4193 # FIXME: Remove this function (requires refactoring unit tests). | 4188 # FIXME: Remove this function (requires refactoring unit tests). |
| 4194 def process_file_data(filename, file_extension, lines, error, min_confidence, fs
=None): | 4189 def process_file_data(filename, file_extension, lines, error, min_confidence, fs
=None): |
| 4195 checker = CppChecker(filename, file_extension, error, min_confidence, fs) | 4190 checker = CppChecker(filename, file_extension, error, min_confidence, fs) |
| 4196 checker.check(lines) | 4191 checker.check(lines) |
| OLD | NEW |