OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2008 the V8 project authors. All rights reserved. | 3 # Copyright 2008 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return ['src', 'public', 'samples', join('test', 'cctest')] | 144 return ['src', 'public', 'samples', join('test', 'cctest')] |
145 | 145 |
146 def ProcessFiles(self, files): | 146 def ProcessFiles(self, files): |
147 filt = '-,' + ",".join(['+' + n for n in ENABLED_LINT_RULES]) | 147 filt = '-,' + ",".join(['+' + n for n in ENABLED_LINT_RULES]) |
148 command = ['cpplint.py', '--filter', filt] + join(files) | 148 command = ['cpplint.py', '--filter', filt] + join(files) |
149 process = subprocess.Popen(command) | 149 process = subprocess.Popen(command) |
150 return process.wait() == 0 | 150 return process.wait() == 0 |
151 | 151 |
152 | 152 |
153 COPYRIGHT_HEADER_PATTERN = re.compile( | 153 COPYRIGHT_HEADER_PATTERN = re.compile( |
154 r'Copyright [\d-]*2008 the V8 project authors. All rights reserved.') | 154 r'Copyright [\d-]*200[8-9] the V8 project authors. All rights reserved.') |
155 | 155 |
156 class SourceProcessor(SourceFileProcessor): | 156 class SourceProcessor(SourceFileProcessor): |
157 """ | 157 """ |
158 Check that all files include a copyright notice. | 158 Check that all files include a copyright notice. |
159 """ | 159 """ |
160 | 160 |
161 RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c', 'SConscript', | 161 RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c', 'SConscript', |
162 'SConstruct', '.status'] | 162 'SConstruct', '.status'] |
163 def IsRelevant(self, name): | 163 def IsRelevant(self, name): |
164 for ext in SourceProcessor.RELEVANT_EXTENSIONS: | 164 for ext in SourceProcessor.RELEVANT_EXTENSIONS: |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 success = CppLintProcessor().Run(workspace) and success | 220 success = CppLintProcessor().Run(workspace) and success |
221 success = SourceProcessor().Run(workspace) and success | 221 success = SourceProcessor().Run(workspace) and success |
222 if success: | 222 if success: |
223 return 0 | 223 return 0 |
224 else: | 224 else: |
225 return 1 | 225 return 1 |
226 | 226 |
227 | 227 |
228 if __name__ == '__main__': | 228 if __name__ == '__main__': |
229 sys.exit(Main()) | 229 sys.exit(Main()) |
OLD | NEW |