Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/inspector/PRESUBMIT.py

Issue 2354263003: [inspector] add presubmit.py to compile inspector-related scripts (Closed)
Patch Set: addressed comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2016 the V8 project authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """v8_inspect presubmit script
8
9 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
10 for more details about the presubmit API built into gcl.
11 """
12
13 compile_note = "Be sure to run your patch by the compile-scripts.py script prior to committing!"
14
15
16 def _CompileScripts(input_api, output_api):
17 local_paths = [f.LocalPath() for f in input_api.AffectedFiles()]
Michael Achenbach 2016/09/28 09:54:04 nit: two space indents.
kozy 2016/09/28 23:38:46 Done.
18 if (any("js_protocol.json" in path for path in local_paths) or
Michael Achenbach 2016/09/28 09:54:04 nit: too much indentation.
kozy 2016/09/28 23:38:46 Done.
19 any("compile-scripts.py" in path for path in local_paths) or
20 any("injected-script-source.js" in path for path in local_paths) or
21 any("debugger_script_externs.js" in path for path in local_paths) or
22 any("injected_script_externs.js" in path for path in local_paths) or
23 any("check_injected_script_source.js" in path for path in local_path s) or
24 any("debugger-script.js" in path for path in local_paths)):
Michael Achenbach 2016/09/28 09:54:04 Can you maybe rewrite this with less duplication?
kozy 2016/09/28 23:38:46 Done.
25 lint_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
Michael Achenbach 2016/09/28 09:54:04 nit: Is lint an appropriate name in this context?
kozy 2016/09/28 23:38:46 Done.
26 "build", "compile-scripts.py")
27 out, _ = input_api.subprocess.Popen(
28 [input_api.python_executable, lint_path],
29 stdout=input_api.subprocess.PIPE,
30 stderr=input_api.subprocess.STDOUT).communicate()
31 if "ERROR" in out or "WARNING" in out:
Michael Achenbach 2016/09/28 09:54:04 How about also checking the return code of the pro
kozy 2016/09/28 23:38:46 Done.
32 return [output_api.PresubmitError(out)]
33 if "NOTE" in out:
34 return [output_api.PresubmitPromptWarning(out + compile_note)]
35 return []
36
37
38 def CheckChangeOnUpload(input_api, output_api):
39 results = []
40 results.extend(_CompileScripts(input_api, output_api))
41 return results
42
43
44 def CheckChangeOnCommit(input_api, output_api):
45 results = []
Michael Achenbach 2016/09/28 09:54:05 Why not on commit? We'd like the CQ to actually en
dgozman 2016/09/28 13:50:32 AFAIU, commit hooks are run on bots, which require
Michael Achenbach 2016/09/28 14:27:27 Just checked a random bot that runs our presubmit
kozy 2016/09/28 23:38:46 Added for commit.
46 return results
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698