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

Side by Side Diff: presubmit_canned_checks.py

Issue 1929653002: Remove manual check using Rietveld for dry run. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@P200
Patch Set: Created 4 years, 7 months 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 | tests/presubmit_unittest.py » ('j') | 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 """Generic presubmit checks that can be reused by other presubmit checks.""" 5 """Generic presubmit checks that can be reused by other presubmit checks."""
6 6
7 import os as _os 7 import os as _os
8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) 8 _HERE = _os.path.dirname(_os.path.abspath(__file__))
9 9
10 # Justifications for each filter: 10 # Justifications for each filter:
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 long_text='\n'.join(out))] 852 long_text='\n'.join(out))]
853 return [] 853 return []
854 854
855 855
856 def CheckOwners(input_api, output_api, source_file_filter=None): 856 def CheckOwners(input_api, output_api, source_file_filter=None):
857 if input_api.is_committing: 857 if input_api.is_committing:
858 if input_api.tbr: 858 if input_api.tbr:
859 return [output_api.PresubmitNotifyResult( 859 return [output_api.PresubmitNotifyResult(
860 '--tbr was specified, skipping OWNERS check')] 860 '--tbr was specified, skipping OWNERS check')]
861 if input_api.change.issue: 861 if input_api.change.issue:
862 if (input_api.dry_run or 862 if input_api.dry_run:
863 # TODO(tandrii): clean below once CQ && run_presubmit.py recipe specify
864 # dry_run property. http://crbug.com/605563.
865 _GetRietveldIssueProps(input_api, None).get('cq_dry_run', False)):
866 return [output_api.PresubmitNotifyResult( 863 return [output_api.PresubmitNotifyResult(
867 'This is a dry run, skipping OWNERS check')] 864 'This is a dry run, skipping OWNERS check')]
868 else: 865 else:
869 return [output_api.PresubmitError("OWNERS check failed: this change has " 866 return [output_api.PresubmitError("OWNERS check failed: this change has "
870 "no Rietveld issue number, so we can't check it for approvals.")] 867 "no Rietveld issue number, so we can't check it for approvals.")]
871 needed = 'LGTM from an OWNER' 868 needed = 'LGTM from an OWNER'
872 output = output_api.PresubmitError 869 output = output_api.PresubmitError
873 else: 870 else:
874 needed = 'OWNER reviewers' 871 needed = 'OWNER reviewers'
875 output = output_api.PresubmitNotifyResult 872 output = output_api.PresubmitNotifyResult
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 for f in affected_files: 1128 for f in affected_files:
1132 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()] 1129 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()]
1133 rc = gn.main(cmd) 1130 rc = gn.main(cmd)
1134 if rc == 2: 1131 if rc == 2:
1135 warnings.append(output_api.PresubmitPromptWarning( 1132 warnings.append(output_api.PresubmitPromptWarning(
1136 '%s requires formatting. Please run `gn format --in-place %s`.' % ( 1133 '%s requires formatting. Please run `gn format --in-place %s`.' % (
1137 f.AbsoluteLocalPath(), f.LocalPath()))) 1134 f.AbsoluteLocalPath(), f.LocalPath())))
1138 # It's just a warning, so ignore other types of failures assuming they'll be 1135 # It's just a warning, so ignore other types of failures assuming they'll be
1139 # caught elsewhere. 1136 # caught elsewhere.
1140 return warnings 1137 return warnings
OLDNEW
« 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