Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/PRESUBMIT.py |
| diff --git a/third_party/WebKit/Source/devtools/PRESUBMIT.py b/third_party/WebKit/Source/devtools/PRESUBMIT.py |
| index d2fe54158e9f50cb7ae6ca0165393bea07b6aa2c..ea15090061c0dcd4683fee703d24e92f46cedef6 100644 |
| --- a/third_party/WebKit/Source/devtools/PRESUBMIT.py |
| +++ b/third_party/WebKit/Source/devtools/PRESUBMIT.py |
| @@ -36,6 +36,27 @@ import sys |
| compile_note = "Be sure to run your patch by the compile_frontend.py script prior to committing!" |
| + |
| +def _CheckDevtoolsStyle(input_api, output_api): |
| + local_paths = [f.LocalPath() for f in input_api.AffectedFiles() if f.Action() != "D"] |
| + |
| + devtools_front_end = input_api.os_path.join("devtools", "front_end") |
| + affected_front_end_files = [file_name for file_name in local_paths if devtools_front_end in file_name and file_name.endswith(".js")] |
| + affected_front_end_files = [input_api.os_path.join("front_end", file_name.split(devtools_front_end).pop()[1:]) for file_name in affected_front_end_files] |
| + if len(affected_front_end_files) > 0: |
| + lint_path = input_api.os_path.join(input_api.PresubmitLocalPath(), |
| + "scripts", "lint_javascript.py") |
| + out, _ = input_api.subprocess.Popen( |
| + [input_api.python_executable, lint_path] + affected_front_end_files, |
| + stdout=input_api.subprocess.PIPE, |
| + stderr=input_api.subprocess.STDOUT).communicate() |
| + if "error" in out or "warning" in out: |
|
paulirish
2016/05/20 20:26:22
You should use the exit code instead.
Generally,
lushnikov
2016/05/20 20:54:56
Done.
|
| + return [output_api.PresubmitError(out)] |
| + if "NOTE" in out: |
| + return [output_api.PresubmitPromptWarning(out)] |
| + return [] |
| + |
| + |
| def _CompileDevtoolsFrontend(input_api, output_api): |
| local_paths = [f.LocalPath() for f in input_api.AffectedFiles()] |
| @@ -129,6 +150,7 @@ def _CheckCSSViolations(input_api, output_api): |
| def CheckChangeOnUpload(input_api, output_api): |
| results = [] |
| + results.extend(_CheckDevtoolsStyle(input_api, output_api)) |
| results.extend(_CompileDevtoolsFrontend(input_api, output_api)) |
| results.extend(_CheckConvertSVGToPNGHashes(input_api, output_api)) |
| results.extend(_CheckOptimizePNGHashes(input_api, output_api)) |