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

Aperta
#9,243 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@cknitt ci sta già lavorando.

Dal 6/11/2026.

  • #9249 di @cknitt — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
56/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
ocaml
Ambito
cli, tooling

Direzione di ricerca

Start in rewatch-ocaml/format.ml, especially the referenced lines 113, 116, 142–143, 148, 200, and 209; reproduce the listed cases with ReScript 13.0.0-alpha.8. Check formatting behavior for syntax errors, output ordering and paths, duplicate arguments, invalid inputs, and --stdin errors. Done means each case reports all files and useful errors consistently, with deterministic unique paths and <stdin> shown for stdin errors.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problems with rescript format. All reproduce with rescript 13.0.0-alpha.8 (found while reviewing #9238); paths are in rewatch-ocaml/.

  • One file with a syntax error aborts the run. In a project with unformatted files and one file containing let x =, rescript format --check lists some files, then Error formatting <path>/B.res: with the syntax error, exit 1, and no summary. Without --check, some of the other files are left unformatted (with 40 unformatted files, 26–33 remained, varying per run). format.ml:142-143 raises inside the job callback, which stops the whole job graph. Format and report every file, then fail.

  • --check output order is nondeterministic, and paths are inconsistent. With 8 unformatted files, six runs of rescript format --check listed them in six different orders: each line is printed when its job finishes (format.ml:148). In project mode the paths are absolute; for explicit file arguments they are relative (format.ml:113, :209). Sort the list and print paths relative to the current directory.

  • Duplicate arguments are counted twice. rescript format --check src/F.res src/F.res lists the file twice and reports The 2 files listed above need formatting (format.ml:209).

  • Invalid arguments surface raw compiler errors.

    • rescript format src/Missing.res: Error formatting src/Missing.res: (trailing space), then We've found a bug for you!, _none_, I/O error: …: No such file or directory.
    • rescript format src and rescript format README.md: Error formatting src: don't know what to do with src.

    Nothing checks existence or extension before calling the compiler; format.ml:116 prefixes the compiler's stderr, which starts with a newline.

  • --stdin errors name a temporary file. echo 'let x =' | rescript format --stdin .res reports the syntax error at /tmp/rescript-format-7546c4.res:1:8-2:0 (format.ml:200); it should say <stdin>.

Lingua principale
OCaml
Stelle
7.5k
Fork
485
Merge medio
16h 51m
PR unite (30g)
268

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rescript-lang/rescript

Tutte le issue di rescript-lang/rescript

Issue simili

Altre issue su CLI

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.