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

Side by Side Diff: presubmit_canned_checks.py

Issue 1090943003: Skip OWNERS checks for CQ dry runs (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Cleanup Created 5 years, 8 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 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 'builds are pending.' % max_pendings, 847 'builds are pending.' % max_pendings,
848 long_text='\n'.join(out))] 848 long_text='\n'.join(out))]
849 return [] 849 return []
850 850
851 851
852 def CheckOwners(input_api, output_api, source_file_filter=None): 852 def CheckOwners(input_api, output_api, source_file_filter=None):
853 if input_api.is_committing: 853 if input_api.is_committing:
854 if input_api.tbr: 854 if input_api.tbr:
855 return [output_api.PresubmitNotifyResult( 855 return [output_api.PresubmitNotifyResult(
856 '--tbr was specified, skipping OWNERS check')] 856 '--tbr was specified, skipping OWNERS check')]
857 if not input_api.change.issue: 857 if input_api.change.issue:
858 if _GetRietveldIssueProps(input_api, None).get('cq_dry_run', False):
859 return [output_api.PresubmitNotifyResult(
860 'This is a CQ dry run, skipping OWNERS check')]
861 else:
858 return [output_api.PresubmitError("OWNERS check failed: this change has " 862 return [output_api.PresubmitError("OWNERS check failed: this change has "
859 "no Rietveld issue number, so we can't check it for approvals.")] 863 "no Rietveld issue number, so we can't check it for approvals.")]
860 needed = 'LGTM from an OWNER' 864 needed = 'LGTM from an OWNER'
861 output = output_api.PresubmitError 865 output = output_api.PresubmitError
862 else: 866 else:
863 needed = 'OWNER reviewers' 867 needed = 'OWNER reviewers'
864 output = output_api.PresubmitNotifyResult 868 output = output_api.PresubmitNotifyResult
865 869
866 affected_files = set([f.LocalPath() for f in 870 affected_files = set([f.LocalPath() for f in
867 input_api.change.AffectedFiles(file_filter=source_file_filter)]) 871 input_api.change.AffectedFiles(file_filter=source_file_filter)])
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 for f in affected_files: 1125 for f in affected_files:
1122 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()] 1126 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()]
1123 rc = gn.main(cmd) 1127 rc = gn.main(cmd)
1124 if rc == 2: 1128 if rc == 2:
1125 warnings.append(output_api.PresubmitPromptWarning( 1129 warnings.append(output_api.PresubmitPromptWarning(
1126 '%s requires formatting. Please run `gn format --in-place %s`.' % ( 1130 '%s requires formatting. Please run `gn format --in-place %s`.' % (
1127 f.AbsoluteLocalPath(), f.LocalPath()))) 1131 f.AbsoluteLocalPath(), f.LocalPath())))
1128 # It's just a warning, so ignore other types of failures assuming they'll be 1132 # It's just a warning, so ignore other types of failures assuming they'll be
1129 # caught elsewhere. 1133 # caught elsewhere.
1130 return warnings 1134 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