OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Module that sanitizes source files with specified modifiers.""" | 6 """Module that sanitizes source files with specified modifiers.""" |
7 | 7 |
8 | 8 |
9 import commands | 9 import commands |
10 import os | 10 import os |
11 import sys | 11 import sys |
12 | 12 |
13 | 13 |
14 _FILE_EXTENSIONS_TO_SANITIZE = ['cpp', 'h', 'c', 'gyp', 'gypi'] | 14 _FILE_EXTENSIONS_TO_SANITIZE = ['cpp', 'h', 'c', 'gyp', 'gypi'] |
15 | 15 |
16 _SUBDIRS_TO_IGNORE = ['.svn', 'third_party'] | 16 _SUBDIRS_TO_IGNORE = ['.git', '.svn', 'third_party'] |
17 | 17 |
18 | 18 |
19 def SanitizeFilesWithModifiers(directory, file_modifiers, line_modifiers): | 19 def SanitizeFilesWithModifiers(directory, file_modifiers, line_modifiers): |
20 """Sanitizes source files with the specified file and line modifiers. | 20 """Sanitizes source files with the specified file and line modifiers. |
21 | 21 |
22 Args: | 22 Args: |
23 directory: string - The directory which will be recursively traversed to | 23 directory: string - The directory which will be recursively traversed to |
24 find source files to apply modifiers to. | 24 find source files to apply modifiers to. |
25 file_modifiers: list - file-modification methods which should be applied to | 25 file_modifiers: list - file-modification methods which should be applied to |
26 the complete file content (Eg: EOFOneAndOnlyOneNewlineAdder). | 26 the complete file content (Eg: EOFOneAndOnlyOneNewlineAdder). |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 CopywriteChecker, | 143 CopywriteChecker, |
144 EOFOneAndOnlyOneNewlineAdder, | 144 EOFOneAndOnlyOneNewlineAdder, |
145 SvnEOLChecker, | 145 SvnEOLChecker, |
146 ], | 146 ], |
147 line_modifiers=[ | 147 line_modifiers=[ |
148 CrlfReplacer, | 148 CrlfReplacer, |
149 TabReplacer, | 149 TabReplacer, |
150 TrailingWhitespaceRemover, | 150 TrailingWhitespaceRemover, |
151 ], | 151 ], |
152 )) | 152 )) |
OLD | NEW |