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

Side by Side Diff: presubmit_canned_checks.py

Issue 143903006: Support passing files/directories to git cl format (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Change canned check to only check directory Created 6 years, 11 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 | Annotate | Revision Log
« git_cl.py ('K') | « git_cl.py ('k') | no next file » | 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 10
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 input_api, output_api)) 1038 input_api, output_api))
1039 snapshot("checking do not submit in files") 1039 snapshot("checking do not submit in files")
1040 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( 1040 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles(
1041 input_api, output_api)) 1041 input_api, output_api))
1042 snapshot("done") 1042 snapshot("done")
1043 return results 1043 return results
1044 1044
1045 1045
1046 def CheckPatchFormatted(input_api, output_api): 1046 def CheckPatchFormatted(input_api, output_api):
1047 import git_cl 1047 import git_cl
1048 code, _ = git_cl.RunGitWithCode(['cl', 'format', '--dry-run'], 1048 cmd = ['cl', 'format', '--dry-run', input_api.PresubmitLocalPath()]
1049 suppress_stderr=True) 1049 code, _ = git_cl.RunGitWithCode(cmd, suppress_stderr=True)
1050 if code == 2: 1050 if code == 2:
1051 return [output_api.PresubmitPromptWarning( 1051 return [output_api.PresubmitPromptWarning(
1052 'Your patch is not formatted, please run git cl format.')] 1052 'Your patch is not formatted, please run git cl format.')]
1053 # As this is just a warning, ignore all other errors if the user 1053 # As this is just a warning, ignore all other errors if the user
1054 # happens to have a broken clang-format, doesn't use git, etc etc. 1054 # happens to have a broken clang-format, doesn't use git, etc etc.
1055 return [] 1055 return []
OLDNEW
« git_cl.py ('K') | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698