Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/scripts/lint_javascript.py |
| diff --git a/third_party/WebKit/Source/devtools/scripts/lint_javascript.py b/third_party/WebKit/Source/devtools/scripts/lint_javascript.py |
| index 9b8e77eb1eaddf8fd1a51201ee293e2e2e7ac49b..63cf98e34ed369f4edd7c453cfe98f9fcb3ad1e3 100755 |
| --- a/third_party/WebKit/Source/devtools/scripts/lint_javascript.py |
| +++ b/third_party/WebKit/Source/devtools/scripts/lint_javascript.py |
| @@ -4,7 +4,6 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| -import os |
| import os.path as path |
| import re |
| import subprocess |
| @@ -48,37 +47,17 @@ def to_platform_path_exact(filepath): |
| scripts_path = path.dirname(path.abspath(__file__)) |
| devtools_path = path.dirname(scripts_path) |
| devtools_frontend_path = path.join(devtools_path, "front_end") |
| - |
| - |
| -# Based on http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python. |
| -def which(program): |
| - def is_exe(fpath): |
| - return path.isfile(fpath) and os.access(fpath, os.X_OK) |
| - |
| - fpath, fname = path.split(program) |
| - if fpath: |
| - if is_exe(program): |
| - return program |
| - else: |
| - for part in os.environ["PATH"].split(os.pathsep): |
| - part = part.strip("\"") |
| - exe_file = path.join(part, program) |
| - if is_exe(exe_file): |
| - return exe_file |
| - return None |
| - |
| +eslint_path = path.join(devtools_path, "node_modules", ".bin", "eslint") |
| print("Linting JavaScript with eslint...\n") |
| def js_lint(files_list=None): |
| eslint_errors_found = False |
| - |
| - eslint_path = which("eslint") |
| - if not eslint_path: |
| - print("!! NOTE: Skipping JavaScript linting because eslint is not installed.") |
| - print("!! npm install -g eslint") |
| - eslint_errors_found = False # Linting is opt-in for now, so this is a soft failure |
| + if not path.isfile(eslint_path): |
| + print("!! NOTE: Javascript linting is mandatory") |
|
dgozman
2016/09/14 16:37:41
Replace this with "Failed to run eslint, run ./scr
chenwilliam
2016/09/15 00:40:11
Done.
|
| + print("!! Run ./scripts/node.py to install eslint") |
| + eslint_errors_found = True |
| return eslint_errors_found |
| if files_list is None: |