Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

bug: CLI readAll stops reading at first empty line instead of reading to EOF

未关闭 适合新手
#22 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
领域
cli

调研方向

先从 cli/LckJsonFmt.lean 和 cli/LckJsonTree.lean 中的 readAll helpers 开始,然后检查每个 CLI 如何读取 stdin。使用包含空行的输入验证其行为,并确认读取会继续跨过空行,且仅在 EOF 时结束,不会截断 JSON。

由索引模型根据 Issue 内容生成。

描述

Problem

Both cli/LckJsonFmt.lean and cli/LckJsonTree.lean define a readAll helper that reads stdin line-by-line, stopping as soon as it reads an empty line:

repeat
  let line ← stdin.getLine
  if line.isEmpty then break   -- WRONG: also breaks on blank lines mid-input
  buf := buf ++ line

This means any JSON that contains a blank line (e.g., pretty-printed JSON piped from another tool, or JSON with embedded newlines before/after values) will be silently truncated.

Expected fix

Read until EOF. IO.Stream.getLine returns "" on EOF — use IO.Stream.isEof or check for EOF after each read instead of treating an empty line as the terminator. Example:

repeat
  let line ← stdin.getLine
  if (← stdin.isEof) then break
  buf := buf ++ line

References

  • Flagged by AI code review on PR #8
主要语言
Lean
星标
2
派生
1
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

lambdaclass/lambda_compiler_kit 的其他 Issue

查看 lambdaclass/lambda_compiler_kit 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。