| 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 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3056 | 3056 |
| 3057 # We want to ensure that headers appear in the right order: | 3057 # We want to ensure that headers appear in the right order: |
| 3058 # 1) for implementation files: config.h, primary header, blank line, alphabe
tically sorted | 3058 # 1) for implementation files: config.h, primary header, blank line, alphabe
tically sorted |
| 3059 # 2) for header files: alphabetically sorted | 3059 # 2) for header files: alphabetically sorted |
| 3060 # The include_state object keeps track of the last type seen | 3060 # The include_state object keeps track of the last type seen |
| 3061 # and complains if the header types are out of order or missing. | 3061 # and complains if the header types are out of order or missing. |
| 3062 error_message = include_state.check_next_include_order(header_type, | 3062 error_message = include_state.check_next_include_order(header_type, |
| 3063 file_extension == "h"
, | 3063 file_extension == "h"
, |
| 3064 primary_header_exists
) | 3064 primary_header_exists
) |
| 3065 | 3065 |
| 3066 # Normally including a _CONFIG_HEADER in another header file would be an err
or |
| 3067 # but not when included in a precompile header since that one will need it. |
| 3068 if error_message and "config.h" in error_message and "precompile" in filenam
e.lower(): |
| 3069 error_message = None |
| 3070 |
| 3066 # Check to make sure we have a blank line after primary header. | 3071 # Check to make sure we have a blank line after primary header. |
| 3067 if not error_message and header_type == _PRIMARY_HEADER: | 3072 if not error_message and header_type == _PRIMARY_HEADER: |
| 3068 next_line = clean_lines.raw_lines[line_number + 1] | 3073 next_line = clean_lines.raw_lines[line_number + 1] |
| 3069 if not is_blank_line(next_line): | 3074 if not is_blank_line(next_line): |
| 3070 error(line_number, 'build/include_order', 4, | 3075 error(line_number, 'build/include_order', 4, |
| 3071 'You should add a blank line after implementation file\'s own
header.') | 3076 'You should add a blank line after implementation file\'s own
header.') |
| 3072 | 3077 |
| 3073 # Check to make sure all headers besides config.h and the primary header are | 3078 # Check to make sure all headers besides config.h and the primary header are |
| 3074 # alphabetically sorted. Skip Qt's moc files. | 3079 # alphabetically sorted. Skip Qt's moc files. |
| 3075 if not error_message and header_type == _OTHER_HEADER: | 3080 if not error_message and header_type == _OTHER_HEADER: |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4085 | 4090 |
| 4086 def check(self, lines): | 4091 def check(self, lines): |
| 4087 _process_lines(self.file_path, self.file_extension, lines, | 4092 _process_lines(self.file_path, self.file_extension, lines, |
| 4088 self.handle_style_error, self.min_confidence) | 4093 self.handle_style_error, self.min_confidence) |
| 4089 | 4094 |
| 4090 | 4095 |
| 4091 # FIXME: Remove this function (requires refactoring unit tests). | 4096 # FIXME: Remove this function (requires refactoring unit tests). |
| 4092 def process_file_data(filename, file_extension, lines, error, min_confidence, fs
=None): | 4097 def process_file_data(filename, file_extension, lines, error, min_confidence, fs
=None): |
| 4093 checker = CppChecker(filename, file_extension, error, min_confidence, fs) | 4098 checker = CppChecker(filename, file_extension, error, min_confidence, fs) |
| 4094 checker.check(lines) | 4099 checker.check(lines) |
| OLD | NEW |