Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: PRESUBMIT.py

Issue 11583028: Add a presubmit check to check that a certain set of Android specific files only have deletions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698