| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2016 The Chromium Authors. All rights reserved. | 3 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import os.path as path | 7 import os.path as path |
| 8 import re | 8 import re |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 eslint_errors_found = False | 58 eslint_errors_found = False |
| 59 if not path.isfile(eslint_path): | 59 if not path.isfile(eslint_path): |
| 60 print("Failed to run eslint, run ./scripts/install_node_deps.py to insta
ll eslint") | 60 print("Failed to run eslint, run ./scripts/install_node_deps.py to insta
ll eslint") |
| 61 eslint_errors_found = True | 61 eslint_errors_found = True |
| 62 return eslint_errors_found | 62 return eslint_errors_found |
| 63 | 63 |
| 64 if files_list is None: | 64 if files_list is None: |
| 65 files_list = [devtools_frontend_path] | 65 files_list = [devtools_frontend_path] |
| 66 files_list = [file_name for file_name in files_list if not file_name.endswit
h(".eslintrc.js")] | 66 files_list = [file_name for file_name in files_list if not file_name.endswit
h(".eslintrc.js")] |
| 67 | 67 |
| 68 eslintconfig_path = path.join(devtools_path, "front_end/.eslintrc.js") | 68 eslintconfig_path = path.join(devtools_path, ".eslintrc.js") |
| 69 eslintignore_path = path.join(devtools_path, "front_end/.eslintignore") | 69 eslintignore_path = path.join(devtools_path, ".eslintignore") |
| 70 (node_path, _) = install_node_deps.resolve_node_paths() | 70 (node_path, _) = install_node_deps.resolve_node_paths() |
| 71 exec_command = [ | 71 exec_command = [ |
| 72 node_path, | 72 node_path, |
| 73 eslint_path, | 73 eslint_path, |
| 74 "--config", to_platform_path_exact(eslintconfig_path), | 74 "--config", to_platform_path_exact(eslintconfig_path), |
| 75 "--ignore-path", to_platform_path_exact(eslintignore_path), | 75 "--ignore-path", to_platform_path_exact(eslintignore_path), |
| 76 ] + files_list | 76 ] + files_list |
| 77 | 77 |
| 78 eslint_proc = popen(exec_command) | 78 eslint_proc = popen(exec_command) |
| 79 (eslint_proc_out, _) = eslint_proc.communicate() | 79 (eslint_proc_out, _) = eslint_proc.communicate() |
| 80 if eslint_proc.returncode != 0: | 80 if eslint_proc.returncode != 0: |
| 81 eslint_errors_found = True | 81 eslint_errors_found = True |
| 82 else: | 82 else: |
| 83 print("eslint exited successfully") | 83 print("eslint exited successfully") |
| 84 | 84 |
| 85 print(eslint_proc_out) | 85 print(eslint_proc_out) |
| 86 return eslint_errors_found | 86 return eslint_errors_found |
| 87 | 87 |
| 88 | 88 |
| 89 errors_found = js_lint(files_to_lint) | 89 errors_found = js_lint(files_to_lint) |
| 90 | 90 |
| 91 if errors_found: | 91 if errors_found: |
| 92 print("ERRORS DETECTED") | 92 print("ERRORS DETECTED") |
| 93 sys.exit(1) | 93 sys.exit(1) |
| OLD | NEW |