Repository navigation
Patch release fixing how fix handles comments and line layout when members move, and a hang when the CLI runs from a deleted directory.
What's changed
Comments stay with their members (#12)
- When the first member of a type moved,
fixtreated its leading comments as belonging to the position instead of the member. Comments could be lost, attached to the wrong member, or moved onto another member. This affected//comments,// MARK:sections and///doc comments fixno longer inserts a blank line right after the opening{when the first member changescheckwas not affected; onlyfixrewrote trivia
Line layout when reordering
- Files with CRLF or CR line endings now get a blank line between moved members, as LF files already did
- A whitespace-only line before a comment no longer ends up right after the opening
{ - A member declared on the same line as the opening
{now moves onto its own line, indented like the other members
Members sharing a line
- Reordering members declared on the same line no longer produces code that does not compile.
struct Foo { func a() {}; init() {} }is now rewritten tostruct Foo { init() {}; func a() {}; }, with a;added where Swift requires one
Running from a deleted directory
checkandfixno longer hang when the current directory has been deleted, for example after switching branches or removing the directory from another terminal. The configuration search now always terminates, and the default configuration is usedinitfails with a clear error instead of trying to write/.swift-marshal.yaml
Tests and tooling
- Rewriter tests assert the exact output, so they check which member each comment is attached to; snapshots re-recorded
- Tests no longer change the process-wide working directory, which removed a race with integration tests running in parallel
- Improved mutation test coverage and SonarCloud configuration
- Added
BUILDING.mdwith instructions to build, test, and run the project locally
Types that
fixalready rewrote with v1.1.0 keep the blank line it added after{. Members that do not move are never changed, so remove that line manually if you want.
Requirements
- macOS 15+
- Swift 6.2+
Installation
See the Installation Guide for Homebrew, pre-built binary, build from source, SPM plugin, and pre-commit hook setup.
What's Changed
- Update documentation by @ericodx in #6
- Update SonarCloud config file by @ericodx in #7
- test: improve mutation test coverage by @ericodx in #8
- Update sonar configuration by @ericodx in #9
- docs: add BUILDING.md by @ericodx in #11
- fix: keep comments attached to members when reordering by @ericodx in #13
Full Changelog: v1.1.0...v1.1.1