| 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 | 10 | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 54         keyword + ' is present in the changelist description.')] | 54         keyword + ' is present in the changelist description.')] | 
| 55   else: | 55   else: | 
| 56     return [] | 56     return [] | 
| 57 | 57 | 
| 58 | 58 | 
| 59 def CheckChangeHasDescription(input_api, output_api): | 59 def CheckChangeHasDescription(input_api, output_api): | 
| 60   """Checks the CL description is not empty.""" | 60   """Checks the CL description is not empty.""" | 
| 61   text = input_api.change.DescriptionText() | 61   text = input_api.change.DescriptionText() | 
| 62   if text.strip() == '': | 62   if text.strip() == '': | 
| 63     if input_api.is_committing: | 63     if input_api.is_committing: | 
| 64       return [output_api.PresubmitError('Add a description.')] | 64       return [output_api.PresubmitError('Add a description to the CL.')] | 
| 65     else: | 65     else: | 
| 66       return [output_api.PresubmitNotifyResult('Add a description.')] | 66       return [output_api.PresubmitNotifyResult('Add a description to the CL.')] | 
| 67   return [] | 67   return [] | 
| 68 | 68 | 
| 69 | 69 | 
| 70 def CheckChangeWasUploaded(input_api, output_api): | 70 def CheckChangeWasUploaded(input_api, output_api): | 
| 71   """Checks that the issue was uploaded before committing.""" | 71   """Checks that the issue was uploaded before committing.""" | 
| 72   if input_api.is_committing and not input_api.change.issue: | 72   if input_api.is_committing and not input_api.change.issue: | 
| 73     return [output_api.PresubmitError( | 73     return [output_api.PresubmitError( | 
| 74       'Issue wasn\'t uploaded. Please upload first.')] | 74       'Issue wasn\'t uploaded. Please upload first.')] | 
| 75   return [] | 75   return [] | 
| 76 | 76 | 
| (...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1094 def CheckPatchFormatted(input_api, output_api): | 1094 def CheckPatchFormatted(input_api, output_api): | 
| 1095   import git_cl | 1095   import git_cl | 
| 1096   cmd = ['cl', 'format', '--dry-run', input_api.PresubmitLocalPath()] | 1096   cmd = ['cl', 'format', '--dry-run', input_api.PresubmitLocalPath()] | 
| 1097   code, _ = git_cl.RunGitWithCode(cmd, suppress_stderr=True) | 1097   code, _ = git_cl.RunGitWithCode(cmd, suppress_stderr=True) | 
| 1098   if code == 2: | 1098   if code == 2: | 
| 1099     return [output_api.PresubmitPromptWarning( | 1099     return [output_api.PresubmitPromptWarning( | 
| 1100       'Your patch is not formatted, please run git cl format.')] | 1100       'Your patch is not formatted, please run git cl format.')] | 
| 1101   # As this is just a warning, ignore all other errors if the user | 1101   # As this is just a warning, ignore all other errors if the user | 
| 1102   # happens to have a broken clang-format, doesn't use git, etc etc. | 1102   # happens to have a broken clang-format, doesn't use git, etc etc. | 
| 1103   return [] | 1103   return [] | 
| OLD | NEW | 
|---|