Skip to content

feat(checkSyntax): create checkSyntaxStdin#318

Open
nurazon59 wants to merge 1 commit into
extrabacon:masterfrom
nurazon59:nurazon59/feat/check-syntax-stdin
Open

feat(checkSyntax): create checkSyntaxStdin#318
nurazon59 wants to merge 1 commit into
extrabacon:masterfrom
nurazon59:nurazon59/feat/check-syntax-stdin

Conversation

@nurazon59
Copy link
Copy Markdown
Contributor

@nurazon59 nurazon59 commented Dec 9, 2025

resolve #295

@nurazon59 nurazon59 marked this pull request as draft December 9, 2025 13:35
@nurazon59 nurazon59 marked this pull request as ready for review December 15, 2025 04:36
Copy link
Copy Markdown

@StantonMatt StantonMatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this against #295 locally.

Validation passed:

  • npm run compileOnce
  • npx mocha -r ts-node/register test/test-python-shell.ts --grep "checkSyntaxStdin"
  • npm test
  • npx prettier --check index.ts test/test-python-shell.ts
  • git diff --check origin/master...HEAD

No upstream checks are reported on this PR branch.

The behavior looks useful: the stdin path avoids creating pythonShellSyntaxCheck*.py temp files and the tests cover valid/invalid single-line and multiline syntax.

One thing I would tighten before merge: the test named should use pythonOptions from defaultOptions does not currently prove or implement that behavior. checkSyntaxStdin() builds the spawned argv as ["-c", "import sys; compile(...)"] and does not include defaultOptions.pythonOptions. I confirmed that with PythonShell.defaultOptions = { pythonOptions: ["--definitely-not-a-python-option"] }; checkSyntaxStdin("x=1") still passes because the option is ignored.

If option support is intended for this helper, it should include defaultOptions.pythonOptions in the spawned argv and test with a sentinel option that would fail if ignored. If not, I would rename or remove that test so the new API expectation stays clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

checkSyntax function that doesn't write to a file

2 participants