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 2839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2850 | 2850 |
2851 include = matched.group(2) | 2851 include = matched.group(2) |
2852 is_system = (matched.group(1) == '<') | 2852 is_system = (matched.group(1) == '<') |
2853 | 2853 |
2854 # Look for any of the stream classes that are part of standard C++. | 2854 # Look for any of the stream classes that are part of standard C++. |
2855 if match(r'(f|ind|io|i|o|parse|pf|stdio|str|)?stream$', include): | 2855 if match(r'(f|ind|io|i|o|parse|pf|stdio|str|)?stream$', include): |
2856 error(line_number, 'readability/streams', 3, | 2856 error(line_number, 'readability/streams', 3, |
2857 'Streams are highly discouraged.') | 2857 'Streams are highly discouraged.') |
2858 | 2858 |
2859 # Look for specific includes to fix. | 2859 # Look for specific includes to fix. |
2860 if include.startswith('wtf/') and not is_system: | 2860 if include.startswith('wtf/') and is_system: |
2861 error(line_number, 'build/include', 4, | 2861 error(line_number, 'build/include', 4, |
2862 'wtf includes should be <wtf/file.h> instead of "wtf/file.h".') | 2862 'wtf includes should be "wtf/file.h" instead of <wtf/file.h>.') |
2863 | 2863 |
2864 if filename.find('/chromium/') != -1 and include.startswith('cc/CC'): | 2864 if filename.find('/chromium/') != -1 and include.startswith('cc/CC'): |
2865 error(line_number, 'build/include', 4, | 2865 error(line_number, 'build/include', 4, |
2866 'cc includes should be "CCFoo.h" instead of "cc/CCFoo.h".') | 2866 'cc includes should be "CCFoo.h" instead of "cc/CCFoo.h".') |
2867 | 2867 |
2868 duplicate_header = include in include_state | 2868 duplicate_header = include in include_state |
2869 if duplicate_header: | 2869 if duplicate_header: |
2870 error(line_number, 'build/include', 4, | 2870 error(line_number, 'build/include', 4, |
2871 '"%s" already included at %s:%s' % | 2871 '"%s" already included at %s:%s' % |
2872 (include, filename, include_state[include])) | 2872 (include, filename, include_state[include])) |
(...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3776 self.handle_style_error, self.min_confidence) | 3776 self.handle_style_error, self.min_confidence) |
3777 | 3777 |
3778 | 3778 |
3779 # FIXME: Remove this function (requires refactoring unit tests). | 3779 # FIXME: Remove this function (requires refactoring unit tests). |
3780 def process_file_data(filename, file_extension, lines, error, min_confidence, un
it_test_config): | 3780 def process_file_data(filename, file_extension, lines, error, min_confidence, un
it_test_config): |
3781 global _unit_test_config | 3781 global _unit_test_config |
3782 _unit_test_config = unit_test_config | 3782 _unit_test_config = unit_test_config |
3783 checker = CppChecker(filename, file_extension, error, min_confidence) | 3783 checker = CppChecker(filename, file_extension, error, min_confidence) |
3784 checker.check(lines) | 3784 checker.check(lines) |
3785 _unit_test_config = {} | 3785 _unit_test_config = {} |
OLD | NEW |