* checks syntax without executing code * @returns rejects promise w/ string error output if syntax failure
(code: string)
| 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; |
no test coverage detected