MCPcopy Index your code
hub / github.com/extrabacon/python-shell / checkSyntax

Method checkSyntax

index.ts:287–295  ·  view source on GitHub ↗

* checks syntax without executing code * @returns rejects promise w/ string error output if syntax failure

(code: string)

Source from the content-addressed store, hash-verified

285 * @returns rejects promise w/ string error output if syntax failure
286 */
287 static async checkSyntax(code: string) {
288 const randomInt = getRandomInt();
289 const filePath = tmpdir() + sep + `pythonShellSyntaxCheck${randomInt}.py`
290
291 const writeFilePromise = promisify(writeFile)
292 return writeFilePromise(filePath, code).then(() => {
293 return this.checkSyntaxFile(filePath)
294 })
295 }
296
297 static getPythonPath() {
298 return this.defaultOptions.pythonPath ? this.defaultOptions.pythonPath : this.defaultPythonPath;

Callers 1

Calls 2

checkSyntaxFileMethod · 0.95
getRandomIntFunction · 0.85

Tested by

no test coverage detected