| name | fmt |
| description | Format Swift code with swift-format and report what changed. |
/fmt
Runs swift format on Sources/ and Tests/ directories.
Steps
1. Run swift-format.
swift format --recursive Sources Tests --in-place
2. Check for changes.
git diff --stat
3. Report.
- If no diff → "All Swift source files are already formatted."
- If files were changed → list them with the number of lines modified and re-stage:
git add -u Sources Tests
Notes
- Operates on
Sources/ and Tests/ directories by convention. If your project uses different source directories (e.g. Package/, App/), adjust the paths.
- Uses
swift format which is built into the Swift 6+ toolchain and wraps swift-format.
- To check without modifying:
swift format --recursive Sources Tests (omit --in-place).