Releases: swiftlang/swift-format
Releases · swiftlang/swift-format
0.50700.1
0.50700.0
This release is compatible with Swift 5.7.
Significant changes since the last release:
- The
AlwaysUseLowerCamelCase
rule no longer emits a warning foroverride
declarations. (0e705f4) - The
UseWhereClausesInForLoops
rule won't hoist anif
condition into awhere
clause if it also has anelse
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
0.50600.0
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
andSwiftLinter
classes) now receive warnings and errors via a newFinding
type that is independent ofSwiftSyntax
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
andasync
property effects has been fixed. (f646a1f, 55fc4e2) - The legacy
-m/--mode
flag has been removed. (defb00d)
0.50500.0
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
andUseWhereClausesInForLoops
. These rules are not currently stable or well-tested so they are disabled by default. (6bd3a55)
0.50400.0
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 inlint
mode; unparsable files are silently ignored and no diagnostic is emitted. (fc3fab6) #if
declarations surroundingcase
clauses inside aswitch
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
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)
- It is now applied to closure arguments and variables bound in
- Improvements to
ValidateDocumentationComments
: - 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 awhile
block. (cb4e621) - Fix some situations where
OneVariableDeclarationPerLine
would incorrectly break declarations. (2b4364b) - Add a
indentSwitchCaseLabels
configuration option to control whethercase
statements inside aswitch
are indented. (2107603) - Speed and memory usage improvements when formatting and linting.
0.50200.1
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 awrt:
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 onlywrt:
andwhere
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 byReturnVoidInsteadOfEmptyTuple
. (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 thewhere
clause is the first thing in the attribute, or when thewrt:
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)