Commit 425d9ce2 authored by Nodir Turakulov's avatar Nodir Turakulov Committed by Commit Bot

Allow CheckPatchFormatted to cause a failure

Extend CheckPatchFormatted to allow other presubmit result types.

Change-Id: I1c592d73657aa9c8a8fd04dbd66f086ce7bb1274
Reviewed-on: https://chromium-review.googlesource.com/1100127Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
parent cd8d4a65
...@@ -1061,7 +1061,9 @@ def PanProjectChecks(input_api, output_api, ...@@ -1061,7 +1061,9 @@ def PanProjectChecks(input_api, output_api,
def CheckPatchFormatted( def CheckPatchFormatted(
input_api, output_api, check_js=False, check_python=False): input_api, output_api, check_js=False, check_python=False,
result_factory=None):
result_factory = result_factory or output_api.PresubmitPromptWarning
import git_cl import git_cl
display_args = [] display_args = []
...@@ -1089,7 +1091,7 @@ def CheckPatchFormatted( ...@@ -1089,7 +1091,7 @@ def CheckPatchFormatted(
else: else:
short_path = input_api.basename(input_api.change.RepositoryRoot()) short_path = input_api.basename(input_api.change.RepositoryRoot())
display_args.append(presubmit_subdir) display_args.append(presubmit_subdir)
return [output_api.PresubmitPromptWarning( return [result_factory(
'The %s directory requires source formatting. ' 'The %s directory requires source formatting. '
'Please run: git cl format %s' % 'Please run: git cl format %s' %
(short_path, ' '.join(display_args)))] (short_path, ' '.join(display_args)))]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment