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

Open Beginner friendly
#27 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
swift
Domain
cli

Research direction

The reproducible case is the xcprojformatter --update command; start in the tool's main entry point under Sources/ where the decode error is caught and where the usage/help block is printed, and see whether the help is emitted by a shared error-handling path. Run the reproduction (delete the "name": "Main" line, then re-run --update) to confirm. Done means only Missing required value for key "name" at "/targets[0]" prints, with the help text suppressed on decode failure but still available via explicit invocation.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Swift
Stars
544
Forks
36
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apple/xcode-project-format

All issues in apple/xcode-project-format

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.