[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 摘要。