Skip to content

Report every file in rescript format, in order, with short argument errors - #9249

Open
cknitt wants to merge 2 commits into
rewatch-cli-fixesfrom
rewatch-format-fixes
Open

cknitt wants to merge 2 commits into
rewatch-cli-fixesfrom
rewatch-format-fixes

Conversation

@cknitt

@cknitt cknitt commented Nov 6, 2026

Copy link
Copy Markdown
Member

Fixes #9243. Stacked on the CLI fixes.

  • A syntax error no longer aborts rescript format: every file is formatted or checked, and the errors are reported at the end before the run fails.
  • --check output: listed in path order, relative to the current directory, and each file once, so duplicate arguments count once.
  • Explicit arguments are checked before formatting:
    • src/Missing.res: No such file
    • src is a directory; give .res or .resi files, or no arguments to format the project
    • README.md is not a .res or .resi file
  • --stdin errors name <stdin> instead of the temporary file.

New tests:

  • check_command_validation.sh: a project with four unformatted files and one syntax error must list all four in order, report the error, and fail;
  • check_command_validation.sh: a duplicated argument is counted once;
  • format_tests: a syntax error still lets the other files be formatted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gGBR9g3DD93vrWbYzU

@cknitt
cknitt added this pull request to stack #9251 November 6, 2026 21:14
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Changelog

🐛 Bug fix

  • rescript format formats or checks every file even when one has a syntax error, then fails; it reports files once each, sorted and relative to the current directory, rejects missing files, directories and non-ReScript files with a short message, and reports --stdin errors at <stdin>.

Semantic Diff

2 commits · Full page

Report every file in rescript format, in order, with short argument errors

eaae598 · cknitt + Claude · Nov 06, 2026, 20:54 UTC

Why

One file with a syntax error stopped rescript format, leaving other files unformatted; --check listed files in completion order with absolute paths, duplicate arguments counted twice, and invalid arguments surfaced raw compiler errors (#9243).

Behavior modified (rescript format)

representation

-a syntax error in one file         ↦ the run stops; some other files stay unformatted
-format --check                     ↦ files in completion order, absolute in project mode
-format --check src/F.res src/F.res ↦ The 2 files listed above need formatting
-format src/Missing.res             ↦ We've found a bug for you! … I/O error: …: No such file or directory
-format src                         ↦ Error formatting src: don't know what to do with src
-format --stdin with a syntax error ↦ /tmp/rescript-format-7546c4.res:1:8-2:0
+a syntax error in one file         ↦ every other file is formatted; the errors are reported, then the run fails
+format --check                     ↦ files sorted, relative to the current directory
+format --check src/F.res src/F.res ↦ The file listed above needs formatting
+format src/Missing.res             ↦ src/Missing.res: No such file
+format src                         ↦ src is a directory; give .res or .resi files, or no arguments to format the project
+format --stdin with a syntax error ↦ <stdin>:1:8-2:0
✨ Compare the format listing with forward slashes on Windows

82407f8 · cknitt + Claude · Nov 06, 2026, 21:29 UTC · new

Windows prints the relative paths with backslashes, which the new format-continues-after-syntax-error check compared literally.

@cknitt

cknitt commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T22:21:23.655985Z 82407f8 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 430a3dace9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

cknitt and others added 2 commits November 6, 2026 21:30
…rrors

Why:
    One file with a syntax error stopped rescript format, leaving other files
    unformatted; --check listed files in completion order with absolute
    paths, duplicate arguments counted twice, and invalid arguments surfaced
    raw compiler errors (#9243).

Behavior modified (rescript format):
Before (representation):
    a syntax error in one file ↦ the run stops; some other files stay unformatted
    format --check ↦ files in completion order, absolute in project mode
    format --check src/F.res src/F.res ↦ The 2 files listed above need formatting
    format src/Missing.res ↦ We've found a bug for you! … I/O error: …: No such file or directory
    format src ↦ Error formatting src: don't know what to do with src
    format --stdin with a syntax error ↦ /tmp/rescript-format-7546c4.res:1:8-2:0
After (representation):
    a syntax error in one file ↦ every other file is formatted; the errors are reported, then the run fails
    format --check ↦ files sorted, relative to the current directory
    format --check src/F.res src/F.res ↦ The file listed above needs formatting
    format src/Missing.res ↦ src/Missing.res: No such file
    format src ↦ src is a directory; give .res or .resi files, or no arguments to format the project
    format --stdin with a syntax error ↦ <stdin>:1:8-2:0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGBR9g3DD93vrWbYzU
Signed-off-by: Christoph Knittel <ck@cca.io>
Windows prints the relative paths with backslashes, which the new
format-continues-after-syntax-error check compared literally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gGBR9g3DD93vrWbYzU
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt force-pushed the rewatch-format-fixes branch from 430a3da to 82407f8 Compare November 6, 2026 21:31
@pkg-pr-new

pkg-pr-new Bot commented Nov 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@9249

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@9249

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@9249

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@9249

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@9249

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@9249

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@9249

commit: 82407f8

@cknitt

cknitt commented Nov 6, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 82407f838c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cknitt
cknitt marked this pull request as ready for review November 7, 2026 06:11
@cknitt
cknitt requested a review from cristianoc November 7, 2026 06:11

This branch has not been deployed

No deployments
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.

rescript format: aborts on a syntax error, unstable output, raw compiler errors

1 participant