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 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 804 |
805 def RunPylint(input_api, *args, **kwargs): | 805 def RunPylint(input_api, *args, **kwargs): |
806 """Legacy presubmit function. | 806 """Legacy presubmit function. |
807 | 807 |
808 For better performance, get all tests and then pass to | 808 For better performance, get all tests and then pass to |
809 input_api.RunTests. | 809 input_api.RunTests. |
810 """ | 810 """ |
811 return input_api.RunTests(GetPylint(input_api, *args, **kwargs), False) | 811 return input_api.RunTests(GetPylint(input_api, *args, **kwargs), False) |
812 | 812 |
813 | 813 |
814 # TODO(dpranke): Get the host_url from the input_api instead | 814 def CheckRietveldTryJobExecution(dummy_input_api, output_api, |
815 def CheckRietveldTryJobExecution(dummy_input_api, dummy_output_api, | |
816 dummy_host_url, dummy_platforms, | 815 dummy_host_url, dummy_platforms, |
817 dummy_owner): | 816 dummy_owner): |
818 # Temporarily 'fix' the check while the Rietveld API is being upgraded to | 817 return [ |
819 # something sensible. | 818 output_api.PresubmitNotifyResult( |
820 return [] | 819 'CheckRietveldTryJobExecution is deprecated, please remove it.') |
| 820 ] |
821 | 821 |
822 | 822 |
823 def CheckBuildbotPendingBuilds(input_api, output_api, url, max_pendings, | 823 def CheckBuildbotPendingBuilds(input_api, output_api, url, max_pendings, |
824 ignored): | 824 ignored): |
825 try: | 825 try: |
826 connection = input_api.urllib2.urlopen(url) | 826 connection = input_api.urllib2.urlopen(url) |
827 raw_data = connection.read() | 827 raw_data = connection.read() |
828 connection.close() | 828 connection.close() |
829 except IOError: | 829 except IOError: |
830 return [output_api.PresubmitNotifyResult('%s is not accessible' % url)] | 830 return [output_api.PresubmitNotifyResult('%s is not accessible' % url)] |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 for f in affected_files: | 1127 for f in affected_files: |
1128 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()] | 1128 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()] |
1129 rc = gn.main(cmd) | 1129 rc = gn.main(cmd) |
1130 if rc == 2: | 1130 if rc == 2: |
1131 warnings.append(output_api.PresubmitPromptWarning( | 1131 warnings.append(output_api.PresubmitPromptWarning( |
1132 '%s requires formatting. Please run `gn format --in-place %s`.' % ( | 1132 '%s requires formatting. Please run `gn format --in-place %s`.' % ( |
1133 f.AbsoluteLocalPath(), f.LocalPath()))) | 1133 f.AbsoluteLocalPath(), f.LocalPath()))) |
1134 # It's just a warning, so ignore other types of failures assuming they'll be | 1134 # It's just a warning, so ignore other types of failures assuming they'll be |
1135 # caught elsewhere. | 1135 # caught elsewhere. |
1136 return warnings | 1136 return warnings |
OLD | NEW |