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

Side by Side Diff: presubmit_canned_checks.py

Issue 11880040: Fix pylint presubmit checks (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | 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 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 extra_paths_list = extra_paths_list or [] 636 extra_paths_list = extra_paths_list or []
637 637
638 if input_api.is_committing: 638 if input_api.is_committing:
639 error_type = output_api.PresubmitError 639 error_type = output_api.PresubmitError
640 else: 640 else:
641 error_type = output_api.PresubmitPromptWarning 641 error_type = output_api.PresubmitPromptWarning
642 642
643 # Only trigger if there is at least one python file affected. 643 # Only trigger if there is at least one python file affected.
644 def rel_path(regex): 644 def rel_path(regex):
645 """Modifies a regex for a subject to accept paths relative to root.""" 645 """Modifies a regex for a subject to accept paths relative to root."""
646 if input_api.os_path.samefile(
647 input_api.PresubmitLocalPath(), input_api.change.RepositoryRoot()):
648 return regex
646 prefix = input_api.os_path.join(input_api.os_path.relpath( 649 prefix = input_api.os_path.join(input_api.os_path.relpath(
647 input_api.PresubmitLocalPath(), input_api.change.RepositoryRoot()), '') 650 input_api.PresubmitLocalPath(), input_api.change.RepositoryRoot()), '')
648 return input_api.re.escape(prefix) + regex 651 return input_api.re.escape(prefix) + regex
649 src_filter = lambda x: input_api.FilterSourceFile( 652 src_filter = lambda x: input_api.FilterSourceFile(
650 x, map(rel_path, white_list), map(rel_path, black_list)) 653 x, map(rel_path, white_list), map(rel_path, black_list))
651 if not input_api.AffectedSourceFiles(src_filter): 654 if not input_api.AffectedSourceFiles(src_filter):
652 input_api.logging.info('Skipping pylint: no matching changes.') 655 input_api.logging.info('Skipping pylint: no matching changes.')
653 return [] 656 return []
654 657
655 extra_args = ['--rcfile=%s' % input_api.os_path.join(_HERE, 'pylintrc')] 658 extra_args = ['--rcfile=%s' % input_api.os_path.join(_HERE, 'pylintrc')]
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 snapshot("checking description") 999 snapshot("checking description")
997 results.extend(input_api.canned_checks.CheckChangeHasDescription( 1000 results.extend(input_api.canned_checks.CheckChangeHasDescription(
998 input_api, output_api)) 1001 input_api, output_api))
999 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( 1002 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription(
1000 input_api, output_api)) 1003 input_api, output_api))
1001 snapshot("checking do not submit in files") 1004 snapshot("checking do not submit in files")
1002 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( 1005 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles(
1003 input_api, output_api)) 1006 input_api, output_api))
1004 snapshot("done") 1007 snapshot("done")
1005 return results 1008 return results
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698