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

Side by Side Diff: PRESUBMIT.py

Issue 681203005: Do not allow mojo:// URLs. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 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 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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 source_file_filter=lambda x: x.LocalPath().endswith('.grd'))) 1334 source_file_filter=lambda x: x.LocalPath().endswith('.grd')))
1335 results.extend(_CheckSpamLogging(input_api, output_api)) 1335 results.extend(_CheckSpamLogging(input_api, output_api))
1336 results.extend(_CheckForAnonymousVariables(input_api, output_api)) 1336 results.extend(_CheckForAnonymousVariables(input_api, output_api))
1337 results.extend(_CheckCygwinShell(input_api, output_api)) 1337 results.extend(_CheckCygwinShell(input_api, output_api))
1338 results.extend(_CheckUserActionUpdate(input_api, output_api)) 1338 results.extend(_CheckUserActionUpdate(input_api, output_api))
1339 results.extend(_CheckNoDeprecatedCSS(input_api, output_api)) 1339 results.extend(_CheckNoDeprecatedCSS(input_api, output_api))
1340 results.extend(_CheckParseErrors(input_api, output_api)) 1340 results.extend(_CheckParseErrors(input_api, output_api))
1341 results.extend(_CheckForIPCRules(input_api, output_api)) 1341 results.extend(_CheckForIPCRules(input_api, output_api))
1342 results.extend(_CheckForOverrideAndFinalRules(input_api, output_api)) 1342 results.extend(_CheckForOverrideAndFinalRules(input_api, output_api))
1343 results.extend(_CheckGNCheck(input_api, output_api)) 1343 results.extend(_CheckGNCheck(input_api, output_api))
1344 results.extend(_CheckForMojoURL(input_api, output_api))
1344 1345
1345 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): 1346 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
1346 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( 1347 results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
1347 input_api, output_api, 1348 input_api, output_api,
1348 input_api.PresubmitLocalPath(), 1349 input_api.PresubmitLocalPath(),
1349 whitelist=[r'^PRESUBMIT_test\.py$'])) 1350 whitelist=[r'^PRESUBMIT_test\.py$']))
1350 return results 1351 return results
1351 1352
1352 1353
1353 def _CheckAuthorizedAuthor(input_api, output_api): 1354 def _CheckAuthorizedAuthor(input_api, output_api):
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 problems.append( 1520 problems.append(
1520 '%s:%d\n %s' % (local_path, line_number, line.strip())) 1521 '%s:%d\n %s' % (local_path, line_number, line.strip()))
1521 1522
1522 if problems: 1523 if problems:
1523 return [output_api.PresubmitPromptWarning( 1524 return [output_api.PresubmitPromptWarning(
1524 _IPC_ENUM_TRAITS_DEPRECATED, problems)] 1525 _IPC_ENUM_TRAITS_DEPRECATED, problems)]
1525 else: 1526 else:
1526 return [] 1527 return []
1527 1528
1528 1529
1530 def _CheckForMojoURL(input_api, output_api):
1531 """Check that mojo url do not use mojo://."""
1532 errors = []
1533 for f in input_api.AffectedFiles():
1534 if f.LocalPath() != 'PRESUBMIT.py':
1535 for lnum, line in f.ChangedContents():
1536 # Disallow mojo://
1537 if input_api.re.search(r'mojo://', line):
1538 errors.append(output_api.PresubmitError(
1539 ('%s:%d uses mojo:// url format. Please use mojo: instead.')
1540 % (f.LocalPath(), lnum)))
1541 return errors
1542
1543
1529 def CheckChangeOnUpload(input_api, output_api): 1544 def CheckChangeOnUpload(input_api, output_api):
1530 results = [] 1545 results = []
1531 results.extend(_CommonChecks(input_api, output_api)) 1546 results.extend(_CommonChecks(input_api, output_api))
1532 results.extend(_CheckValidHostsInDEPS(input_api, output_api)) 1547 results.extend(_CheckValidHostsInDEPS(input_api, output_api))
1533 results.extend(_CheckJavaStyle(input_api, output_api)) 1548 results.extend(_CheckJavaStyle(input_api, output_api))
1534 return results 1549 return results
1535 1550
1536 1551
1537 def GetTryServerMasterForBot(bot): 1552 def GetTryServerMasterForBot(bot):
1538 """Returns the Try Server master for the given bot. 1553 """Returns the Try Server master for the given bot.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 builders.extend(['cros_x86']) 1762 builders.extend(['cros_x86'])
1748 1763
1749 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it 1764 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it
1750 # unless they're .gyp(i) files as changes to those files can break the gyp 1765 # unless they're .gyp(i) files as changes to those files can break the gyp
1751 # step on that bot. 1766 # step on that bot.
1752 if (not all(re.search('^chrome', f) for f in files) or 1767 if (not all(re.search('^chrome', f) for f in files) or
1753 any(re.search('\.gypi?$', f) for f in files)): 1768 any(re.search('\.gypi?$', f) for f in files)):
1754 builders.extend(['android_aosp']) 1769 builders.extend(['android_aosp'])
1755 1770
1756 return GetDefaultTryConfigs(builders) 1771 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