OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |