OLD | NEW |
1 # Copyright (C) 2009 Google Inc. All rights reserved. | 1 # Copyright (C) 2009 Google Inc. All rights reserved. |
2 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) | 2 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) |
3 # Copyright (C) 2010 ProFUSION embedded systems | 3 # Copyright (C) 2010 ProFUSION embedded systems |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 self._carriage_checker_class = carriage_checker_class | 689 self._carriage_checker_class = carriage_checker_class |
690 self._configuration = configuration | 690 self._configuration = configuration |
691 self._dispatcher = dispatcher | 691 self._dispatcher = dispatcher |
692 self._increment_error_count = increment_error_count | 692 self._increment_error_count = increment_error_count |
693 | 693 |
694 def should_process(self, file_path): | 694 def should_process(self, file_path): |
695 """Return whether the file should be checked for style.""" | 695 """Return whether the file should be checked for style.""" |
696 if self._dispatcher.should_skip_without_warning(file_path): | 696 if self._dispatcher.should_skip_without_warning(file_path): |
697 return False | 697 return False |
698 if self._dispatcher.should_skip_with_warning(file_path): | 698 if self._dispatcher.should_skip_with_warning(file_path): |
699 _log.warn('File exempt from style guide. Skipping: "%s"' | 699 _log.warning('File exempt from style guide. Skipping: "%s"', file_pa
th) |
700 % file_path) | |
701 return False | 700 return False |
702 return True | 701 return True |
703 | 702 |
704 def process(self, lines, file_path, line_numbers=None): | 703 def process(self, lines, file_path, line_numbers=None): |
705 """Check the given lines for style. | 704 """Check the given lines for style. |
706 | 705 |
707 Arguments: | 706 Arguments: |
708 lines: A list of all lines in the file to check. | 707 lines: A list of all lines in the file to check. |
709 file_path: The path of the file to process. If possible, the path | 708 file_path: The path of the file to process. If possible, the path |
710 should be relative to the source root. Otherwise, | 709 should be relative to the source root. Otherwise, |
(...skipping 23 matching lines...) Expand all Loading... |
734 checker = self._dispatcher.dispatch(file_path, | 733 checker = self._dispatcher.dispatch(file_path, |
735 style_error_handler, | 734 style_error_handler, |
736 min_confidence) | 735 min_confidence) |
737 | 736 |
738 if checker is None: | 737 if checker is None: |
739 raise AssertionError("File should not be checked: '%s'" % file_path) | 738 raise AssertionError("File should not be checked: '%s'" % file_path) |
740 | 739 |
741 _log.debug("Using class: " + checker.__class__.__name__) | 740 _log.debug("Using class: " + checker.__class__.__name__) |
742 | 741 |
743 checker.check(lines) | 742 checker.check(lines) |
OLD | NEW |