| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2012 the V8 project authors. All rights reserved. | 3 # Copyright 2012 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 whitespace/newline | 96 whitespace/newline |
| 97 whitespace/operators | 97 whitespace/operators |
| 98 whitespace/parens | 98 whitespace/parens |
| 99 whitespace/tab | 99 whitespace/tab |
| 100 whitespace/todo | 100 whitespace/todo |
| 101 """.split() | 101 """.split() |
| 102 | 102 |
| 103 # TODO(bmeurer): Fix and re-enable readability/check | 103 # TODO(bmeurer): Fix and re-enable readability/check |
| 104 | 104 |
| 105 LINT_OUTPUT_PATTERN = re.compile(r'^.+[:(]\d+[:)]|^Done processing') | 105 LINT_OUTPUT_PATTERN = re.compile(r'^.+[:(]\d+[:)]|^Done processing') |
| 106 | 106 FLAGS_LINE = re.compile("//\s*Flags:.*--([A-z0-9-])+_[A-z0-9].*\n") |
| 107 | 107 |
| 108 def CppLintWorker(command): | 108 def CppLintWorker(command): |
| 109 try: | 109 try: |
| 110 process = subprocess.Popen(command, stderr=subprocess.PIPE) | 110 process = subprocess.Popen(command, stderr=subprocess.PIPE) |
| 111 process.wait() | 111 process.wait() |
| 112 out_lines = "" | 112 out_lines = "" |
| 113 error_count = -1 | 113 error_count = -1 |
| 114 while True: | 114 while True: |
| 115 out_line = process.stderr.readline() | 115 out_line = process.stderr.readline() |
| 116 if out_line == '' and process.poll() != None: | 116 if out_line == '' and process.poll() != None: |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 line += 1 | 407 line += 1 |
| 408 if len(lines) >= 1: | 408 if len(lines) >= 1: |
| 409 linenumbers = ', '.join(lines) | 409 linenumbers = ', '.join(lines) |
| 410 if len(lines) > 1: | 410 if len(lines) > 1: |
| 411 print "%s does not have two empty lines between declarations " \ | 411 print "%s does not have two empty lines between declarations " \ |
| 412 "in lines %s." % (name, linenumbers) | 412 "in lines %s." % (name, linenumbers) |
| 413 else: | 413 else: |
| 414 print "%s does not have two empty lines between declarations " \ | 414 print "%s does not have two empty lines between declarations " \ |
| 415 "in line %s." % (name, linenumbers) | 415 "in line %s." % (name, linenumbers) |
| 416 result = False | 416 result = False |
| 417 # Sanitize flags for fuzzer. |
| 418 if "mjsunit" in name: |
| 419 match = FLAGS_LINE.search(contents) |
| 420 if match: |
| 421 print "%s Flags should use '-' (not '_')" % name |
| 422 result = False |
| 417 return result | 423 return result |
| 418 | 424 |
| 419 def ProcessFiles(self, files, path): | 425 def ProcessFiles(self, files, path): |
| 420 success = True | 426 success = True |
| 421 violations = 0 | 427 violations = 0 |
| 422 for file in files: | 428 for file in files: |
| 423 try: | 429 try: |
| 424 handle = open(file) | 430 handle = open(file) |
| 425 contents = handle.read() | 431 contents = handle.read() |
| 426 if not self.ProcessContents(file, contents): | 432 if not self.ProcessContents(file, contents): |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 success = CheckRuntimeVsNativesNameClashes(workspace) and success | 498 success = CheckRuntimeVsNativesNameClashes(workspace) and success |
| 493 success = CheckExternalReferenceRegistration(workspace) and success | 499 success = CheckExternalReferenceRegistration(workspace) and success |
| 494 if success: | 500 if success: |
| 495 return 0 | 501 return 0 |
| 496 else: | 502 else: |
| 497 return 1 | 503 return 1 |
| 498 | 504 |
| 499 | 505 |
| 500 if __name__ == '__main__': | 506 if __name__ == '__main__': |
| 501 sys.exit(Main()) | 507 sys.exit(Main()) |
| OLD | NEW |