Skip to content

Add a verify mode to xcprojformatter - #30

Open
zachshallbetter wants to merge 1 commit into
apple:mainfrom
zachshallbetter:feat/xcprojformatter-verify
Open

zachshallbetter wants to merge 1 commit into
apple:mainfrom
zachshallbetter:feat/xcprojformatter-verify

Conversation

@zachshallbetter

@zachshallbetter zachshallbetter commented Nov 24, 2026 •

Copy link
Copy Markdown

Type of change

  • xcprojformatter (CLI) change
  • Documentation update
  • Test addition

Summary

Adds a --verify mode to xcprojformatter for CI checks. It formats the input in memory and compares the result byte for byte with the original input, exiting 0 on an exact match and 1 if formatting would change anything, with empty stdout and without modifying the input file.

Per the discussion on #20, this starts with just exit codes rather than diff output.

Related issue

Fixes #20

Changes

  • Sources/Tool/Arguments.swift: Added --verify and rejected combining it with --output or --update.
  • Sources/Tool/main.swift: Added the --verify path using existing input handling (--input, positional path, .xcodeproj, project.xcproj, and stdin) and byte-for-byte comparison.
  • Sources/Tool/Help.swift: Documented --verify in --help.
  • Sources/Tests/VerifyCommandTests.swift: Added --verify tests covering canonical input, trailing-newline mismatch, malformed/missing input, and conflicting output flags.

Testing

  • Existing tests pass (swift test)
  • New tests added for new functionality
  • Tested manually: Ran swift test (36 tests passing), swift build -c release, and verified --help and 0/1 exit codes on the built xcprojformatter binary.

Checklist

  • I have read CONTRIBUTING.md
  • My change is in scope (see CONTRIBUTING.md)
  • Code follows the project's style guidelines
  • I have reviewed my own code and can explain all changes in detail
  • Documentation updated where applicable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add "verify" option to xcprojformatter

1 participant