Index: PRESUBMIT.py |
diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
index b3f798920d2b1adf0347fbc559dcb3018ef9423e..ad9effe82d67b7770a7cfdd110472ce8aa095a64 100644 |
--- a/PRESUBMIT.py |
+++ b/PRESUBMIT.py |
@@ -193,6 +193,11 @@ _BANNED_CPP_FUNCTIONS = ( |
) |
+_DELETIONS_ONLY_FILES = ( |
+ 'build/android/findbugs_filter/findbugs_known_bugs.txt' |
Isaac (away)
2013/01/09 05:40:10
if you keep this, you need a trailing comma on 197
Siva Chandra
2013/01/11 01:24:04
Done.
|
+) |
+ |
+ |
def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api): |
"""Attempts to prevent use of functions intended only for testing in |
@@ -628,6 +633,21 @@ def _CheckIncludeOrder(input_api, output_api): |
return results |
+def _CheckDeletionsOnlyFiles(input_api, output_api): |
+ """Check that a certain listed files only have deletions. |
Isaac (away)
2013/01/12 02:42:30
nit: end triple quote on line 637 (delete line 638
|
+ """ |
+ errors = [] |
+ for f in input_api.AffectedFiles(): |
+ if f.LocalPath() in _DELETIONS_ONLY_FILES: |
Isaac (away)
2013/01/09 05:40:10
how about just:
if f.LocalPath() = 'build/android
Siva Chandra
2013/01/11 01:24:04
Unless you feel generality is bad here, I would pr
Isaac (away)
2013/01/12 02:42:30
SGTM. It's fine to keep the DELETION_ONLY_FILES a
|
+ 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): |
"""Checks common to both upload and commit.""" |
results = [] |
@@ -647,6 +667,7 @@ def _CommonChecks(input_api, output_api): |
results.extend(_CheckFilePermissions(input_api, output_api)) |
results.extend(_CheckNoAuraWindowPropertyHInHeaders(input_api, output_api)) |
results.extend(_CheckIncludeOrder(input_api, output_api)) |
+ results.extend(_CheckDeletionsOnlyFiles(input_api, output_api)) |
return results |