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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 """An instance of this object is passed to presubmit scripts so they can | 180 """An instance of this object is passed to presubmit scripts so they can |
181 know stuff about the change they're looking at. | 181 know stuff about the change they're looking at. |
182 """ | 182 """ |
183 # Method could be a function | 183 # Method could be a function |
184 # pylint: disable=R0201 | 184 # pylint: disable=R0201 |
185 | 185 |
186 # File extensions that are considered source files from a style guide | 186 # File extensions that are considered source files from a style guide |
187 # perspective. Don't modify this list from a presubmit script! | 187 # perspective. Don't modify this list from a presubmit script! |
188 DEFAULT_WHITE_LIST = ( | 188 DEFAULT_WHITE_LIST = ( |
189 # C++ and friends | 189 # C++ and friends |
190 r".*\.c$", r".*\.cc$", r".*\.cpp$", r".*\.h$", r".*\.m$", r".*\.mm$", | 190 r".+\.c$", r".+\.cc$", r".+\.cpp$", r".+\.h$", r".+\.m$", r".+\.mm$", |
191 r".*\.inl$", r".*\.asm$", r".*\.hxx$", r".*\.hpp$", r".*\.s$", r".*\.S$", | 191 r".+\.inl$", r".+\.asm$", r".+\.hxx$", r".+\.hpp$", r".+\.s$", r".+\.S$", |
192 # Scripts | 192 # Scripts |
193 r".*\.js$", r".*\.py$", r".*\.sh$", r".*\.rb$", r".*\.pl$", r".*\.pm$", | 193 r".+\.js$", r".+\.py$", r".+\.sh$", r".+\.rb$", r".+\.pl$", r".+\.pm$", |
194 # No extension at all, note that ALL CAPS files are black listed in | 194 # No extension at all, note that ALL CAPS files are black listed in |
195 # DEFAULT_BLACK_LIST below. | 195 # DEFAULT_BLACK_LIST below. |
196 r"(^|.*?[\\\/])[^.]+$", | 196 r"(^|.*?[\\\/])[^.]+$", |
197 # Other | 197 # Other |
198 r".*\.java$", r".*\.mk$", r".*\.am$", | 198 r".+\.java$", r".+\.mk$", r".+\.am$", |
199 ) | 199 ) |
200 | 200 |
201 # Path regexp that should be excluded from being considered containing source | 201 # Path regexp that should be excluded from being considered containing source |
202 # files. Don't modify this list from a presubmit script! | 202 # files. Don't modify this list from a presubmit script! |
203 DEFAULT_BLACK_LIST = ( | 203 DEFAULT_BLACK_LIST = ( |
204 r".*\bexperimental[\\\/].*", | 204 r".*\bexperimental[\\\/].*", |
205 r".*\bthird_party[\\\/].*", | 205 r".*\bthird_party[\\\/].*", |
206 # Output directories (just in case) | 206 # Output directories (just in case) |
207 r".*\bDebug[\\\/].*", | 207 r".*\bDebug[\\\/].*", |
208 r".*\bRelease[\\\/].*", | 208 r".*\bRelease[\\\/].*", |
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 except PresubmitFailure, e: | 1227 except PresubmitFailure, e: |
1228 print >> sys.stderr, e | 1228 print >> sys.stderr, e |
1229 print >> sys.stderr, 'Maybe your depot_tools is out of date?' | 1229 print >> sys.stderr, 'Maybe your depot_tools is out of date?' |
1230 print >> sys.stderr, 'If all fails, contact maruel@' | 1230 print >> sys.stderr, 'If all fails, contact maruel@' |
1231 return 2 | 1231 return 2 |
1232 | 1232 |
1233 | 1233 |
1234 if __name__ == '__main__': | 1234 if __name__ == '__main__': |
1235 fix_encoding.fix_encoding() | 1235 fix_encoding.fix_encoding() |
1236 sys.exit(Main(None)) | 1236 sys.exit(Main(None)) |
OLD | NEW |