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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Top-level presubmit script for Chromium. 5 """Top-level presubmit script for Chromium.
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into gcl. 8 for more details about the presubmit API built into gcl.
9 """ 9 """
10 10
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 input_api.PresubmitLocalPath(), 'tools', 'android', 'checkstyle')] 1255 input_api.PresubmitLocalPath(), 'tools', 'android', 'checkstyle')]
1256 import checkstyle 1256 import checkstyle
1257 finally: 1257 finally:
1258 # Restore sys.path to what it was before. 1258 # Restore sys.path to what it was before.
1259 sys.path = original_sys_path 1259 sys.path = original_sys_path
1260 1260
1261 return checkstyle.RunCheckstyle( 1261 return checkstyle.RunCheckstyle(
1262 input_api, output_api, 'tools/android/checkstyle/chromium-style-5.0.xml') 1262 input_api, output_api, 'tools/android/checkstyle/chromium-style-5.0.xml')
1263 1263
1264 1264
1265 def _CheckForCopyrightedCode(input_api, output_api):
1266 """Verifies that newly added code doesn't contain copyrighted material
1267 and is properly licensed under the standard Chromium license.
1268
1269 As there can be false positives, we maintain a whitelist file. This check
1270 also verifies that the whitelist file is up to date.
1271 """
1272 import sys
1273 original_sys_path = sys.path
1274 try:
1275 sys.path = sys.path + [input_api.os_path.join(
1276 input_api.PresubmitLocalPath(), 'android_webview', 'tools')]
1277 import copyright_scanner
1278 finally:
1279 # Restore sys.path to what it was before.
1280 sys.path = original_sys_path
1281
1282 return copyright_scanner.ScanAtPresubmit(input_api, output_api)
1283
1284
1265 _DEPRECATED_CSS = [ 1285 _DEPRECATED_CSS = [
1266 # Values 1286 # Values
1267 ( "-webkit-box", "flex" ), 1287 ( "-webkit-box", "flex" ),
1268 ( "-webkit-inline-box", "inline-flex" ), 1288 ( "-webkit-inline-box", "inline-flex" ),
1269 ( "-webkit-flex", "flex" ), 1289 ( "-webkit-flex", "flex" ),
1270 ( "-webkit-inline-flex", "inline-flex" ), 1290 ( "-webkit-inline-flex", "inline-flex" ),
1271 ( "-webkit-min-content", "min-content" ), 1291 ( "-webkit-min-content", "min-content" ),
1272 ( "-webkit-max-content", "max-content" ), 1292 ( "-webkit-max-content", "max-content" ),
1273 1293
1274 # Properties 1294 # Properties
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 output_api, 1390 output_api,
1371 source_file_filter=lambda x: x.LocalPath().endswith('.grd'))) 1391 source_file_filter=lambda x: x.LocalPath().endswith('.grd')))
1372 results.extend(_CheckSpamLogging(input_api, output_api)) 1392 results.extend(_CheckSpamLogging(input_api, output_api))
1373 results.extend(_CheckForAnonymousVariables(input_api, output_api)) 1393 results.extend(_CheckForAnonymousVariables(input_api, output_api))
1374 results.extend(_CheckCygwinShell(input_api, output_api)) 1394 results.extend(_CheckCygwinShell(input_api, output_api))
1375 results.extend(_CheckUserActionUpdate(input_api, output_api)) 1395 results.extend(_CheckUserActionUpdate(input_api, output_api))
1376 results.extend(_CheckNoDeprecatedCSS(input_api, output_api)) 1396 results.extend(_CheckNoDeprecatedCSS(input_api, output_api))
1377 results.extend(_CheckNoDeprecatedJS(input_api, output_api)) 1397 results.extend(_CheckNoDeprecatedJS(input_api, output_api))
1378 results.extend(_CheckParseErrors(input_api, output_api)) 1398 results.extend(_CheckParseErrors(input_api, output_api))
1379 results.extend(_CheckForIPCRules(input_api, output_api)) 1399 results.extend(_CheckForIPCRules(input_api, output_api))
1400 results.extend(_CheckForCopyrightedCode(input_api, output_api))
1380 1401
1381 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): 1402 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
1382 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( 1403 results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
1383 input_api, output_api, 1404 input_api, output_api,
1384 input_api.PresubmitLocalPath(), 1405 input_api.PresubmitLocalPath(),
1385 whitelist=[r'^PRESUBMIT_test\.py$'])) 1406 whitelist=[r'^PRESUBMIT_test\.py$']))
1386 return results 1407 return results
1387 1408
1388 1409
1389 def _CheckAuthorizedAuthor(input_api, output_api): 1410 def _CheckAuthorizedAuthor(input_api, output_api):
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1787 ] 1808 ]
1788 1809
1789 # Match things like path/aura/file.cc and path/file_aura.cc. 1810 # Match things like path/aura/file.cc and path/file_aura.cc.
1790 # Same for chromeos. 1811 # Same for chromeos.
1791 if any(re.search(r'[\\\/_](aura|chromeos)', f) for f in files): 1812 if any(re.search(r'[\\\/_](aura|chromeos)', f) for f in files):
1792 builders.extend([ 1813 builders.extend([
1793 'linux_chromeos_asan', 1814 'linux_chromeos_asan',
1794 ]) 1815 ])
1795 1816
1796 return GetDefaultTryConfigs(builders) 1817 return GetDefaultTryConfigs(builders)
OLDNEW
« 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