Chromium Code Reviews| Index: PRESUBMIT.py |
| diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
| index 6751f06d18b4676e92e14bba1c44d6b3379c4ed3..5a743e57572686a4436dac0d81cb3c8476925a46 100644 |
| --- a/PRESUBMIT.py |
| +++ b/PRESUBMIT.py |
| @@ -1259,6 +1259,23 @@ def _CheckNoDeprecatedCSS(input_api, output_api): |
| (fpath.LocalPath(), line_num, deprecated_value, value))) |
| return results |
|
M-A Ruel
2014/10/14 14:38:20
two lines between file level symbols.
MRV
2014/10/15 08:49:58
Done.
|
| +def _CheckForOverrideAndFinalRules(input_api, output_api): |
| + """Checks for override and final used as per C++11""" |
| + problems = [] |
| + for f in input_api.AffectedFiles(): |
| + if (f.LocalPath().endswith(('.cc', '.mm', '.cpp', '.h'))): |
| + for line_num, line in f.ChangedContents(): |
| + if (re.search(r"\bOVERRIDE\b", line) or |
|
M-A Ruel
2014/10/14 14:38:20
input_api.re.search(r"\b(FINAL|OVERRIDE)\b", line)
MRV
2014/10/15 08:49:58
Done.
|
| + re.search(r"\bFINAL\b", line)): |
| + problems.append(' %s:%d' % (f.LocalPath(), line_num)) |
| + |
| + if not problems: |
| + return [] |
| + return [output_api.PresubmitError('Use C++11\'s |override| and' |
|
M-A Ruel
2014/10/14 14:38:20
Weird alignment, either all align to "(" or align
MRV
2014/10/15 08:49:58
Done.
|
| + ' |final| rather than OVERRIDE and FINAL. \n' + |
|
M-A Ruel
2014/10/14 14:38:20
Use '%s' instead of '+'
MRV
2014/10/15 08:49:58
I am using displaying the errors directly now.
|
| + '\n'.join(problems))] |
| + |
| + |
| def _CommonChecks(input_api, output_api): |
| """Checks common to both upload and commit.""" |
| results = [] |
| @@ -1300,6 +1317,7 @@ def _CommonChecks(input_api, output_api): |
| results.extend(_CheckNoDeprecatedCSS(input_api, output_api)) |
| results.extend(_CheckParseErrors(input_api, output_api)) |
| results.extend(_CheckForIPCRules(input_api, output_api)) |
| + results.extend(_CheckForOverrideAndFinalRules(input_api, output_api)) |
| if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): |
| results.extend(input_api.canned_checks.RunUnitTestsInDirectory( |