| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 except (OSError, IOError): | 109 except (OSError, IOError): |
| 110 return [ | 110 return [ |
| 111 output_api.PresubmitNotifyResult( | 111 output_api.PresubmitNotifyResult( |
| 112 'Can\'t find your subversion config file.\n' + error_msg) | 112 'Can\'t find your subversion config file.\n' + error_msg) |
| 113 ] | 113 ] |
| 114 return [] | 114 return [] |
| 115 | 115 |
| 116 | 116 |
| 117 def _CheckConstNSObject(input_api, output_api, source_file_filter): | 117 def _CheckConstNSObject(input_api, output_api, source_file_filter): |
| 118 """Checks to make sure no objective-c files have |const NSSomeClass*|.""" | 118 """Checks to make sure no objective-c files have |const NSSomeClass*|.""" |
| 119 pattern = input_api.re.compile(r'const\s+NS\w*\s*\*') | 119 pattern = input_api.re.compile( |
| 120 r'const\s+NS(?!(Point|Range|Rect|Size)\s*\*)\w*\s*\*') |
| 120 files = [] | 121 files = [] |
| 121 for f in input_api.AffectedSourceFiles(source_file_filter): | 122 for f in input_api.AffectedSourceFiles(source_file_filter): |
| 122 if f.LocalPath().endswith('.h') or f.LocalPath().endswith('.mm'): | 123 if f.LocalPath().endswith('.h') or f.LocalPath().endswith('.mm'): |
| 123 contents = input_api.ReadFile(f) | 124 contents = input_api.ReadFile(f) |
| 124 if pattern.search(contents): | 125 if pattern.search(contents): |
| 125 files.append(f) | 126 files.append(f) |
| 126 | 127 |
| 127 if len(files): | 128 if len(files): |
| 128 if input_api.is_committing: | 129 if input_api.is_committing: |
| 129 res_type = output_api.PresubmitPromptWarning | 130 res_type = output_api.PresubmitPromptWarning |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 results.extend(input_api.canned_checks.CheckChangeHasBugField( | 224 results.extend(input_api.canned_checks.CheckChangeHasBugField( |
| 224 input_api, output_api)) | 225 input_api, output_api)) |
| 225 results.extend(input_api.canned_checks.CheckChangeHasTestField( | 226 results.extend(input_api.canned_checks.CheckChangeHasTestField( |
| 226 input_api, output_api)) | 227 input_api, output_api)) |
| 227 results.extend(_CheckSubversionConfig(input_api, output_api)) | 228 results.extend(_CheckSubversionConfig(input_api, output_api)) |
| 228 return results | 229 return results |
| 229 | 230 |
| 230 | 231 |
| 231 def GetPreferredTrySlaves(): | 232 def GetPreferredTrySlaves(): |
| 232 return ['win', 'linux', 'mac'] | 233 return ['win', 'linux', 'mac'] |
| OLD | NEW |