| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Top-level presubmit script for Chromium. | 5 """Top-level presubmit script for Chromium. |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 'Most layers below src/chrome/ should not hardcode service URLs.\n' | 855 'Most layers below src/chrome/ should not hardcode service URLs.\n' |
| 856 'Are you sure this is correct?', | 856 'Are you sure this is correct?', |
| 857 [' %s:%d: %s' % ( | 857 [' %s:%d: %s' % ( |
| 858 problem[0], problem[1], problem[2]) for problem in problems])] | 858 problem[0], problem[1], problem[2]) for problem in problems])] |
| 859 else: | 859 else: |
| 860 return [] | 860 return [] |
| 861 | 861 |
| 862 | 862 |
| 863 def _CheckNoAbbreviationInPngFileName(input_api, output_api): | 863 def _CheckNoAbbreviationInPngFileName(input_api, output_api): |
| 864 """Makes sure there are no abbreviations in the name of PNG files. | 864 """Makes sure there are no abbreviations in the name of PNG files. |
| 865 The native_client_sdk directory is excluded because it has auto-generated PNG |
| 866 files for documentation. |
| 865 """ | 867 """ |
| 866 pattern = input_api.re.compile(r'.*_[a-z]_.*\.png$|.*_[a-z]\.png$') | |
| 867 errors = [] | 868 errors = [] |
| 868 for f in input_api.AffectedFiles(include_deletes=False): | 869 white_list = (r'.*_[a-z]_.*\.png$|.*_[a-z]\.png$',) |
| 869 if pattern.match(f.LocalPath()): | 870 black_list = (r'^native_client_sdk[\\\/]',) |
| 870 errors.append(' %s' % f.LocalPath()) | 871 file_filter = lambda f: input_api.FilterSourceFile( |
| 872 f, white_list=white_list, black_list=black_list) |
| 873 for f in input_api.AffectedFiles(include_deletes=False, |
| 874 file_filter=file_filter): |
| 875 errors.append(' %s' % f.LocalPath()) |
| 871 | 876 |
| 872 results = [] | 877 results = [] |
| 873 if errors: | 878 if errors: |
| 874 results.append(output_api.PresubmitError( | 879 results.append(output_api.PresubmitError( |
| 875 'The name of PNG files should not have abbreviations. \n' | 880 'The name of PNG files should not have abbreviations. \n' |
| 876 'Use _hover.png, _center.png, instead of _h.png, _c.png.\n' | 881 'Use _hover.png, _center.png, instead of _h.png, _c.png.\n' |
| 877 'Contact oshima@chromium.org if you have questions.', errors)) | 882 'Contact oshima@chromium.org if you have questions.', errors)) |
| 878 return results | 883 return results |
| 879 | 884 |
| 880 | 885 |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 ] | 1790 ] |
| 1786 | 1791 |
| 1787 # Match things like path/aura/file.cc and path/file_aura.cc. | 1792 # Match things like path/aura/file.cc and path/file_aura.cc. |
| 1788 # Same for chromeos. | 1793 # Same for chromeos. |
| 1789 if any(re.search(r'[\\\/_](aura|chromeos)', f) for f in files): | 1794 if any(re.search(r'[\\\/_](aura|chromeos)', f) for f in files): |
| 1790 builders.extend([ | 1795 builders.extend([ |
| 1791 'linux_chromeos_asan', | 1796 'linux_chromeos_asan', |
| 1792 ]) | 1797 ]) |
| 1793 | 1798 |
| 1794 return GetDefaultTryConfigs(builders) | 1799 return GetDefaultTryConfigs(builders) |
| OLD | NEW |