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

Unified Diff: PRESUBMIT.py

Issue 788163002: Enable presubmit check for copyrighted material in added / modified code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 9e26bebf7d3167110514a2c5ac49f46eaed233c0..c875e48f00d9bec495598fa169ed8ca0bfa31c56 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1262,6 +1262,26 @@ def _CheckJavaStyle(input_api, output_api):
input_api, output_api, 'tools/android/checkstyle/chromium-style-5.0.xml')
+def _CheckForCopyrightedCode(input_api, output_api):
+ """Verifies that newly added code doesn't contain copyrighted material
+ and is properly licensed under the standard Chromium license.
+
+ As there can be false positives, we maintain a whitelist file. This check
+ also verifies that the whitelist file is up to date.
+ """
+ import sys
+ original_sys_path = sys.path
+ try:
+ sys.path = sys.path + [input_api.os_path.join(
+ input_api.PresubmitLocalPath(), 'android_webview', 'tools')]
+ import copyright_scanner
+ finally:
+ # Restore sys.path to what it was before.
+ sys.path = original_sys_path
+
+ return copyright_scanner.ScanAtPresubmit(input_api, output_api)
+
+
_DEPRECATED_CSS = [
# Values
( "-webkit-box", "flex" ),
@@ -1377,6 +1397,7 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckNoDeprecatedJS(input_api, output_api))
results.extend(_CheckParseErrors(input_api, output_api))
results.extend(_CheckForIPCRules(input_api, output_api))
+ results.extend(_CheckForCopyrightedCode(input_api, output_api))
if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
« 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