MCPcopy Create free account
hub / github.com/nodejs/node / JSLintWorker

Function JSLintWorker

deps/v8/tools/v8_presubmit.py:159–191  ·  view source on GitHub ↗
(command)

Source from the content-addressed store, hash-verified

157 process.kill()
158
159def JSLintWorker(command):
160 def format_file(command):
161 try:
162 file_name = command[-1]
163 with open(file_name, "r") as file_handle:
164 contents = file_handle.read()
165
166 process = subprocess.Popen(command, stdout=PIPE, stderr=subprocess.PIPE)
167 output, err = process.communicate()
168 rc = process.returncode
169 if rc != 0:
170 sys.stdout.write("error code " + str(rc) + " running clang-format.\n")
171 return rc
172
173 if decode(output) != contents:
174 return 1
175
176 return 0
177 except KeyboardInterrupt:
178 process.kill()
179 except Exception:
180 print(
181 'Error running clang-format. Please make sure you have depot_tools' +
182 ' in your third_party directory. Lint check skipped.')
183 process.kill()
184
185 rc = format_file(command)
186 if rc == 1:
187 # There are files that need to be formatted, let's format them in place.
188 file_name = command[-1]
189 sys.stdout.write("Formatting %s.\n" % (file_name))
190 rc = format_file(command[:-1] + ["-i", file_name])
191 return rc
192
193class FileContentsCache(object):
194

Callers

nothing calls this directly

Calls 2

format_fileFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected