Skip to content

Releases: nicklockwood/SwiftFormat

0.60.1

07 Mar 16:40

Choose a tag to compare

  • Fixed issue where redundantSendable rule would unexpectedly remove Sendable conformance on type defined in public extension
  • Fixed issue where redundantSendable rule would leave behind extra space when removing :
  • Renamed redundantProperty rule to redundantVariable
  • Updated redundantVariable rule to preserve variables with explicit type annotations
  • Updated enumNamespaces rule to preserve Swift Testing suites as structs

0.60.0

03 Mar 16:10

Choose a tag to compare

  • Added redundantSwiftTestingSuite rule
  • Added redundantSendable rule
  • Added preferExpicitFalse rule
  • Added support for :: module selector syntax
  • Added support for value generics syntax
  • Updated swiftTestingTestCaseNames to use raw identifiers by default
  • Updated swiftTestingTestCaseNames to use UpperCamelCase for test suite names
  • Updated redundantSelf to handle guard statements
  • Updated unusedArguments to handle for loop variables
  • Updated redundantType to better handle Set literals
  • Updated redundantParents to remove empty parens from attributes
  • Updated sortImports to sort imports by access control
  • Updated blankLinesBetweenImports to preserve indentation when indent disabled
  • Updated unusedPrivateDeclaration rule to preserve private @Test functions
  • Updated preferSwiftTesting rule to convert tests in extensions within the same file
  • Updated --stdin-path to not require the file to actually exist
  • Updated simplifyGenericConstraints to avoid adding duplicate constraints
  • Updated blankLinesAroundMark to insert blank line before MARK at start of scope when allowed by blankLinesAtStartOfScope config
  • Updated redundantEquatable to preserve == implementation in types with Strideable conformance
  • Fixed handling of switch statements with #if blocks in several rules
  • Fixed issue where async function declarations were wrapped using wrapArguments instead of wrapParameters
  • Fixed issue where redudantViewBuilder would remove @ViewBuilder from protocol members
  • Fixed redundantSelf parsing issue with throwing closure return types and switch expressions in if let condition
  • Fixed trailingCommas rule incorrectly adding commas to if #available checks
  • Fixed guard...else indentation in wrapArguments with wrap-conditions
  • Fixed issue where simplifyGenericConstraints would leave dangling where keyword in protocol members
  • Fixed issue where trailingCommas didn't handle closure capture lists with macro expressions
  • Fixed indentation for closure parameters on separate lines
  • Fixed issue where .init would be removed in code like [Foo].init { ... } (not supported until Swift 6.4).
  • Fixed issue where .swift-version files were read from excluded directories
  • Fixed incorrect replacement of && operator with , inside a ternary condition
  • Fixed unusedArguments bug in code with try? await
  • Fixed handling of MainActor attributes in redundantViewBuilder

0.59.1

30 Jan 03:56

Choose a tag to compare

  • Reverted changes to indent rule --ifdef handling from 0.59.0
  • Updated docComments rule to use doc comments on nested functions and handle conditional compilation blocks in function bodies
  • Updated spaceAroundBrackets to preserve space between global actor attribute and closure capture list
  • Updated redundantMemberwiseInit to preserve inits with attributes
  • Fixed handling of any keyword in sortTypealiases rule
  • Resolved build issue related to macOS 13 SDK availability

0.59.0

25 Jan 17:03

Choose a tag to compare

  • Added simplifyGenericConstraints rule
  • Added validateTestCases rule
  • Added testSuiteAccessControl rule
  • Added wrapPropertyBodies rule
  • Added wrapFunctionBodies rule
  • Added redundantViewBuilder rule
  • Added --ifdef preserve option to indent rule
  • Added --prefer-synthesized-init-for-internal-structs option to redundantMemberwiseInit rule
  • Enabled more rules by default: blankLinesBetweenImports, docComments, emptyExtensions, environmentEntry, noForceTryInTests, noForceUnwrapInTests, redundantAsync, redundantEquatable, redundantMemberwiseInit, redundantProperty, redundantThrows
  • Updated typeSugar to only preserve explicit Optional<T> in structs with a synthesized memberwise initializer
  • Updated closing paren of single-argument functions and collections to wrap if needed
  • Updated redundantMemberwiseInit rule to support result builder attributes
  • Improved how organizeDeclarations handles structs with a synthesized memberwise initializer
  • Updated docComments rule to preserve formatting of comments with directives
  • Fixed --ifdef no-indent handling of method chains and nested directives
  • Fixed issue where XMLReporter did not properly escape strings
  • Fixed support for unsafe keyword
  • Fixed edge cases in spaceAroundBrackets rule
  • Fixed crash in sortTypealiases rule
  • Fixed issue where redundantSelf rule could crash if encountering a function with no body (e.g.@_silgen_name)

0.58.7

29 Nov 12:29

Choose a tag to compare

  • Fixed redundantSelf not being applied inside if #available(...) { ... } clauses
  • Fixed fileHeader rule incorrectly setting creation year to current when file path contains spaces
  • Fixed mis-insertion for nil-init rule related to optional closure return values
  • Fixed unusedPrivateDeclarations false positive when call site was outside enabled range
  • Fixed sortImports rule incorrectly moving // swift-tools-version: comment directive
  • Fixed hoistTry rule sometimes producing mangled code when hoisting across line boundaries
  • Fixed crash in --ruleinfo command when rule options exceed the old max length requirement
  • Fixed crash in unusedArguments due to scope range bug

0.58.6

11 Nov 21:43

Choose a tag to compare

  • Fixed docComments not being applied correctly after conditional switch...case
  • Trailing commas are no longer inserted inside #selector(...) expressions
  • Source files listed with --filelist are now formatted concurrently
  • Trailing comments are now kept with the same line when wrapping
  • Fixed spurious return removal inside repeat...while loops
  • Fixed bug with trailingClosures rule and property wrappers
  • Fixed performance regression introduced in 0.58.5
  • Reduced timeout threshold to 1ms per token

0.58.5

17 Oct 20:17

Choose a tag to compare

  • Fixed regression with indenting of macros (introduced in 0.58.4)
  • Fixed spurious removal of return keyword inside for ... where loops
  • Fixed parsing error with for await case ... loops
  • Added XCTUnwrap to the default exclusion list for hoistTry

0.58.4

16 Oct 06:42

Choose a tag to compare

  • Whitespace is no longer added or removed from blank lines in multiline string literals
  • Fixed trailingComma rule incorrectly inserting commas inside typed throws
  • Fixed issue where opaqueGenericParameters rule could cause build errors with existential types
  • Fixed false positive with unusedArguments when argument is only referenced inside a macro
  • The noGuardInTests rule now preserves custom failure messages
  • The noGuardInTests rule no longer adds throws to test methods when not needed
  • Removed redundant "default" values from options help descriptions

0.58.3

04 Oct 13:38

Choose a tag to compare

  • Fixed parsing of [n of X] syntax for InlineArray in Swift 6.2
  • Fixed parsing error when an opening multiline string delimiter is followed by a space
  • Fixed issue where redundantInit rule could leave orphaned parentheses
  • Fixed bug where redundantInit was incorrectly applied to (Foo.self as Bar.Type) expressions
  • Fixed bug with parsing empty property accessors that broke redundantSelf rule
  • Fixed aliasing issue with acronyms rule where one acronym overlaps another
  • Fixed unexpected wrapping of closing parenthesis in wrapArguments rule
  • Added --unknown-rules option to support environments with older SwiftFormat versions

0.58.2

29 Sep 15:39

Choose a tag to compare

  • Fixed issue where modifierOrder rule confused async effect for async modifier
  • Fixed issue where testing related rules incorrectly treated functions with arguments as test cases
  • Updated redundantInit rule to apply to init calls with single trailing closure
  • Updated README.md to reflect actual precedence behavior between .swift-version files and --swift-version arguments