Chromium Code Reviews| Index: build/android/findbugs_filter/PRESUBMIT.py |
| diff --git a/build/android/findbugs_filter/PRESUBMIT.py b/build/android/findbugs_filter/PRESUBMIT.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e69b8ff35c67c5fbdd138d2b100613dd242ee70c |
| --- /dev/null |
| +++ b/build/android/findbugs_filter/PRESUBMIT.py |
| @@ -0,0 +1,43 @@ |
| +# Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| + |
| +_DELETIONS_ONLY_FILES = ( |
| + 'build/android/findbugs_filter/findbugs_known_bugs.txt', |
|
M-A Ruel
2013/01/15 02:16:23
I thought the path was corrected to you should use
|
| +) |
| + |
| + |
| +def _CheckDeletionsOnlyFiles(input_api, output_api): |
| + """Check that a certain listed files only have deletions. |
| + """ |
| + errors = [] |
| + for f in input_api.AffectedFiles(): |
| + if f.LocalPath() in _DELETIONS_ONLY_FILES: |
| + if f.ChangedContents(): |
| + errors.append(f.LocalPath()) |
| + results = [] |
| + if errors: |
| + results.append(output_api.PresubmitError( |
| + 'Following files should only contain deletions.', errors)) |
| + return results |
| + |
| + |
| +def CommonChecks(input_api, output_api): |
| + output = [] |
| + output.extend(input_api.canned_checks.RunPylint( |
| + input_api, |
| + output_api, |
| + white_list=[r'PRESUBMIT\.py$'], |
| + extra_paths_list=[])) |
| + |
| + output.extend(_CheckDeletionsOnlyFiles(input_api, output_api)) |
| + return output |
| + |
| + |
| +def CheckChangeOnUpload(input_api, output_api): |
| + return CommonChecks(input_api, output_api) |
| + |
| + |
| +def CheckChangeOnCommit(input_api, output_api): |
| + return CommonChecks(input_api, output_api) |