Skip to content

Releases: swiftlang/swift-format

0.50700.1

10 Oct 15:24
5f18422
Compare
Choose a tag to compare

This release is compatible with Swift 5.7.

This update pins the swift-syntax dependency to at least 0.50700.1, which fixes an issue where new if let shorthand syntax was not recognized.

0.50700.0

20 Sep 16:12
3dd9b51
Compare
Choose a tag to compare

This release is compatible with Swift 5.7.

Significant changes since the last release:

  • The AlwaysUseLowerCamelCase rule no longer emits a warning for override declarations. (0e705f4)
  • The UseWhereClausesInForLoops rule won't hoist an if condition into a where clause if it also has an else block. (793d764)
  • #if postfix expressions now have improved formatting. (7216a18)
  • Files will not be overwritten if they are not changed during formatting, preserving their modification time and other metadata. (3b2b9b4)

0.50600.1

22 Mar 19:47
e6b8c60
Compare
Choose a tag to compare

This release is compatible with Swift 5.6.

This update fixes a build error caused by a conflicting Windows-only conformance from swift-tools-support-core and one that we added in our code base. (22f1843)

0.50600.0

18 Mar 20:11
c062580
Compare
Choose a tag to compare

This release is compatible with Swift 5.6.

Significant changes since the last release:

  • Diagnostics have been refactored as "findings". Users of swift-format as an API (via the SwiftFormatter and SwiftLinter classes) now receive warnings and errors via a new Finding type that is independent of SwiftSyntax diagnostic types, for greater flexibility. (7aa5df5)
  • Diagnostics are now printed in color if standard error is connected to a terminal. This can be controlled with the --color-diagnostics/--no-color-diagnostics command line flags (to force color output when redirected to something other than a terminal, or to disable color output to a terminal). (4f90887)
  • Formatting of throws and async property effects has been fixed. (f646a1f, 55fc4e2)
  • The legacy -m/--mode flag has been removed. (defb00d)

0.50500.0

21 Sep 23:59
f872223
Compare
Choose a tag to compare

This release is compatible with Swift 5.5.

Significant changes since the last release:

  • New concurrency syntax added in Swift 5.5 is supported. (427d314)
  • Closures with attributes in their function signature are supported. (35e8687)
  • Significant stability and performance improvements have been made to --parallel format mode. (6d500ea)
  • generate-pipeline no longer uses a hardcoded list of suppressed rules, instead marking those rules as opt-in. This makes two "new" rules available (they have always had implementations but have been suppressed): UseEarlyExits and UseWhereClausesInForLoops. These rules are not currently stable or well-tested so they are disabled by default. (6bd3a55)

0.50400.0

28 Apr 22:49
9c15831
Compare
Choose a tag to compare

This release is compatible with Swift 5.4.

Significant changes since the last release:

  • The --parallel flag supports formatting multiple files in parallel. This should be much faster when formatting large numbers of files. (a062ec8)
  • The --ignore-unparsable-files flag is now honored in lint mode; unparsable files are silently ignored and no diagnostic is emitted. (fc3fab6)
  • #if declarations surrounding case clauses inside a switch statement are formatted correctly. (8df2cb0)
  • UseLetInEveryBoundCaseVariable no longer produces incorrect diagnostics for certain patterns. (c3c17ad)
  • BeginDocumentationCommentWithOneLineSummary has been made opt-in by default. (22118db)
  • UseSynthesizedInitializer now produces more accurate diagnostics by considering the visibility of the stored properties in the type. (dd87cc2)

0.50300.0

19 Sep 16:44
1208917
Compare
Choose a tag to compare

This release is compatible with Swift 5.3.

Significant changes since the last release:

  • Support is added for rules to be opt-in rather than on-by-default. (40bab4e)
  • The following rules have been made opt-in, because they are either too strict for many real-world use cases or are not yet correct enough to enable universally. Existing configuration files will not be affected, but when using the default configuration, these rules will be off by default: (1c2a5a2, 642c2d1)
    • AllPublicDeclarationsHaveDocumentation
    • NeverForceUnwrap
    • NeverUseForceTry
    • NeverUseImplicitlyUnwrappedOptionals
    • NoLeadingUnderscores
    • ValidateDocumentationComments
  • Improvements to AlwaysUseLowerCamelCase:
    • It is now applied to closure arguments and variables bound in if/guard let patterns. (7867cda)
    • Diagnostics are now clearer about the kind of declaration affected. (97628a8)
    • Functions that look like test case methods are excluded; for example, to support common naming schemes like testSomeObject_inSomeState_actsSomeWay. (9080762)
  • Improvements to ValidateDocumentationComments:
    • A Returns section is no longer required for functions that return Never. (674b34d)
    • Presence of absence of the Throws section is now validated against the function signature. (57a5cb6)
  • Multiple trailing closures are formatted. (e286081)
  • Fix a crash when linting a collection literal with single element and a trailing comma. (483580f)
  • Fixed invalid locations in some diagnostics. (ea02880)
  • Keep try keyword next to the expression following it whenever possible, only breaking between them when necessary. (35fdb4f)
  • Recursively apply NoParensAroundCondition to pick up nested occurrences. (ed45527)
  • Do not remove semicolons between a do block and a while block. (cb4e621)
  • Fix some situations where OneVariableDeclarationPerLine would incorrectly break declarations. (2b4364b)
  • Add a indentSwitchCaseLabels configuration option to control whether case statements inside a switch are indented. (2107603)
  • Speed and memory usage improvements when formatting and linting.

0.50200.1

30 Apr 23:23
f22aade
Compare
Choose a tag to compare

Significant changes in this release:

  • Format property wrappers correctly. (e829789)
  • Move open group token past ifstmt's if token to avoid extra newlines. (5df9eb4)
  • Handle @derivative attribute without a wrt: clause. (2c29da1)
  • Disallow discretionary newlines before trailing closures. (a4100c3)
  • Disallow line breaks inside completely empty array and dictionary expressions. (66cac37)
  • Force all branches of an if/else if/else sequence to break inside the {...} if the sequence requires more than one line, even for branches that contain a single statement. (c52e0d2)
  • Fix indentation of wrapped conditions in while statements. (8fbc3f1)
  • Fix formatting of @differentiable containing only wrt: and where clauses. (0da09d0)
  • Fix counting of consecutive newlines. (513a2c7)
  • Apply NoEmptyTrailingClosureParentheses rule recursively. (5cca489)
  • Fix some cases where class declarations would overflow line length. (20162cd)
  • Prevent trailing commas from overflowing the maximum line length. (ed5f980)
  • Detect () cases previously missed by ReturnVoidInsteadOfEmptyTuple. (ff7ac9a)
  • Allow right parenthesis of an enum case to be on the same line as the last parameter. (a50d4fe)
  • Add spaces after labels for all statement types. (c7db906)
  • Fix @differentiable attribute formatting when the where clause is the first thing in the attribute, or when the wrt: clause is a tuple. (428b33c)
  • Remove calls to FileHandle.synchronizeFile() that were crashing on Linux. (744ca11)
  • Restrict doc-block to doc-line transform to first doc comment on a declaration. (58ccbf3)
  • Discard newlines when sorting imports. (47b5015)

0.50200.0

01 Apr 22:25
1fda398
Compare
Choose a tag to compare

This release is compatible with Swift 5.2.