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 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3502 matches = check_for_toFoo_definition(header_file, ''.join(('to', class_name) ), error) | 3502 matches = check_for_toFoo_definition(header_file, ''.join(('to', class_name) ), error) |
3503 # Ignore (for now) if not able to find the header where toFoo might be defin ed. | 3503 # Ignore (for now) if not able to find the header where toFoo might be defin ed. |
3504 # TODO: Handle cases where Classname might be defined in some other header. | 3504 # TODO: Handle cases where Classname might be defined in some other header. |
3505 if matches is None: | 3505 if matches is None: |
3506 return | 3506 return |
3507 | 3507 |
3508 report_error = True | 3508 report_error = True |
3509 # Ensure found static_cast instance is not from within toFoo definition itse lf. | 3509 # Ensure found static_cast instance is not from within toFoo definition itse lf. |
3510 if (os.path.basename(processing_file) == header_file): | 3510 if (os.path.basename(processing_file) == header_file): |
3511 for item in matches: | 3511 for item in matches: |
3512 if line_number in range(item[1], item[2]): | 3512 if line_number in range(item[1], item[2] + 1): |
r.kasibhatla
2013/09/23 03:12:07
I believe you are doing +1 here to enable the sear
| |
3513 report_error = False | 3513 report_error = False |
3514 break | 3514 break |
3515 | 3515 |
3516 if report_error: | 3516 if report_error: |
3517 if len(matches): | 3517 if len(matches): |
3518 # toFoo is defined - enforce using it. | 3518 # toFoo is defined - enforce using it. |
3519 # TODO: Suggest an appropriate toFoo from the alternatives present i n matches. | 3519 # TODO: Suggest an appropriate toFoo from the alternatives present i n matches. |
3520 error(line_number, 'readability/check', 4, | 3520 error(line_number, 'readability/check', 4, |
3521 'static_cast of class objects is not allowed. Use to%s defined in %s.' % | 3521 'static_cast of class objects is not allowed. Use to%s defined in %s.' % |
3522 (class_name, header_file)) | 3522 (class_name, header_file)) |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4020 self.handle_style_error, self.min_confidence) | 4020 self.handle_style_error, self.min_confidence) |
4021 | 4021 |
4022 | 4022 |
4023 # FIXME: Remove this function (requires refactoring unit tests). | 4023 # FIXME: Remove this function (requires refactoring unit tests). |
4024 def process_file_data(filename, file_extension, lines, error, min_confidence, un it_test_config): | 4024 def process_file_data(filename, file_extension, lines, error, min_confidence, un it_test_config): |
4025 global _unit_test_config | 4025 global _unit_test_config |
4026 _unit_test_config = unit_test_config | 4026 _unit_test_config = unit_test_config |
4027 checker = CppChecker(filename, file_extension, error, min_confidence) | 4027 checker = CppChecker(filename, file_extension, error, min_confidence) |
4028 checker.check(lines) | 4028 checker.check(lines) |
4029 _unit_test_config = {} | 4029 _unit_test_config = {} |
OLD | NEW |