Chromium Code Reviews| Index: PRESUBMIT.py |
| diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
| index 6751f06d18b4676e92e14bba1c44d6b3379c4ed3..2aea122b2d34d9ca279b244c4a47dd08dab20df1 100644 |
| --- a/PRESUBMIT.py |
| +++ b/PRESUBMIT.py |
| @@ -357,6 +357,20 @@ def _CheckNoUNIT_TESTInSourceFiles(input_api, output_api): |
| return [output_api.PresubmitPromptWarning('UNIT_TEST is only for headers.\n' + |
| '\n'.join(problems))] |
| +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 ' OVERRIDE' or ' FINAL' in line: |
| + problems.append(' %s:%d' % (f.LocalPath(), line_num)) |
| + |
| + if not problems: |
| + return [] |
| + return [output_api.PresubmitPromptWarning('Use OVERRIDE as overirde and ' |
| + 'FINAL as final as per C++11 \n' + |
|
Avi (use Gerrit)
2014/10/09 15:30:22
This is awkward and mis-spelled English. I would p
MRV
2014/10/10 03:06:04
Done.
|
| + '\n'.join(problems))] |
| def _CheckNoNewWStrings(input_api, output_api): |
| """Checks to make sure we don't introduce use of wstrings.""" |
| @@ -1300,6 +1314,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( |