Skip to content

v1.1.1 — Comment preservation and reliability fixes

Latest

Choose a tag to compare

@ericodx ericodx released this 13 Oct 17:45
40cc210

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, fix treated 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
  • fix no longer inserts a blank line right after the opening { when the first member changes
  • check was not affected; only fix rewrote 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 to struct Foo { init() {}; func a() {}; }, with a ; added where Swift requires one

Running from a deleted directory

  • check and fix no 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 used
  • init fails 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.md with instructions to build, test, and run the project locally

Types that fix already 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

Full Changelog: v1.1.0...v1.1.1