[Bug]: xcprojformatter prints redundant/non-helpful information after a decode failure

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

还没有人认领这个 Issue。

评估

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

调研方向

可复现的情况是 xcprojformatter --update 命令;从 Sources/ 下该工具的主入口开始,这里是捕获 decode 错误的位置,也是打印 usage/help 块的位置,并查看 help 是否由共享的错误处理路径输出。运行复现(删除 "name": "Main" 行,然后重新运行 --update)以确认。完成意味着只打印 Missing required value for key "name" at "/targets[0]",在 decode 失败时抑制 help 文本,但仍可通过显式调用获得。

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

描述

bug
Describe the bug

The help text doesn't help you fix the problem that the project wasn't able to be decoded, so it shouldn't print. Only Missing required value for key “name” at “/targets[0]” should print.

Steps to reproduce
$ xcrun xcodeproj init template.xcodeproj
$ xcrun xcodeproj target add Main --product-type application
...
$ xcrun xcprojformatter --update template.xcodeproj
# add a structural issue
$ sed -i '' '/^ *"name": "Main",$/d' /tmp/xc2/template.xcodeproj/project.xcproj
$ xcrun xcprojformatter --update template.xcodeproj
Missing required value for key “name” at “/targets[0]”

----------------------------

The xcprojformatter tool pretty prints 'project.xcproj' Xcode project files in their canonical format. 

Usage:

    xcprojformatter [[--input] input-project] [--output output-project]
...
Expected behavior

No help text.

主要语言
Swift
星标
544
派生
36
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

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

apple/xcode-project-format 的其他 Issue

查看 apple/xcode-project-format 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 发到你的邮箱

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