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

Ouverte
#9,243 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@cknitt y travaille déjà.

Depuis le 6/11/2026.

  • #9249 par @cknitt — ouverte

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
56/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
ocaml
Domaine
cli, tooling

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
OCaml
Étoiles
7.5k
Forks
485
Merge moyen
16 h 51 min
PR mergées (30 j)
268

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de rescript-lang/rescript

Toutes les issues de rescript-lang/rescript

Issues similaires

Plus d'issues CLI

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.