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

Side by Side Diff: PRESUBMIT.py

Issue 118202: Fix PRESUBMIT.py's path handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 6 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 | 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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Top-level presubmit script for Chromium. 6 """Top-level presubmit script for Chromium.
7 7
8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for 8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
9 details on the presubmit API built into gcl. 9 details on the presubmit API built into gcl.
10 """ 10 """
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 found = False 80 found = False
81 for item in excluded_paths: 81 for item in excluded_paths:
82 if item.match(path): 82 if item.match(path):
83 found = True 83 found = True
84 break 84 break
85 if found: 85 if found:
86 continue 86 continue
87 87
88 # Need to read the file ourselves since AffectedFile.NewContents() 88 # Need to read the file ourselves since AffectedFile.NewContents()
89 # will normalize line endings. 89 # will normalize line endings.
90 contents = ReadFile(path) 90 contents = ReadFile(f.AbsoluteLocalPath())
91 if '\r' in contents: 91 if '\r' in contents:
92 cr_files.append(path) 92 cr_files.append(path)
93 93
94 # Check that the file ends in one and only one newline character. 94 # Check that the file ends in one and only one newline character.
95 if len(contents) > 0 and (contents[-1:] != "\n" or contents[-2:-1] == "\n"): 95 if len(contents) > 0 and (contents[-1:] != "\n" or contents[-2:-1] == "\n"):
96 eof_files.append(path) 96 eof_files.append(path)
97 97
98 local_errors = [] 98 local_errors = []
99 # Remove end of line character. 99 # Remove end of line character.
100 lines = contents.splitlines() 100 lines = contents.splitlines()
(...skipping 27 matching lines...) Expand all
128 128
129 if cr_files: 129 if cr_files:
130 results.append(output_api.PresubmitError( 130 results.append(output_api.PresubmitError(
131 'Found CR (or CRLF) line ending in these files, please use only LF:', 131 'Found CR (or CRLF) line ending in these files, please use only LF:',
132 items=cr_files)) 132 items=cr_files))
133 if eof_files: 133 if eof_files:
134 results.append(output_api.PresubmitError( 134 results.append(output_api.PresubmitError(
135 'These files should end in one (and only one) newline character:', 135 'These files should end in one (and only one) newline character:',
136 items=eof_files)) 136 items=eof_files))
137 return results 137 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