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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 394 |
395 class CheckerDispatcher(object): | 395 class CheckerDispatcher(object): |
396 | 396 |
397 """Supports determining whether and how to check style, based on path.""" | 397 """Supports determining whether and how to check style, based on path.""" |
398 | 398 |
399 def _file_extension(self, file_path): | 399 def _file_extension(self, file_path): |
400 """Return the file extension without the leading dot.""" | 400 """Return the file extension without the leading dot.""" |
401 return os.path.splitext(file_path)[1].lstrip(".") | 401 return os.path.splitext(file_path)[1].lstrip(".") |
402 | 402 |
403 def _should_skip_file_path(self, file_path, skip_array_entry): | 403 def _should_skip_file_path(self, file_path, skip_array_entry): |
404 match = re.search("\s*png$", file_path) | 404 match = re.search(r"\s*png$", file_path) |
405 if match: | 405 if match: |
406 return False | 406 return False |
407 if isinstance(skip_array_entry, str): | 407 if isinstance(skip_array_entry, str): |
408 if file_path.find(skip_array_entry) >= 0: | 408 if file_path.find(skip_array_entry) >= 0: |
409 return True | 409 return True |
410 elif skip_array_entry.match(file_path): | 410 elif skip_array_entry.match(file_path): |
411 return True | 411 return True |
412 return False | 412 return False |
413 | 413 |
414 def should_skip_with_warning(self, file_path): | 414 def should_skip_with_warning(self, file_path): |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 checker = self._dispatcher.dispatch(file_path, | 733 checker = self._dispatcher.dispatch(file_path, |
734 style_error_handler, | 734 style_error_handler, |
735 min_confidence) | 735 min_confidence) |
736 | 736 |
737 if checker is None: | 737 if checker is None: |
738 raise AssertionError("File should not be checked: '%s'" % file_path) | 738 raise AssertionError("File should not be checked: '%s'" % file_path) |
739 | 739 |
740 _log.debug("Using class: " + checker.__class__.__name__) | 740 _log.debug("Using class: " + checker.__class__.__name__) |
741 | 741 |
742 checker.check(lines) | 742 checker.check(lines) |
OLD | NEW |