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

Side by Side Diff: PRESUBMIT.py

Issue 11448014: Add a presubmit check to prevent committing .rej/.orig patch files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address all comments Created 8 years 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 | PRESUBMIT_test.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 """Top-level presubmit script for Chromium. 5 """Top-level presubmit script for Chromium.
6 6
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into gcl. 8 for more details about the presubmit API built into gcl.
9 """ 9 """
10 10
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 results.extend(_CheckNoNewWStrings(input_api, output_api)) 662 results.extend(_CheckNoNewWStrings(input_api, output_api))
663 results.extend(_CheckNoDEPSGIT(input_api, output_api)) 663 results.extend(_CheckNoDEPSGIT(input_api, output_api))
664 results.extend(_CheckNoBannedFunctions(input_api, output_api)) 664 results.extend(_CheckNoBannedFunctions(input_api, output_api))
665 results.extend(_CheckNoPragmaOnce(input_api, output_api)) 665 results.extend(_CheckNoPragmaOnce(input_api, output_api))
666 results.extend(_CheckNoTrinaryTrueFalse(input_api, output_api)) 666 results.extend(_CheckNoTrinaryTrueFalse(input_api, output_api))
667 results.extend(_CheckUnwantedDependencies(input_api, output_api)) 667 results.extend(_CheckUnwantedDependencies(input_api, output_api))
668 results.extend(_CheckFilePermissions(input_api, output_api)) 668 results.extend(_CheckFilePermissions(input_api, output_api))
669 results.extend(_CheckNoAuraWindowPropertyHInHeaders(input_api, output_api)) 669 results.extend(_CheckNoAuraWindowPropertyHInHeaders(input_api, output_api))
670 results.extend(_CheckIncludeOrder(input_api, output_api)) 670 results.extend(_CheckIncludeOrder(input_api, output_api))
671 results.extend(_CheckForVersionControlConflicts(input_api, output_api)) 671 results.extend(_CheckForVersionControlConflicts(input_api, output_api))
672 results.extend(_CheckPatchFiles(input_api, output_api))
672 673
673 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()): 674 if any('PRESUBMIT.py' == f.LocalPath() for f in input_api.AffectedFiles()):
674 results.extend(input_api.canned_checks.RunUnitTestsInDirectory( 675 results.extend(input_api.canned_checks.RunUnitTestsInDirectory(
675 input_api, output_api, 676 input_api, output_api,
676 input_api.PresubmitLocalPath(), 677 input_api.PresubmitLocalPath(),
677 whitelist=[r'.+_test\.py$'])) 678 whitelist=[r'.+_test\.py$']))
678 return results 679 return results
679 680
680 681
681 def _CheckSubversionConfig(input_api, output_api): 682 def _CheckSubversionConfig(input_api, output_api):
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 return [output_api.PresubmitPromptWarning( 746 return [output_api.PresubmitPromptWarning(
746 ('%s is not in AUTHORS file. If you are a new contributor, please visit' 747 ('%s is not in AUTHORS file. If you are a new contributor, please visit'
747 '\n' 748 '\n'
748 'http://www.chromium.org/developers/contributing-code and read the ' 749 'http://www.chromium.org/developers/contributing-code and read the '
749 '"Legal" section\n' 750 '"Legal" section\n'
750 'If you are a chromite, verify the contributor signed the CLA.') % 751 'If you are a chromite, verify the contributor signed the CLA.') %
751 author)] 752 author)]
752 return [] 753 return []
753 754
754 755
756 def _CheckPatchFiles(input_api, output_api):
757 problems = [f.LocalPath() for f in input_api.AffectedFiles()
M-A Ruel 2012/12/05 19:39:22 In theory, you should put this one at +4 too on ne
enne (OOO) 2012/12/05 19:46:44 Oh? Are you suggesting to linebreak after the brac
M-A Ruel 2012/12/05 19:51:08 Actually, you are right it'd be +2, don't bother.
758 if f.LocalPath().endswith(('.orig', '.rej'))]
759 if problems:
760 return [output_api.PresubmitError(
761 "Don't commit .rej and .orig files.", problems)]
762 else:
763 return []
764
765
755 def CheckChangeOnUpload(input_api, output_api): 766 def CheckChangeOnUpload(input_api, output_api):
756 results = [] 767 results = []
757 results.extend(_CommonChecks(input_api, output_api)) 768 results.extend(_CommonChecks(input_api, output_api))
758 return results 769 return results
759 770
760 771
761 def CheckChangeOnCommit(input_api, output_api): 772 def CheckChangeOnCommit(input_api, output_api):
762 results = [] 773 results = []
763 results.extend(_CommonChecks(input_api, output_api)) 774 results.extend(_CommonChecks(input_api, output_api))
764 # TODO(thestig) temporarily disabled, doesn't work in third_party/ 775 # TODO(thestig) temporarily disabled, doesn't work in third_party/
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 'win_aura', 825 'win_aura',
815 'win_rel', 826 'win_rel',
816 ] 827 ]
817 828
818 # Match things like path/aura/file.cc and path/file_aura.cc. 829 # Match things like path/aura/file.cc and path/file_aura.cc.
819 # Same for chromeos. 830 # Same for chromeos.
820 if any(re.search('[/_](aura|chromeos)', f) for f in files): 831 if any(re.search('[/_](aura|chromeos)', f) for f in files):
821 trybots += ['linux_chromeos_clang:compile', 'linux_chromeos_asan'] 832 trybots += ['linux_chromeos_clang:compile', 'linux_chromeos_asan']
822 833
823 return trybots 834 return trybots
OLDNEW
« no previous file with comments | « no previous file | PRESUBMIT_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698