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

Side by Side Diff: presubmit_canned_checks.py

Issue 22837004: Change default ReportErrorFileAndLine to use filename:lineno format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: ReportErrorFileAndLine: Created 7 years, 4 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
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 'Found a CR character in these files:', items=cr_files)) 221 'Found a CR character in these files:', items=cr_files))
222 if eof_files: 222 if eof_files:
223 outputs.append(output_api.PresubmitPromptWarning( 223 outputs.append(output_api.PresubmitPromptWarning(
224 'These files should end in one (and only one) newline character:', 224 'These files should end in one (and only one) newline character:',
225 items=eof_files)) 225 items=eof_files))
226 return outputs 226 return outputs
227 227
228 228
229 def _ReportErrorFileAndLine(filename, line_num, dummy_line): 229 def _ReportErrorFileAndLine(filename, line_num, dummy_line):
230 """Default error formatter for _FindNewViolationsOfRule.""" 230 """Default error formatter for _FindNewViolationsOfRule."""
231 return '%s, line %s' % (filename, line_num) 231 return '%s:%s' % (filename, line_num)
232 232
233 233
234 def _FindNewViolationsOfRule(callable_rule, input_api, source_file_filter=None, 234 def _FindNewViolationsOfRule(callable_rule, input_api, source_file_filter=None,
235 error_formatter=_ReportErrorFileAndLine): 235 error_formatter=_ReportErrorFileAndLine):
236 """Find all newly introduced violations of a per-line rule (a callable). 236 """Find all newly introduced violations of a per-line rule (a callable).
237 237
238 Arguments: 238 Arguments:
239 callable_rule: a callable taking a file extension and line of input and 239 callable_rule: a callable taking a file extension and line of input and
240 returning True if the rule is satisfied and False if there was a problem. 240 returning True if the rule is satisfied and False if there was a problem.
241 input_api: object to enumerate the affected files. 241 input_api: object to enumerate the affected files.
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 snapshot("checking description") 1022 snapshot("checking description")
1023 results.extend(input_api.canned_checks.CheckChangeHasDescription( 1023 results.extend(input_api.canned_checks.CheckChangeHasDescription(
1024 input_api, output_api)) 1024 input_api, output_api))
1025 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( 1025 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription(
1026 input_api, output_api)) 1026 input_api, output_api))
1027 snapshot("checking do not submit in files") 1027 snapshot("checking do not submit in files")
1028 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( 1028 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles(
1029 input_api, output_api)) 1029 input_api, output_api))
1030 snapshot("done") 1030 snapshot("done")
1031 return results 1031 return results
OLDNEW
« no previous file with comments | « no previous file | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698