Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 Google Inc. All rights reserved. | 2 # Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 # | 3 # |
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 "source_frame/SourceFrame.js", | 85 "source_frame/SourceFrame.js", |
| 86 ] | 86 ] |
| 87 | 87 |
| 88 type_checked_jsdoc_tags_list = ["param", "return", "type", "enum"] | 88 type_checked_jsdoc_tags_list = ["param", "return", "type", "enum"] |
| 89 | 89 |
| 90 type_checked_jsdoc_tags_or = "|".join(type_checked_jsdoc_tags_list) | 90 type_checked_jsdoc_tags_or = "|".join(type_checked_jsdoc_tags_list) |
| 91 | 91 |
| 92 # Basic regex for invalid JsDoc types: an object type name ([A-Z][A-Za-z0-9.]+[A -Za-z0-9]) not preceded by '!', '?', ':' (this, new), or '.' (object property). | 92 # Basic regex for invalid JsDoc types: an object type name ([A-Z][A-Za-z0-9.]+[A -Za-z0-9]) not preceded by '!', '?', ':' (this, new), or '.' (object property). |
| 93 invalid_type_regex = re.compile(r"@(?:" + type_checked_jsdoc_tags_or + r")\s*\{. *(?<![!?:.A-Za-z0-9])([A-Z][A-Za-z0-9.]+[A-Za-z0-9])[^/]*\}") | 93 invalid_type_regex = re.compile(r"@(?:" + type_checked_jsdoc_tags_or + r")\s*\{. *(?<![!?:.A-Za-z0-9])([A-Z][A-Za-z0-9.]+[A-Za-z0-9])[^/]*\}") |
| 94 | 94 |
| 95 invalid_type_designator_regex = re.compile(r"@(?:" + type_checked_jsdoc_tags_or + r")\s*.*([?!])=?\}") | 95 invalid_type_designator_regex = re.compile(r"@(?:" + type_checked_jsdoc_tags_or + r")\s*.*(?<![{: ])([?!])=?\}") |
|
aandrey
2014/06/17 11:33:54
hard to review
| |
| 96 | 96 |
| 97 importscript_regex = re.compile(r"importScript\(\s*[\"']") | 97 importscript_regex = re.compile(r"importScript\(\s*[\"']") |
| 98 error_warning_regex = re.compile(r"(?:WARNING|ERROR)") | 98 error_warning_regex = re.compile(r"(?:WARNING|ERROR)") |
| 99 | 99 |
| 100 errors_found = False | 100 errors_found = False |
| 101 | 101 |
| 102 | 102 |
| 103 def hasErrors(output): | 103 def hasErrors(output): |
| 104 return re.search(error_warning_regex, output) != None | 104 return re.search(error_warning_regex, output) != None |
| 105 | 105 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 errors_found |= hasErrors(validateInjectedScriptOut) | 393 errors_found |= hasErrors(validateInjectedScriptOut) |
| 394 | 394 |
| 395 if errors_found: | 395 if errors_found: |
| 396 print "ERRORS DETECTED" | 396 print "ERRORS DETECTED" |
| 397 | 397 |
| 398 os.remove(injectedScriptSourceTmpFile) | 398 os.remove(injectedScriptSourceTmpFile) |
| 399 os.remove(injectedScriptCanvasModuleSourceTmpFile) | 399 os.remove(injectedScriptCanvasModuleSourceTmpFile) |
| 400 os.remove(compiler_args_file.name) | 400 os.remove(compiler_args_file.name) |
| 401 os.remove(protocol_externs_file) | 401 os.remove(protocol_externs_file) |
| 402 shutil.rmtree(modules_dir, True) | 402 shutil.rmtree(modules_dir, True) |
| OLD | NEW |