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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 include_deletes=False, | 1171 include_deletes=False, |
1172 file_filter=lambda x: x.LocalPath().endswith('.gn') or | 1172 file_filter=lambda x: x.LocalPath().endswith('.gn') or |
1173 x.LocalPath().endswith('.gni') or | 1173 x.LocalPath().endswith('.gni') or |
1174 x.LocalPath().endswith('.typemap')) | 1174 x.LocalPath().endswith('.typemap')) |
1175 warnings = [] | 1175 warnings = [] |
1176 for f in affected_files: | 1176 for f in affected_files: |
1177 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()] | 1177 cmd = ['gn', 'format', '--dry-run', f.AbsoluteLocalPath()] |
1178 rc = gn.main(cmd) | 1178 rc = gn.main(cmd) |
1179 if rc == 2: | 1179 if rc == 2: |
1180 warnings.append(output_api.PresubmitPromptWarning( | 1180 warnings.append(output_api.PresubmitPromptWarning( |
1181 '%s requires formatting. Please run `gn format --in-place %s`.' % ( | 1181 '%s requires formatting. Please run:\n gn format %s' % ( |
1182 f.AbsoluteLocalPath(), f.LocalPath()))) | 1182 f.AbsoluteLocalPath(), f.LocalPath()))) |
1183 # It's just a warning, so ignore other types of failures assuming they'll be | 1183 # It's just a warning, so ignore other types of failures assuming they'll be |
1184 # caught elsewhere. | 1184 # caught elsewhere. |
1185 return warnings | 1185 return warnings |
OLD | NEW |