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

Đang mở
#9,243 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@cknitt đang làm issue này rồi.

Từ ngày 6/11/2026.

  • #9249 của @cknitt — đang mở

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
56/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
ocaml
Lĩnh vực
cli, tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
OCaml
Star
7.5k
Fork
485
Merge trung bình
16 giờ 51 phút
Pull request đã merge (30 ngày)
268

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rescript-lang/rescript

Tất cả issue của rescript-lang/rescript

Issue tương tự

Thêm issue về CLI

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.