OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """Enables directory-specific presubmit checks to run at upload and/or commit. | 6 """Enables directory-specific presubmit checks to run at upload and/or commit. |
7 """ | 7 """ |
8 | 8 |
9 __version__ = '1.6.1' | 9 __version__ = '1.6.1' |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 | 179 |
180 class InputApi(object): | 180 class InputApi(object): |
181 """An instance of this object is passed to presubmit scripts so they can | 181 """An instance of this object is passed to presubmit scripts so they can |
182 know stuff about the change they're looking at. | 182 know stuff about the change they're looking at. |
183 """ | 183 """ |
184 # Method could be a function | 184 # Method could be a function |
185 # pylint: disable=R0201 | 185 # pylint: disable=R0201 |
186 | 186 |
187 # File extensions that are considered source files from a style guide | 187 # File extensions that are considered source files from a style guide |
188 # perspective. Don't modify this list from a presubmit script! | 188 # perspective. Don't modify this list from a presubmit script! |
189 # | |
190 # Files without an extension aren't included in the list. If you want to | |
191 # filter them as source files, add r"(^|.*?[\\\/])[^.]+$" to the white list. | |
192 # Note that ALL CAPS files are black listed in DEFAULT_BLACK_LIST below. | |
Dirk Pranke
2011/06/24 18:58:34
Aside ... I wonder if we should change this to jus
M-A Ruel
2011/06/24 19:11:36
Make sense but some of them wouldn't work so it wo
| |
189 DEFAULT_WHITE_LIST = ( | 193 DEFAULT_WHITE_LIST = ( |
190 # C++ and friends | 194 # C++ and friends |
191 r".+\.c$", r".+\.cc$", r".+\.cpp$", r".+\.h$", r".+\.m$", r".+\.mm$", | 195 r".+\.c$", r".+\.cc$", r".+\.cpp$", r".+\.h$", r".+\.m$", r".+\.mm$", |
192 r".+\.inl$", r".+\.asm$", r".+\.hxx$", r".+\.hpp$", r".+\.s$", r".+\.S$", | 196 r".+\.inl$", r".+\.asm$", r".+\.hxx$", r".+\.hpp$", r".+\.s$", r".+\.S$", |
193 # Scripts | 197 # Scripts |
194 r".+\.js$", r".+\.py$", r".+\.sh$", r".+\.rb$", r".+\.pl$", r".+\.pm$", | 198 r".+\.js$", r".+\.py$", r".+\.sh$", r".+\.rb$", r".+\.pl$", r".+\.pm$", |
195 # No extension at all, note that ALL CAPS files are black listed in | |
196 # DEFAULT_BLACK_LIST below. | |
197 r"(^|.*?[\\\/])[^.]+$", | |
198 # Other | 199 # Other |
199 r".+\.java$", r".+\.mk$", r".+\.am$", | 200 r".+\.java$", r".+\.mk$", r".+\.am$", |
200 ) | 201 ) |
201 | 202 |
202 # Path regexp that should be excluded from being considered containing source | 203 # Path regexp that should be excluded from being considered containing source |
203 # files. Don't modify this list from a presubmit script! | 204 # files. Don't modify this list from a presubmit script! |
204 DEFAULT_BLACK_LIST = ( | 205 DEFAULT_BLACK_LIST = ( |
205 r".*\bexperimental[\\\/].*", | 206 r".*\bexperimental[\\\/].*", |
206 r".*\bthird_party[\\\/].*", | 207 r".*\bthird_party[\\\/].*", |
207 # Output directories (just in case) | 208 # Output directories (just in case) |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1247 except PresubmitFailure, e: | 1248 except PresubmitFailure, e: |
1248 print >> sys.stderr, e | 1249 print >> sys.stderr, e |
1249 print >> sys.stderr, 'Maybe your depot_tools is out of date?' | 1250 print >> sys.stderr, 'Maybe your depot_tools is out of date?' |
1250 print >> sys.stderr, 'If all fails, contact maruel@' | 1251 print >> sys.stderr, 'If all fails, contact maruel@' |
1251 return 2 | 1252 return 2 |
1252 | 1253 |
1253 | 1254 |
1254 if __name__ == '__main__': | 1255 if __name__ == '__main__': |
1255 fix_encoding.fix_encoding() | 1256 fix_encoding.fix_encoding() |
1256 sys.exit(Main(None)) | 1257 sys.exit(Main(None)) |
OLD | NEW |