Releases: nicklockwood/SwiftFormat
Releases · nicklockwood/SwiftFormat
0.55.1
0.55.0
- Added
docCommentsBeforeModifiers
rule to hoist doc comments above declaration modifiers - Added
unusedPrivateDeclarations
rule to remove unusedprivate
orfileprivate
declarations - Added
propertyTypes
rule to control the use of inferred or explicit types for properties - Renamed the
--redundanttype
option to--propertytypes
as it's shared by both rules - Added
--ranges preserve
and--operatorfunc preserve
options - Added
--languagemode
option to specify if you are using Swift 5 or 6 language mode - The
organizeDeclarations
rule can now sort declarations by name/type/visibility/etc - Fixed
organizeDeclarations
bug where--beforemarks
unexpectedly matched keywords in function bodies - Fixed missing lint output for
organizeDeclarations
rule - Fixed bug in
markTypes
rule for chained protocol extension names - Renamed the confusing
--onelineforeach
option to--inlinedforeach
- Git info can now be used in header comments when formatting code from stdin
- You can now use the
--outputtokens
option to print output as tokens in JSON format - Each rule and test is now defined in a separate file to make it easier to maintain/contribute
- Updated minimum Swift version for building SwiftFormat to 5.3 (you can still format older Swift code)
- Docker build now uses static Linux SDK
0.54.6
- Fixed incorrect wrapping of conditional bodies inside single-line string literals
- Fixed properties inside type with where clause being treated as local scope
- Fixed regression in
wrapMultilineStatementBraces
rule - Fixed tokenizing of a throwing closure type in a generics clause
- Fixed bug in
parseDeclarations
where incorrect tokens could cause rules to time out - Fixed issue where
organizeDeclarations
would add extra blank lines if type had blank lines with spaces - Added known issue to README for
preferForLoop
rule
0.54.5
- Fixed crash in
unusedArguments
rule - Fixed bug where
preferForLoop
failed ifforEach
containsguard ... else { return }
0.54.4
- Fixed bug where trailing comma was erroneously inserted into a wrapped array type extension
- Fixed bug where
return
was incorrectly removed insidecatch
statement withwhere
clause - Fixed
opaqueGenericParameters
rule being incorrectly applied to functions with typedthrows
- Fixed
spaceAroundBrackets
behaving incorrectly inside a macro invocation - Fixed
unusedArguments
false positive inside multiline string literal - Fixed a case where removing
return
resulted in non-compiling code for opaque return types - Redundant
Void
return type is now removed from functions in protocol declarations - Fixed a bug where
unusedArguments
didn't handle conditional assignment shadowing correctly - Fixed Xcode 16 Beta warnings related to unhandled files when building SwiftFormat package
- The Swift runtime is now packaged with the installer on Windows as on Linux
- The Windows installer now uses a more conventional directory structure
- SwiftFormat for Windows now supports arm64
0.54.3
- Fixed issue where
--wrapeffects never
could unexpectedly remove unrelated code - Fixed
--condassignment
option (setting this previously had no effect) - The
redundantReturn
rule no longer removes conditionalreturn
s ifconditionalAssignment
is disabled - The
redundantObjc
rule now strips implicit@objc
attribute for@IBSegueAction
functions - Fixed bug where violations for rules that insert new lines were sometimes ignored in lint output
0.54.2
- Fixed broken formatter cache, which caused a significant performance regression since 0.54.0
- The
blankLinesBetweenChainedFunctions
rule now removes blank line after comments in the chain - The
blankLinesBetweenChainedFunctions
rule no longer conflicts withblankLinesAroundMark
- Fixed
redundantInternal
removing requiredinternal
keyword in extensions withwhere
clause - Fixed another case of spurious
return
removal in conditional blocks - Fixed
redundantNilInit
rule insertingnil
afteras
keyword
0.54.1
- The
--nilInit insert
option is no longer applied to lazy or attributed properties - The
blankLinesBetweenChainedFunctions
rule now correctly handles comments in the chain - Fixed indenting of wrapped arguments in
--fragment
mode - Fixed bug where attributes were mistaken for an accessor in a computer property
- Fixed indenting of commented code after an opening bracket
- Fixed spurious removal of
return
in conditional blocks - Fixed
--lint
mode reporter output when usingstdin
0.54.0
- Added
blankLineAfterSwitchCase
rule for inserting blank lines after switch cases - Added
consistentSwitchCaseSpacing
rule for ensuring consistent spacing between switch cases - Added
redundantProperty
rule for removing variable assignments where value is immediately returned - Added
redundantTypedThrows
rule for stripping redundantNever
orany Error
throws
types - Setting
--report
without--reporter
type now raises an error if type can't be inferred - Added XML reporter for Checkstyle-compatible lint reporting (use the
--reporter xml
option) - Added
--typedelimiter
option for controlling spacing around the colon in type definitions - Added
--initcodernil
option for returningnil
instead of asserting in unavailableinit?(coder:)
- The
fileHeader
rule now uses git info forcreated
date (if available) instead of file system - Added git
author
,author.name
andauthor.email
tokens for file header templates - Added
--callsiteparen
option for controlling closing paren placement at function call sites - The
wrapAttributes
rule can now be applied differently to computed properties vs stored properties - The
wrapAttributes
rule can now be applied differently to complex (parameterized) vs simple attributes - Replaced
--varattributes
with--storedvarattrs
,--computedvarattrs
and--complexattrs
options - Added
—-nilinit
option for controlling whetherredundantNilInit
adds or removes explicitnil
- Added ability to organize declarations by type over visibility (use
--organizationmode type
) - Fixed bug where enabling
organizeDeclarations
for structs causedsortDeclarations
to have no effect - Fixed bug where if statement body could be incorrectly parsed as a trailing closure
- Improved attribute handling in
opaqueGenericParameters rule
- SwiftFormat now recognizes
init
and_modify
property accessors - Fixed bug with
preferForLoop
rule and tuple argument matching - Extended
conditionalAssignment
rule to handle more cases - Added
--condassignment after-property
option - Fixed await being hoisted outside of macro arguments
- Fixed unsafe adding/removal of
self
within macros - Added
os_log
to--selfrequired
defaults
0.53.10
- Fixed creation of spurious
stdout
directory when using--output stdout
- Fixed
unusedArguments
false positive for multiline function call arguments - Fixed parsing of generic arguments containing attributes or
~
operator - Fixed spurious errors about missing
--report
or--reporter
arguments - Fixed
strongifiedSelf
removing required backticks around nonisolatedself
- Deprecated explicit
default
value for--reporter
(introduced in 0.53.9) - Added support for
sending
keyword