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

Unified Diff: presubmit_canned_checks.py

Issue 4310001: Make CheckLicense() to not trigger on empty files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 10 years, 1 month 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 | tests/presubmit_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_canned_checks.py
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
index 014af28ae2fdd176f4ee27d335417f87939ca5b5..52d93b4fba926ddd95853d4c1e53d3de02722491 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -275,13 +275,16 @@ def CheckLongLines(input_api, output_api, maxlen=80, source_file_filter=None):
return []
-def CheckLicense(input_api, output_api, license, source_file_filter=None):
+def CheckLicense(input_api, output_api, license, source_file_filter=None,
+ accept_empty_files=True):
"""Verifies the license header.
"""
license_re = input_api.re.compile(license, input_api.re.MULTILINE)
bad_files = []
for f in input_api.AffectedSourceFiles(source_file_filter):
contents = input_api.ReadFile(f, 'rb')
+ if accept_empty_files and not contents:
+ continue
if not license_re.search(contents):
bad_files.append(f.LocalPath())
if bad_files:
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698