| Index: PRESUBMIT.py
|
| diff --git a/PRESUBMIT.py b/PRESUBMIT.py
|
| index 4fd988da9c78c5433fa2d6eae43951d6d136968f..4c0aff1fbbdeef2a5443041f53c99210d0d15866 100644
|
| --- a/PRESUBMIT.py
|
| +++ b/PRESUBMIT.py
|
| @@ -30,6 +30,27 @@ _LICENSE_HEADER = (
|
| )
|
|
|
|
|
| +def _CheckConstNSObject(input_api, output_api, source_file_filter):
|
| + """Checks to make sure no objective-c files have |const NSSomeClass*|."""
|
| + pattern = input_api.re.compile(r'const\s+NS\w*\s*\*')
|
| + files = []
|
| + for f in input_api.AffectedSourceFiles(source_file_filter):
|
| + if f.LocalPath().endswith('.h') or f.LocalPath().endswith('.mm'):
|
| + contents = input_api.ReadFile(f)
|
| + if pattern.search(contents):
|
| + files.append(f)
|
| +
|
| + if len(files):
|
| + if input_api.is_committing:
|
| + res_type = output_api.PresubmitPromptWarning
|
| + else:
|
| + res_type = output_api.PresubmitNotifyResult
|
| + return [ res_type('|const NSClass*| is wrong, see ' +
|
| + 'http://dev.chromium.org/developers/clang-mac',
|
| + files) ]
|
| + return []
|
| +
|
| +
|
| def _CommonChecks(input_api, output_api):
|
| results = []
|
| # What does this code do?
|
| @@ -58,6 +79,8 @@ def _CommonChecks(input_api, output_api):
|
| input_api, output_api))
|
| results.extend(input_api.canned_checks.CheckLicense(
|
| input_api, output_api, _LICENSE_HEADER, source_file_filter=sources))
|
| + results.extend(_CheckConstNSObject(
|
| + input_api, output_api, source_file_filter=sources))
|
| return results
|
|
|
|
|
|
|