0.48.0 (2020-04-20)
- Add
--emptybracesto control how empty braces are formatted - The
redundantReturnrule now removes redundantreturnstatements in Void functions - The
redundantParensrule now removes redundant parens around closure arguments - Fixed parsing error with complex
guardstatements - Extended
prefersKeyPathto supportcontains,allSatisfyandfiltermethods - Fixed matching of excluded paths containing ../
- Added support for using globs/wildcards in input paths
- Eliminated false positives in change list when using
--lintmode - File header comments are now inserted after the shebang/hashbang in executable Swift scripts
- Xcode Extension now silently ignores rules requiring file info that isn't available to extensions
- Fixed bug where
wrapEnumCasesrule was incorrectly applied toif caseorguard case - Added
--reportargument for exporting formatting changes or lint violations as a JSON file - Improved tab layout in SwiftFormat for Xcode companion app
0.47.13 (2020-03-21)
- Fixed bug where
--wrapreturntype if-multilinewould unexpectedly wrap a single-line method - Multiline chained functions are now indented correctly when using
--xcodeindentation - Blank lines are no longer inserted between multiline chained functions separated by comments
- Fixed bug in
hoistPatternLetrule whereletwould be placed on the wrong line - Fixed bug where
Void.selfwould incorrectly be converted to().self - Fixed incorrect spacing of closure arguments containing attributes
- Trailing commas are no longer incorrectly inserted inside wrapped type signatures
- Added
--lintonlyargument to specify rules that should only be applied in--lintmode
0.47.12 (2020-02-23)
- Fixed indenting of
switchcases inside#if/#endifclauses - Explicit
selfis no longer removed inside types using@dynamicMemberLookup - Fixed indenting of wrapped, chained methods when using
--xcodeindentation awaitis no longer treated as a keyword if--swiftversionis set to < 6- Fixed issue where single line method after array would wrap unexpectedly
- Made repository checkoutable on Windows
0.47.11 (2020-01-29)
- Fixed bug with
redundandSelfrule sometimes insertingselffor a local variable - Fixed
wrapAttributesrule not working for convenienceinits, or vars withprivate(set) - Fixed bug with indenting of wrapped members when using
--xcodeindentationmode - Fixed erroneous space being inserted into keyPaths by
spaceAroundOperatorsrule - Fixed bug with
--nospaceoperatorsaffecting custom infix operators with closure operands - Added support for sorting imports by length instead of alphabetically
0.47.10 (2020-12-28)
- The
blankLinesBetweenScopesno longer inserts a blank line before Sourcery comment directives - Fixed bug where
redundantFileprivaterule could break code that uses property wrappers - Fixed crash in
parseDeclarationshelper
0.47.9 (2020-12-24)
- Fixed bug with
redundantTyperule removing required type inif letexpressions - Fixed a bug in
organizeDeclarationswhen file contains a class-bound protocol - Improved
sortedSwitchCasesordering - Removed erroneous space inserted into array initializer by the
spaceAroundParensrule - Comments followed by a continuation character in SwiftFormat config files now handled correctly
- Removed spurious blank lines in console output introduced in 0.47.8
- Improved command-line typo suggestions
0.47.8 (2020-12-10)
- Fixed additional cases where
fileprivatewas incorrectly converted toprivatein extensions - Added preliminary support for upcoming async/await syntax
0.47.7 (2020-12-09)
- Fixed critical bug where
fileprivatewas incorrectly converted toprivatein some cases
0.47.6 (2020-12-08)
- Fixed bug in
redundantReturnwhen thereturnstatement is not the last line in a block - Fixed sorting of tuple cases when using
sortedSwitchCasesrule - Added
--nevertrailingoption for excluding functions from thetrailingClosuresrule - Added
trailingClosuresexception for Nimbleexpect()function - The
redundantFileprivaterule is now applied correctly to extension members - Fixed some bugs with static members when using the
--redundanttype explicitoption - SwiftFormat command line tool is now signed for better compliance with Big Sur
- Updated icon for Big Sur (thanks to Jim Puls for the icon design)
0.47.5 (2020-11-27)
- Added
--redundanttypeoption for controlling how redundant types are resolved - Numeric case values are now sorted naturally instead of alphabetically
- Fixed bug where
redundantFileprivaterule broke trailing-closure inits - Fixed various
enumNamespacesrule edge-cases - Broken symlinks no longer raise an error if they are ignored in config
- File creation date can now be used in header formats on Linux
- The
--symlinksoption now works correctly on Linux
0.47.4 (2020-11-15)
- Command-line tool now includes an arm64 slice for Apple Silicon
- Increased strictness of grouped extensions logic
- Fixed issue where
markTypesrule would mistake an import declaration as a type - Fixed some additional bugs with unhoisting pattern let
- Fixed bug with trailing comma being inserted in capture lists
- Added warning when setting options for disabled rules
- Fixed bug with
sortedImportsmangling file header comment - Fixed bug with indenting of multiline comments
0.47.3 (2020-11-09)
- Fixed bug with
extensionAccessControlincreasing extension access level beyond extended type - Fixed regression with non-standard
.swift-versioncontents being flagged as an error - Fixed bug in
hoistPatternLetrule when using--patternlet inline - Fixed case where
enumNamespaceswas incorrectly applied - Fixed indenting of wrapped line starting with a closing paren or brace
- Fixed indenting of blocks starting on same line as a switch case
- Fixed indenting of wrapped closure parameter
- Fixed bug in
--allmaninference
0.47.2 (2020-10-30)
- The
markTypes,organizeDeclarationsandextensionAccessControlrules now respect comment directives - Errors in
.swiftformatconfig files no longer fail silently - Fixed bug in
--modifierorderconfig and added support for SwiftLint modifierorder syntax - Fixed issue where
hoistPatternLetbreaks compilation due to a quirk in Swift parser - Fixed bug in
hoistPatternLetwhen expression is wrapped or contains spaces - The
typeSugarrule is now applied in more cases - Fixed bug in cache logic resulting in slower formatting when using certain config options
- Fixed crash in
indentrule - Fixed bug in wrapped
elseindent
0.47.1 (2020-10-26)
- Fixed a crash when using the
fileHeaderrule - Fixed occasional out-of-bounds crash in
markTypesrule - Fixed bug where
wrapArgumentsrule unexpectedly indented blank lines inside braces or brackets - Added
--wrapconditionsoption for controlling how multiline conditional statements are wrapped - Unicode whitespace characters other than space and tab are no longer treated as an error
- Indenting of
elseclauses now matches Xcode 12
0.47.0 (2020-10-14)
- Indenting of wrapped
if,guard,while, etc. now matches Xcode 12 behavior - Added
--assetliteralsoption for managing how image/color literal length is handled - Added
enumNamespacesrule to replace classes/structs that only have static members with an enum - Added
extensionAccessControlrule to hoist/unhoist access control modifiers inside extensions - Added
markTypesrule for automatically insertingMARK:comments between type declarations - Added
sortedSwitchCasesrule to automatically sort grouped switch cases alphabetically - Added
--wrapreturntypeoption to control how return type is wrapped in function declarations - The
organizeDeclarationsrule is now also applied to extensions - Updated
--xcodeindentationbehavior for Xcode 12
0.46.3 (2020-09-20)
- Fixed bug where
redundantTyperule corrupted assignments involving ternary expressions - SwiftFormat for Xcode Extension now works in Xcode 12 out of the box
0.46.2 (2020-09-05)
- Fixed space being unexpectedly removed before prefix
.operator byspaceAroundOperators - Fixed bug where a pair of less-than, greater-than operators could be interpreted as generics
- Fixed
organizeDeclarationsrule mistaking function with nested class for a lifecycle method
0.46.1 (2020-08-30)
- Fixed bug where computed property bodies were sometimes wrongly identified as closures
- Fixed spurious blank lines in output when formatting
- The
organizeDeclarationsrule no longer inserts blank lines at start/end of scopes - The
organizeDeclarationsrule now groups typealiases with types instead of properties - Improved heuristic for matching
// MARK:comments inorganizeDeclarations - Configuration file now allows line continuations using
\delimiter
0.46.0 (2020-08-28)
- Added
organizeDeclarationsrule for grouping and organizing type members - Added
wrapEnumCasesrule for wrapping enum cases onto separate lines - Added
wrapSwitchCasesrule for wrapping switch cases onto separate lines - Added
initCoderUnavailablerule for marking stubinit(coder:)implementations as unavailable - Added
redundantTyperule for removing redundant type annotations from variable declarations - Added search filter bar for rules in SwiftFormat for Xcode extension
- Selection is now preserved correctly in Xcode 12 when using SwiftFormat extension
- Fixed indenting of wrapped closure arguments when using
--closingparen same-line - Fixed spurious space insertion with
spaceAroundOperatorsrule in some circumstances - Switch cases marked with
@unknownare now indented automatically instead of being ignored - Wrapped method chains now behave more consistently when using
--xcodeindentationoption - Removed deprecated
rangesrule, but un-deprecated therangesoption for convenience - Single-letter command-line flags now behave more usefully (e.g. -o maps to --output)
- Spaces are now permitted in comma-delimited command-line arguments
- Added more helpful feedback for mistyped arguments
0.45.6 (2020-08-12)
- Added
--yodaswapoption for more fine-grained control ofyodaConditionsrule - Fixed indentation of wrapped type declarations when using
--xcodeindentation enabled - Fixed alignment of closure braces when using
--allmanstyle
0.45.5 (2020-08-09)
- Fixed
.swiftformatconfiguration file processing when using--stdinpathoption - Fixed bug where conditional imports could be mangled by
sortedImportsrule - Fixed indenting of braces after throwing function with wrapped return type
- Fixed indenting of wrapped
inkeyword inside closure
0.45.4 (2020-08-08)
- Improved indenting of wrapped closure braces when using
--allmanindenting - Fixed crash in
blankLinesBetweenScopesrule when using--linerangeargument - Fixed
indentrules behavior when using--linerangeargument - Audited all rules for
--linerangecompatibility - Improved
Format Selectionbehavior in Swiftformat for Xcode extension - Fixed bug with
fileHeaderrule stripping formatting comment directives at top of file - Documented known issue with
preferKeyPathandcompactMap()in README file - The value for
--wrapparametersnow defaults to match--wraparguments - Fixed indenting of wrapped guard else
0.45.3 (2020-08-03)
- Added
--linerangecommand-line argument for partial file formatting or linting - Added
--varattributesoption to complement--funcattributesand--typeattributes - Fixed spurious "Unexpected static/class ..." warning in
redundantSelfrule - Fixed bug in tokenIndex() calculation when last line does not end in a linebreak
- Fixed bug where
selfwas incorrectly removed inside trailing closures on generic type init - Blank lines are no longer indented when using
--trimwhitespace nonblank-lines
0.45.2 (2020-08-01)
- You can now tweak formatting options inside source files using
// swiftformat:options ...directive - The
wrapMultilineStatementBracesrule is now applied to more statement types - Fixed spurious lint warnings due to conflict between
bracesandwrapMultilineStatementBracesrules - Fixed several bugs in
redundantSelfrule relating to for loops - Fixed bug with indenting of closure arguments
- Fixed unsafe removal of backticks around
init - Rules can now raise an error if they encounter malformed code instead of failing silently
- SwiftFormat for Xcode app no longer shows deprecated rules in the rules tab
0.45.1 (2020-07-30)
- Fixed bug where
preferKeyPathwas incorrectly applied to function calls and compound expressions - The
wrapMultilineStatementBracesrule is now applied toinitandsubscriptbraces - The
wrapAttributesrule now handlesinitandsubscriptthe same way as functions
0.45.0 (2020-07-29)
- Added
wrapAttributesrule for controlling attribute position - Added
wrapMultilineStatementBracesrule for opening braces for wrapped expressions - Added
preferKeyPathrule for converting trivial closures to keyPaths in Swift 5.2 - Added
--smarttabsoption to support consistent indenting regardless of--tabwidth - Updated Xcode extension for Xcode 12 and macOS Big Sur
- Added Swift version dropdown to SwiftFormat for Xcode configuration app
- Added
--guardelseoption to control wrapping ofelseclauses inguardstatements - Allman braces are now applied to closure braces, which were previously ignored
- The
voidrule now convertsVoid()literals to just() - Improved indenting of closing parentheses and brackets
- Renamed
--emptyoption to--voidtype, which better describes its function - Renamed
specifiersrule tomodifierOrderfor consistency with SwiftLint - Renamed
--specifierorderconfiguration option to--modifierorder - Fixed bug where
--verbosemode didn't log path for unchanged files - Improved documentation of
numberFormattingconfiguration options - Added Sublime Text plugin instructions
0.44.17 (2020-07-12)
- The
wrapArgumentsrule now keeps internal and external parameter labels on the same line - Multiline string literals are now indented more consistently
- Fixed infinite recursion bug in the
redundantSelfrule - Fixed duplicate file path logging in
--verbosemode - Indented braces are now always balanced
- Add
--stdinpathoption, allowing git pre-commit hook to support file header info - Updated instructions for git pre-commit hook (again)
- Added inference for
--noSpaceOperatorsoption
0.44.16 (2020-07-02)
- Fixed bug in
--output stdoutprocessing - Reverted git pre-commit hook instructions
0.44.15 (2020-07-01)
- Fixed incorrect indenting for double-nested closures
- Added inference for
--wrapparametersoption - Fixed incorrect
--wrapargumentsinference - The
spaceInsideBracesrule will no longer add space between nested braces - Fixed bug in
isStartOfClosure()helper - Fixed indent logic for closing braces
- You can now use
--output stdouteven when using a file path for input - SwiftFormat will now raise an error if missing info needed for
fileHeaderrule - Improved SwiftFormat for Xcode app icon
- Updated instructions for git pre-commit hook
0.44.14 (2020-06-23)
- Added new icon for SwiftFormat for Xcode app (thanks to Vikram Kriplaney for the icon design)
- Fixed
redundantParensrule stripping parens around#file(used to silence warning in Swift 5.3) - Avoid raising "Malformed .swift-version file" error when using unusual formats (e.g. for beta releases)
- Fixed
redundantBackticksrule unescapinggetinside subscript withwhereclause - Fixed
redundantReturnfailing to removereturnin function or subscript withwhereclause - Fixed SwiftFormat for Xcode version number
0.44.13 (2020-05-28)
- Fixed indenting of closing bracket when using
wrapArgumentsrule - Added
--shortoptionalsargument to selectively disable shortening ofOptional<T>toT?for properties - Added
--minversionargument to specify minimum SwiftFormat version to use for a given codebase
0.44.12 (2020-05-27)
- Fixed indenting of chained methods with trailing closures
- SwiftFormat command-line tool now logs the location of .swiftformat configuration files that it encounters
0.44.11 (2020-05-23)
- Fixed failure to terminate when wrapping functions after first parameter
- First element in a wrapped collection or function is now correctly indented
- Added workaround for Swift type sugar parsing bug
- The
blankLinesBetweenScopesrule no longer inserts a blank line before an#elseblock - Downgraded "No eligible files found" error to a warning
- Removed "Failed to format any files" error, which was sometimes triggered erroneously
- Fixed deprecation warning when building on Linux
0.44.10 (2020-05-14)
- Fixed bug where
--specifierorderoption values were sorted alphabetically - Fixed a couple of bugs in
hoistPatternLetwhen--patternletis set toinline - Added support for hoisting/unhoisting
varandletindo ... catchpatterns - Added error if
--specifierordercontains duplicate values
0.44.9 (2020-05-05)
- Added
--specifierorderargument for overriding default order used byspecifiersrule - Added
--nowrapoperatorsargument for preventingwraprule breaking at specific operators - The
redundantNilInitrule no longer removesnildefaults from vars in structs using synthesized init - Fixed indenting of trailing comment delimiter in multiline comments
0.44.8 (2020-05-01)
- Fixed a significant performance regression introduced in 0.44.6
- Changed ordering of
overridekeyword in specifier lists to match SwiftLint - Fixed timeout due to infinite recursion when formatting nested comments
- The
trailingSpacerule is now called beforeindentto avoid noise when linting - Fixed bug where
unusedArgumentsrule ignored all arguments if any was already ignored - Fixed
redundantParensrule breaking closure argument lists where argument is namedself - Fixed indenting of multiline string interpolations
- Fixed broken formatting of multiline string interpolations
- Fixed crash in
wraprule - The
wraprule now favors wrapping function args over wrapping at.operator - Fixed a bug with indenting of pre-formatted multiline comments
- Fixed a misleading error message relating to
--tabwidthoption
0.44.7 (2020-04-04)
- Fixed indenting of wrapped closures after a switch statement
- Fixed bug with
redundantNilInitremovingnilfor properties using parameterized property wrappers - Fixed
redundantRawValuesrule not removing values for back-tick-escaped case names - Improved error messages for misnamed rules
- Documentation improvements
0.44.6 (2020-03-21)
- Fixed timeout when formatting files containing multiple trailing closures
- Added
--filelistargument for specifying input source files list in a standalone file - Fixed bug in the git pre-commit hook suggested in the README file
0.44.5 (2020-03-11)
- Fixed bug with indenting of chained closures
- Fixed bug where wrapped braces were over-indented
- Fixed indenting of comments inside enum declarations
- Improved consistency of
--xcodeindentationoutput with Xcode's built-in formatting - Extension braces are now correctly wrapped
- Switch statement braces are now correctly wrapped
- Fixed bug where
duplicateImportsrule could remove a required@testableimport
0.44.4 (2020-02-27)
- Allman braces are now applied correctly for lines that end in a numeric literal
- Blank line is now removed when stripping a redundant
returnkeyword on its own line - Fixed space being inserted before the
.in a nested PropertyWrapper expression - Fixed
returnbeing incorrectly removed insideifstatements containing an un-parenthesized closure
0.44.3 (2020-02-20)
- Fixed incorrect indenting of closing multiline string delimiter
- Fixed bug where
redundantReturnrule incorrectly removedreturnafter a brace without leading space - Fixed edge case where closures without surrounding parentheses were misinterpreted in if statements
- Fixed failure to wrap braces after a struct or init declaration
0.44.2 (2020-02-02)
- Fixed crash in line wrapping logic
- Fixed several cases where braces were not correctly moved according to
wraprule - Prevented wrapping of image and color literals
- Fixed bug with
trailingClosuresrule breaking unwrap operators
0.44.1 (2020-01-26)
- Fixed
spaceInsideCommentsrule mangling preformatted comments with multiple slashes - Fixed
redundantFileprivatebreaking code relying on type-inference forinit - Reverted overly aggressive argument wrapping change in 0.44.0
- Fixed
redundantParensrule breaking#ifstatements without space before argument - Fixed
// swiftformat:disabledirectives not affectingwraporwrapArgumentsrules - Fixed bug where
yodaConditionsrule caused formatting to never terminate - Fixed crash in
fileHeaderrule
0.44.0 (2020-01-15)
- Xcode Extension now includes Lint File option
- Xcode Extension now preserves selection after formatting
- Improved range-based formatting in Xcode Extension
- Wrapping of function calls can now be configured separately from function declarations via the
--wrapparametersoption - Numerous improvements to wrapping and indenting logic (thanks to @AnthonyMDev for the fixes)
- Fixed indent logic for unbalanced closing parens
- Fixed
selfbeing removed incorrectly inside if statements - Fixed duplicate lint warnings
- Fixed failure to fix indent at start of file
- Fixed reported line index for
consecutiveBlankLinesrule
0.43.5 (2020-01-04)
- Fixed bug where
redundantBreakrule removed entire line if break appeared after a semicolon - Fixed a couple of cases where
redundantSelffailed to removeselfas expected
0.43.4 (2020-01-02)
- Fixed regression in
indentrule` that could cause multiline strings to become mis-formatted - Fixed bug in
--nospaceoperatorsoption where..<operator was rejected - Added instructions for installing SwiftFormat for Xcode via Homebrew cask
0.43.3 (2019-12-31)
- Deprecated
rangesrule and--rangesoption (use--nospaceoperatorswithspaceAroundOperatorsrule instead) - The
redundantSelfrule no longer removes self in cases where property requires backtick escaping - Fixed bug with
--nospaceoperatorspotentially removing required spaced near linebreaks - Fixed spurious lint warnings in
spaceAroundOperators,indentandwraprules - Improved wrapping heuristic for closures to avoid splitting expressions if avoidable
- Fixed indenting of closing brace for line-wrapped closures
- Fixed
indentrule performance regression introduced in 0.43.2 - Added warnings for deprecated options in config file
0.43.2 (2019-12-28)
- Added
--nospaceoperatorsoption for selectively removing space around specific operators - Allow
selfin lazy vars when Swift 4 and above - Fixed spurious lint warning when using a custom header with
fileHeaderrule - Fixed bugs with indenting of consecutive comments
- Fixed resolving of macOS aliases when using
--symlinks follow - Added explicit
stdinparameter option - Fixed stdin timeout flakiness
- Fixed bug with
andOperatorreplacing&&with,inside ViewBuilders
0.43.1 (2019-12-22)
- Fixed indent regression in wrapped
letexpressions - Fixed failure to remove
returningetaccessors
0.43.0 (2019-12-18)
- Added per-line warning when running in
--lintmode - Significantly improved Xcode integration when running as a build step in
--lintmode - Added
--lenientoption to suppress errors when running in--lintmode - Fixed bug where required
selfwas sometimes incorrectly removed inside a trailing closure - Improved
wraprule heuristic for prioritizing where a line should be broken - Fixed bug in
typeSugarrule affecting namespaced types
0.42.0 (2019-11-30)
- Added
wraprule for automatic wrapping of long statements or expressions based on--maxwidthoption - Fixed bug with
bracesrule inserting a redundant blank line at the start of nested scopes
0.41.2 (2019-11-27)
- Fixed bug with
trailingCommasrule incorrectly inserting a comma into wrapped collection type expressions
0.41.1 (2019-11-25)
- Fixed bug with
wrapArgumentsrule incorrectly wrapping code inside interpolated String expressions
0.41.0 (2019-11-23)
- The
wrapArgumentsrule can now automatically wrap functions and collections to--maxwidth - Added
—maxwidthoption to specify the width at which code should wrap (currently only used bywrapArgumentsrule) - Added
—tabwidthoption to help with code indenting and wrapping when using tabs for indent - Fixed indenting of code wrapped after the
inin afor...inloop - Fixed indenting of code wrapped before the
isin an expression - Added version check for
redundantBackticksrule to support fixes in Swift 5 - Fixed error when parsing escaped triple-quote in a multiline string
- Fixed bug where a multiline comments before an opening brace could result in corrupted output
- CLI will now fail if .swiftformat file contains an invalid option, instead of ignoring it
- Added support for formatting Swift package manifest files using Xcode Extension
0.40.14 (2019-10-28)
- The
redundantReturnrule no longer incorrectly removesreturninsidecatch letstatements - The
andOperatorrule no longer replaces&&with,inside function builder blocks - Fixed a bug where
redundantFileprivaterule incorrectly made overriddenfileprivate initmethods private - The
fileHeaderrule no longer strips tools version header fromPackage.swiftfiles - The
todosrule now recognizes and fixes a wider variety of typos
0.40.13 (2019-10-10)
- The
redundantReturnrule now removesreturnfrom functions and computed properties in Swift 5.1 - Fixed a bug with
lethoisting
0.40.12 (2019-09-20)
- Fixed crash when compiling with Xcode 11
- Fixed
redundantFileprivaterule breaking inner types - Fixed
--quietoption preventing formatting code to stdout
0.40.11 (2019-07-29)
- Added
--xcodeindentationoption to use Xcode-style indentation for guards and enums - The
redundantNilInitrule no longer removesnilfor properties using property wrappers - Fixed bug where
redundantParensrule incorrectly stripped Void generic arguments - The
voidrule is now correctly applied to generic type parameters
0.40.10 (2019-06-23)
- The
emptyBracesrule no longer removes linebreaks in chainedelse/catchblocks - Fixed duplicate
fileHeaderinsertion when comment isn't followed by blank line - SwiftFormat command-line tool no longer times out when encountering an empty file
- Fixed bug in
yodaConditionsrule affecting parenthesized subexpressions - The
consecutiveBlankLinesrule no longer strips blank lines inside multiline string literals - The
redundantObjcrule no longer strips@objcannotation fromfileprivatemembers - The
{file}placeholder infileHeadertemplates now works correctly
0.40.9 (2019-05-27)
- Fixed another case of
redundantSelfremoving requiredselfin closures - Fixed behavior of
redundantSelfin cases whereselfis shadowed - The
redundantObjcrule no longer strips@objcannotation from private members - Fixed bug where
isEmptyrule mangled expressions containing an array count - The
redundantSelfrule now correctly insertsselfin code following a declaration - Fixed bug where
—trailingclosuresoption was being ignored - Removed extra newline when printing content to stdout
- Fixed some bugs in the
fileHeaderrule
0.40.8 (2019-04-16)
- Fixed several bugs when using the
--self insertoption
0.40.7 (2019-04-12)
- Fixed postfix operator followed by
.being incorrectly interpreted as infix - Fixed bug with
andOperatorin repeat/while loops - Fixed bug with
redundantFileprivateaffecting local subclasses - Fixed regression with
--self insertaddingselfto function parameter labels - Case-differing imports are now preserved
0.40.6 (2019-04-10)
- Fixed a regression when parsing a generic type followed by
& SomeProtocol - Fixed bug where
--self insertoption failed to insertselfin the line after aletorvarstatement - Added
--unexcludefile paths option - Added regression test project suite
0.40.5 (2019-04-08)
- Fixed indenting of comments before an
#if/#elseclause inside aswitchstatement - Fixed indenting of
#ifstatement followed by comment inside aswitchstatement - Fixed bug in
selfremoval when followed by aswitchcontaining an#ifdef - Fixed bug when tokenizing chevron operators
- Fixed bug when tokenizing generic declarations
- Added
init-onlysupport to explicitSelf inference - Added inference for inline semicolons
0.40.4 (2019-03-23)
- Multiple instances of
--disableor other comma-delimited config options are now merged instead of replacing previous - The
redundantParensrule no longer removes explicit double-parens used to suppress warnings insideSelector(...) - The
trailingCommasrule no longer breaks calls toUICollectionView.performBatchUpdates() - Fixed bug in
yodaConditionsrule that broke KeyPaths
0.40.3 (2019-03-19)
- Fixed some bugs with the
redundantFileprivaterule relating to struct members - The
redundantFileprivaterule no longer affects members required for protocol conformance - Fixed a bug with
yodaConditionsrule inside ternary expressions
0.40.2 (2019-03-19)
- Fixed a bug where the
redundantParensrule incorrectly removed parens in a subscript or function invocation - Fixed a bug with the
trailingClosuresrule removing parens inside some conditional expressions - Fixed a bug in the
yodaConditionsrule that broke expressions containing subscripts - Fixed the
--swiftversionoption, which was being ignored under some circumstances - Fixed bug that caused the
--fragmentand--conflictmarkersoptions to be ignored - Fixed a bug in the
redundantObjcrule that incorrectly stripped@objcfrom nested enum types
0.40.1 (2019-03-16)
- Fixed bug where
--trailingclosureswould incorrectly remove parentheses before an opening brace - Fixed SwiftFormat for Xcode appearance when running in dark mode on macOS 10.14 (Mojave)
0.40.0 (2019-03-14)
- Added
--trailingclosuresoption for whitelisting functions that should use trailing closure syntax - The
trailingClosuresrule now only applies to a safe subset of methods by default - Enabled
trailingClosuresrule by default (use--disable trailingClosuresto opt out) - SwiftFormat now infers values to use for indentation, linebreaks, etc. if the associated rules are disabled
- Added new
yodaConditionsrule that moves constant values to the right-hand-side of expressions - The
--dryrunand--lintmodes now only list modified files when running in--verbosemode - Added an automatic timeout for buggy rules, or if a rule gets stuck when processing malformed input
- Fixed a bug in the
wrapArgumentsthat could corrupt argument lists containing commented lines - Fixed bug where
wrapArgumentssometimes rewrapped parenthesized expressions - Rule documentation is now available programmatically via the command-line
- Improved command-line UI, providing additional feedback and more detail in error messages
- Simplified SwiftFormat for Xcode app interface (big thanks to @VinceBurn for the UI implementation)
0.39.5 (2019-03-06)
- Fixed bug in
bracesrule where closing brace was not wrapped onto a new line - Fixed bug with
bracesrule affecting closures inside aswitchstatements - Relative indentation is now preserved inside multiline comment blocks
- Fixed indenting of
switchcases using Swift 5's new@unknownattribute - Fixed some errors in documentation and warning messages
- The
.swift-versionfile parser now permits cases like3.0-PREVIEW-4 - Fixed the performance test target, which was broken in Xcode 10.1
0.39.4 (2019-03-03)
- Added support for Swift 5's new raw string syntax
- Now correctly detects .swiftformat and .swift-version files placed anywhere in the input path
- The swiftformat command-line tool will no longer fail with an error if all matched files were ignored
- Fixed bug where
bracesrule failed to correctly apply Allman indenting toswitchstatements - Disabled the
isEmptyrule again by default (you can enable it using--enable isEmpty)
0.39.3 (2019-02-15)
- Fixed a bug with
hoistPatternLetrule for switch cases without a space - Fixed a bug in the
typeSugarrule when referencing nested types - The
.swiftformatconfiguration file type is now associated with the SwiftFormat for Xcode app
0.39.2 (2019-02-14)
- Fixed bug with indenting multi-line strings (introduced in 0.39.1)
- Fixed
redundantParensbug (introduced in 0.39.1) - Corrected documentation for
specifiersrule
0.39.1 (2019-02-12)
- Fixed some cases where
redundantParensfailed to remove redundant parentheses - Fixed rare instance where
indentrule could incorrectly indent multiline string literals - Added
Rules.mdfile to the repository, providing permalinks to the documentation for each rule - Rules documentation is now generated automatically from the SwiftFormat source code
- The Xcode Extension app now shows tooltips for rules in the Rules tab
- Fixed unit test failure in certain timezones
0.39.0 (2019-02-04)
- Added
redundantFileprivaterule, which replacesfileprivatewithprivatewhere possible - Added
redundantExtensionACLrule, to remove redundant access level keywords inside extensions - Added
typeSugarrule to replace Array, Dictionary and Optional types with shorthand forms - Added
redundantObjcrule, which removes unnecessary@objcannotations - Added
—selfrequiredoption for excluding@autoclosurearguments fromredundantSelfrule - The
isEmptyrule is now enabled by default, as the risk of false positives is fairly low - Enhanced the
fileHeaderrule with macros for file name and creation date - Added AppleScript integration instructions (thanks to @Lutzifer)
0.38.0 (2019-01-29)
- Added support for building, running and testing SwiftFormat on Linux
- Added
--swiftversionoption for version-specific features - Added
anyObjectProtocolrule to replaceclasswithAnyObjectin protocol declarations - Added
redundantBreakrule that removes unneeded breaks from switch cases - Added
strongifiedSelfrule which removed backticks inif let ``self`` = self {} - The
redundantReturnrule now removes void returns as well as ones that return a value - Renamed some option values for consistency
- The Xcode Extension app now shows tooltips on Options tab
0.37.5 (2019-01-24)
- Fixed another regression in the
redundantReturnrule
0.37.4 (2019-01-22)
- Fixed a regression in the
redundantReturnrule, causingreturnto be removed when it shouldn't
0.37.3 (2019-01-19)
- Fixed bug in
wrapArgumentsrule when using theafter-firstmode - The
elseOnSameLinerule no longer discards comments between clauses - Fixed bug with
redundantBackticksincorrectly stripping backticks inside keyPaths - Wrapped closure chains inside a var declaration are now wrapped correctly
- Fixed some cases where
redundantReturnrule was not being applied - Fixed bug with
bracesrule affecting nested closures
0.37.2 (2019-01-01)
- Fixed codesign issues with bundled binaries
- Significantly improved performance when using globs/wildcards in
--excluderules - Added glob syntax documentation to README file
0.37.1 (2018-12-18)
- Fixed a bug in the
isEmptyrule when used inside a function argument - Fixed bug where log messages included ANSI codes in non-terminal stderr output
0.37.0 (2018-12-17)
- Added
isEmptyrule, which converts instances ofif foo.count == 0 {}toif foo.isEmpty(disabled by default) - Added
redundantLetErrorrule, which removeslet errorfromcatch let error {}because it's implict - The
todosrule now converts/// MARK:to// MARK:, as the former isn't recognized by Xcode - Fixed problem with the peformance tests target not building locally in Xcode 10.1
0.36.0 (2018-12-15)
- Fixed
--excludeglobs matching path prefix instead of whole path (this may break exclude paths that relied on the bug) - Added new
andOperatorrule for replacing&&with,inif,whileandguardstatements - Added
init-onlyoption for the--selfargument, to enable explicitselfonly inside initializers - Significantly improved performance when using complex
--excluderules - Fixed infinite loop bug in
redundantSelfrule relating to properties named "type" - Fixed caching mechanism which was broken by an earlier Swift update
- Fixed spurious error message when
--excludeoption matched no files
0.35.10 (2018-12-13)
- Removed spurious
--verboseargument warning - Non-swift files are no longer logged as skipped in
--verbosemode - Fixed bug with comment indenting inside switch statements
- Fixed crash in wrapArguments rule
0.35.9 (2018-11-28)
- Fixed incorrect formatting of generic arguments containing function types
- Fixed inconsistent capitalization of the swiftformat executable in Package.swift
0.35.8 (2018-11-23)
- Updated
voidrule to support changes introduced in Swift 4 - Fixed a bug where
#endifcould be incorrectly indented if followed by a comment - Added
--importgroupingoption to group imports inside by@testable - Fixed a potential bug when loading options in the SwiftFormat for Xcode GUI
0.35.7 (2018-10-11)
- Fixed error when tokenizing an
enumdeclaration with awhereclause - Fixed bug with spacing around an infix operator used before the
#filekeyword - Fixed bug where
selfwas incorrectly removed inside property getters/setters
0.35.6 (2018-09-29)
- Fixed bug where
selfcould be incorrectly removed inside#ifblocks - Fixed some bugs when inserting or removing
selfinsidedidSethandlers - The
strongOutletsrule now ignores properties nameddelegateordataSource - The
wrapCollectionsrule now behaves more consistently with nested collection literals - Added "Open Recent" menu item to the SwiftFormat for Xcode app
0.35.5 (2018-09-08)
- Fixed a bug in
redundantParensrule that affected closure types that take a single tuple argument
0.35.4 (2018-09-05)
- Added glob support (unix-style wildcard file pattern matching) for
--excludepaths - Added
--quietoption to disable noncritical output messages when using the swiftformat CLI - Fixed a bug where an
import func ...statement caused theredundantSelfrule to loop indefinitely - Disabled ANSI formatting for stderr if stdout is pointing to a terminal interface but stderr isn't
- SwiftFormat is now more tolerant of white space around paths in a .swiftformat configuration file
- A .swiftformat file generated by SwiftFormat will now always end with a linebreak
0.35.3 (2018-08-21)
- Added
--closingparenoption for finer control over function argument wrapping - Fixed bug in wraparguments/collections options inference
- Skipped files are now logged when running with the
--verboseoption - SwiftFormat no longer mangles XCUITest tokens in comments by introducing spaces
- Dictionary values wrapped onto a different line from the key are now indented correctly
- Fixed a bug where automatic removal of spaces around range operators could introduce ambiguity
- Disabled ANSI formatting for non-terminal output
- Fixed typo in command-line help
0.35.2 (2018-08-10)
- Fixed a bug where
--rulescommand incorrectly showed all rules as disabled - Added close button to SwiftFormat for Xcode application window
0.35.1 (2018-08-08)
- Added support for hierarchical config files with a standard naming convention (see README for details)
- You can now specify excluded file paths and file options such as
--symlinksin configuration files - Standard .swiftformat configuration files are now visible in the SwiftFormat for Xcode open/save dialogs
- The .swiftformat configuration file can now contain comments, which are marked using a hash (#) character
- Improved cache invalidation. It should no longer be necessary to disable the cache in some cases
- Removed Indent from the SwiftFormat for Xcode options, as this is configured using Xcode project settings
- Fixed indent inference (really this time!)
0.35.0 (2018-08-04)
- Added
--configargument for loading an external config file using the command-line tool - The
--inferoptionscommand can now write the result to a config file using the--outputoption - Added
emptyBracesrule for removing blank lines inside empty{}pairs - Fixed handling of spaces and other special characters inside the
--headeroption when using config files - Fixed parsing and serialization of
--headeroption in Xcode Source Editor Extension - Fixed a bug in the
specifiersrule affecting enum cases whose name matches a specifier - Fixed bug where
redundantSelfcould incorrectly removeselffrom a closure instead a case with awhereclause - Fixed indent inference, which would previously calculate the wrong indent value
0.34.1 (2018-08-01)
- Added
// swiftformat:disable:nextdirective for temporarily disabling a rule on just the following line - Fixed bug where the
// swiftformat:disable alldirective could result in file contents being stripped - Fixed a bug where
--verbosemode incorrectly reported which rules were applied to each file - Reset to Defaults menu item in SwiftFormat for Xcode now correctly resets the Infer Format Options setting
0.34.0 (2018-07-30)
- You can now configure format options for the Xcode Source Editor Extension (big thanks to @vinceburn for this feature)
- Restored ability to build the swiftformat command-line app using Xcode 9.2 on macOS Sierra
- Xcode Source Editor Extension no longer fails when using Playgrounds with multiple pages
- The
--wrapelementssoption has been renamed to--wrapcollections - Added new
--wraparguments preserveand--wrapcollections preserveoptions - Added
--fractiongrouping&--exponentgroupingoptions - Improved formatting of Xcode Source Editor Extension error messages
- Fixed a bug where parens were incorrectly removed after an image literal
0.33.13 (2018-07-25)
- Fixed bug where required parens were incorrectly removed from around a closure type
- Added
--lintmode that is similar to--dryrunbut returns a non-zero exit code if any files require formatting - The swiftformat command-line tool now returns a non-zero exit code in the event of a fatal error while formatting
0.33.12 (2018-07-23)
- Added
swiftformat:disable allandswiftformat:enable alldirectives - Fixed a bug where redundant parens were not always removed correctly
- Fixed errors when parsing custom operators such as
<>,|>or<<>> - Fixed divide-by-zero crash when specifiying number groupings with a value of zero
- Rules are now always applied in alphabetical order to ensure consistency
- Fixed the
--conflictmarkerscommand-line option
0.33.11 (2018-07-05)
- Fixed a bug where
--inferoptionswould always set--selfto "insert" (this also affected the Xcode extension) - Fixed bug with
redundantSelfwhen parsing nested switch statements - Fixed a bug in the
redundantParensrule that incorrectly removed parens after an indexed tuple (e.g.foo.1(bar)) - Spaces are now correctly removed around parens or square brackets after an indexed tuple
0.33.10 (2018-07-03)
- Fixed a bug where
sortedImportsrule could strip code betweenimportstatements - Fixed a case where
selfwas removed incorrectly inside a switch case condition
0.33.9 (2018-07-01)
- Fixed incorrect formatting of
!=operator when used as a function reference - Fixed some additional cases where
selfwas not inserted or removed correctly
0.33.8 (2018-06-25)
- Fixed issue where
selfcould be incorrectly inserted inside awhereclause - Fixed a bug where generics could be misidentified as greater-than / less-than operators
- Fixed formatting of
#ifblocks around case statements - The
hoistPatternLetrule no longer hoists thelet orvar` when there are no named variables - Fixed nondeterministic behavior when applying spacing rules
- Fixed warning when compiling with Xcode 10 beta
0.33.7 (2018-05-18)
- Fixed an issue where headerdoc comments could be stripped by
fileHeaderrule - Fixed a bug with handling absolute paths
0.33.6 (2018-04-18)
- Fixed a bug where a space could be incorrectly removed after a
try?oras?operator - Both the SwiftFormat command line tool and framework can now be built using Swift Package Manager
- Added .pre-commit-hook.yaml file for checking that formatter has been applied when committing
- The SwiftFormat command line tool can now be installed using Mint (see README for details)
0.33.5 (2018-03-16)
- Fixed critical bug in
sortedImportswhere code between blocks of import statements could be removed - Fixed bug where wrapped arguments could be double-indented under some circumstances
0.33.4 (2018-02-26)
- Fixed a bug in the
unusedArgumentsrule that could caused type names to get mangled in closure argument lists - Fixed bug in
sortedImportsthat could cause import statement to be moved above the file header comment
0.33.3 (2018-02-21)
- Fixed a bug in the
duplicateImportsrule that caused imports of specific types from the same module to be incorrectly stripped - Fixed bugs with how the
duplicateImportsandsortedImportsrules handle imports separated by semicolons or spanning multiple lines - Fixed a bug with
redundantParensrule incorrectly removing parens around tuples whose first and last elements were closures - Fixed a bug where the
redundantParensrule incorrectly removed parens inside compound expressions
0.33.2 (2018-02-20)
- The
fileHeaderrule can now be disabled in an individual file by prefixing header with// swiftformat:disable fileHeader - Fixed a bug in the
specifiersrule that could mangle code if the previous line ended with certain identifiers - Fixed typo in
--insertlinesdeprecation warning message
0.33.1 (2018-02-10)
- Fixed bug preventing host app rule configuration from being read by the Xcode extension
- Added
duplicateImportsrule for removing duplicate import statements automatically - Deprecated
--insertlines/--removelinesoptions - enable or disable the specific rules instead - Fixed deprecation warnings in Swift 4.1 / Xcode 9.3
0.33.0 (2018-02-01)
- Added rules configuration UI to the Xcode Source Editor Extension (thanks @vinceburn and @tonyarnold!)
- Added
blankLinesAtStartOfScoperule for removing leading blank lines at the start of functions, classes, etc - Fixed indenting of blank lines within commented code blocks
- Added CONTRIBUTING.md
0.32.2 (2018-01-12)
- Fixed bug with parsing spaces inside interpolated values in multiline string literals
- Added instructions for using SwiftFormat on a CI server with Danger
0.32.1 (2017-12-07)
- Added
--dryrunoption, for testing SwiftFormat without making any file changes - Fixed Xcode plugin, which was not deployed correctly in the previous release
- Fixed
spaceAroundOperatorsrule not inserting space after a switch case or default clause colon
0.32.0 (2017-11-29)
- Added
swiftformat:comment directives for enabling/disabling rules inside a source file (see README for details) - Added
blankLinesAroundMarkrule, which inserts a blank line before and after a// MARK:comment - When using the
--self insertoption,selfis now inserted automatically in more places than it could be before - Fixed some bugs in the
redundantSelfrule that causedselfnot to be removed in some cases when it should - Exposed the command-line formatting functions as part of the public API when using the SwiftFormat framework
0.31.0 (2017-11-24)
- Switched to a more conventional MIT license
- Added
strongOutletsrule that removes weak from@IBOutletproperties in accordance with Apple guidelines - Added
sortedImportsrule for sortingimportstatements alphabetically - Fixed warnings in Xcode 9.1 and dropped support for compiling framework with Swift 3.1
- Fixed a bug where a double quote was incorrectly inserted into multiline strings
- Fixed a bug where the
--comments ignoreoption was ignored for comments insideswitchstatements - Code that has been temporarily commented out should no longer be re-indented
0.30.2 (2017-11-19)
- Fixed incorrect indenting of case statements for cases with
whereclauses containing<operator - Fixed bug where parens were incorrectly removed around closures in loop or branch conditions
- Added compatibility workaround for
selfbeing incorrectly removed in tests that use the Nimble framework
0.30.1 (2017-11-10)
- Fixed error when parsing a subscript with default value inside a
switchstatement - Nil default values are no longer removed inside
Codablestructs/classes, as this can break the implementation
0.30.0 (2017-10-27)
- Space is now inserted between the operator name and opening paren in an operator function declaration
- Added
--operatorfuncoption to control whether operator should be followed by a space in a function declaration - Added
--elsepositionoption to control whetherelse,catch&whileshould appear on same line as preceding} - Added
--indentcaseoption to control whethercasestatements should be indented inside aswitch - Comments immediately before a
default:clause are now indented level with thedefaultkeyword - Fixed bug where backticks would be incorrectly removed when using
Anyas an identifier - Error messages are now displayed correctly in the Xcode editor extension
- Added test coverage statistics using Slather and Coveralls
0.29.9 (2017-10-22)
- Fixed critical bug where
hoistPatternLetrule could corrupt tuples in a switch case clause - Comments immediately before a case statement are now indented level with the case
0.29.8 (2017-10-11)
- Fixed bug where space was incorrectly removed around postfix/suffix range operators
0.29.7 (2017-10-08)
- Added support for Swift 4 keyPath syntax
0.29.6 (2017-09-21)
- Fixed bug in
hoistPatternLetrule when formattingcase letpatterns with outer parens - The
redundantParensrule now correctly removes the outer parens in the aforementioned case - Fixed performance regression introduced in 0.29.5
0.29.5 (2017-09-04)
- Fixed bounds crash when parsing an empty string literal at the end of a file
- SwiftFormat now compiles without modification in Xcode 9 using Swift 3.2 or 4.0
0.29.4 (2017-08-21)
- Fixed a bug where
selfcould be incorrectly inserted if local variable is declared inside an#ifblock
0.29.3 (2017-07-31)
- Added support for Swift 4's multi-line string literal syntax
- Fixed a bug with handling inline comments inside an array literal
0.29.2 (2017-07-03)
- Fixed critical bug where space was incorrectly inserted around unary range operators
- Fixed bug where
selfcould be incorrectly inserted beforetype(of:)if using--self insertoption - Fixed space being incorrectly inserted after postfix operator inside a subscript or collection literal
- Wrapped
case is Typestatements are now indented correctly
0.29.1 (2017-06-29)
- Fixed bug where
redundantInitrule removed a required init in some cases
0.29.0 (2017-06-20)
- Changed specifier order from
private(set) publictopublic private(set) - Added
redundantInitrule to remove explictinitreferences where they aren't needed - Fixed indentation of class declarations with protocols wrapped onto multiple lines
0.28.6 (2017-05-31)
- Fixed bug where consecutive
ifstatements containing<and>were misidentified as a generic argument list - Fixed space being removed between a closure capture list and subsequent arguments under some circumstances
- Fixed extra space added before prefix operators inside brackets or parens
0.28.5 (2017-05-14)
- The
redundantParensrule no longer removes parens after a function call inside awhereclause - Fixed bug where nil default value was incorrectly removed from lazy var declarations
0.28.4 (2017-04-26)
- Fixed bug where
selfwas incorrectly inserted inside anif case letcondition - Fixed incorrect insertion of
selfinside a pattern let clause
0.28.3 (2017-04-20)
- Fixed bug where
selfwas incorrectly removed in a closure immediately after a var declaration - Fixed incorrect insertion of
selfbefore a subscriptgetorsetblock - Fixed incorrect insertion of
selfafter animport classstatement - Fixed bug where
selfwas not inserted after a return statement
0.28.2 (2017-03-30)
- Fixed error when parsing an
enumdeclaration inside aswitchstatement - Fixed incorrect removal of backticks when accessing an overloaded
Typemember
0.28.1 (2017-03-28)
- Fixed a bug where
redundantSelfrule incorrectly removedselfafter arepeat...whileloop - Fixed some bugs where
--self insertoption wrongly addedselfin places it shouldn't have - Improved the documentation of rules and options in the README file and command-line help
0.28.0 (2017-03-24)
- Added
--self insertoption to optionally insertselfwhen accessing member variables/functions - The
--selfand--stripunusedargsarguments can now be inferred automatically using--inferoptions - SwiftFormat now detects and rejects source files that contain merge conflict markers
- Added
--conflictmarkersoption to optionally ignore conflict markers (e.g. if they clash with a custom operator) - The
redundantSelfrule now correctly stripsselffrom computed var setters and getters - The
redundantSelfrule now handles static and class variables/functions correctly - Fixed a potential bug where command-line tool might get stuck in an infinite loop
- Fixed a bug where a invalid source code could causes variables to be incorrectly removed
- Fixed some bugs in error reporting
0.27.1 (2017-03-21)
- Fixed trailing space that was incorrectly added to blank lines when
redundantSelfrule is disabled - Fixed a bug where
selfcould be incorrectly removed when using nested function declarations - Fixed a bug where
selfcould be incorrectly removed inside class functions - Improved formatting and inferoptions performance
0.27.0 (2017-03-17)
- Added
--excludecommand-line option for excluding specific files or folders from formatting - Improved grouping and logging of formatting errors when running in
--verbosemode - Fixed a bug when using prefix operators with with shorthand class or enum members like
-.someValue - Fixed some more cases where
selfwas incorrectly removed, or wasn't removed when it should have been - Fixed some cases where backtick escaping was incorrectly removed around reserved words
- Fixed a bug where
--patternlet inlinecould incorrectly moveletinside a tuple assignment - Fixed parsing of custom operators containing chevrons, e.g.
<?> - Fixed redundant
returnnot being removed from closures in a var declaration - Fixed a performance regression introduced in version 0.26.2
- Fixed bug where
Void()literal was replaced by()()when using--empty tuple
0.26.2 (2017-03-15)
- Fixed critical bug where
returnwas incorrectly removed after a#selectoror#keyPathdirective - Fixed several more critical cases where
selfcould be incorrectly removed - Fixed case where identifier could be mistaken for a keyword after
selfwas removed - Fixed some cases where
selfshould have been removed but wasn't - Added tvOS support to the podspec
0.26.1 (2017-03-14)
- Fixed critical bug where
selfcould be incorrectly removed inside lazy var declarations
0.26.0 (2017-03-13)
- Added
redundantSelfrule for removing theselfprefix from member references in cases where it isn't needed - Added
--verbosecommand-line option for tracking which rules were applied to each file - Added
--patternletcommand-line option for toggling behavior of thehoistPatternLetrule - Fixed bug where escaped arguments were treated as unused
- Fixed some
unusedArgumentscases - The
redundantBackticksrule now handles more cases
0.25.2 (2017-03-09)
- Fixed bug where
returnkeyword could be incorrectly removed inside a conditional statement - Fixed bug where backtick escaping would be incorrectly removed from
Self
0.25.1 (2017-03-08)
- Fixed bug where unused arguments in a failable initializer could be incorrectly formatted
- Fixed bug where backtick escaping would be incorrectly removed from certain reserved identifiers
0.25.0 (2017-03-07)
- The
stripHeadersrule is nowfileHeaders, which can strip or replace header comments with a template (see README) - Added
hoistPatternLetrule that movesletandvarto the beginning ofswitch/casepatterns - Added
redundantReturnrule that strips thereturnkeyword from single-line closures - Added
redundantBackticksrule that removes unnecessary backtick escaping of keywords
0.24.7 (2017-02-28)
- Fixed a bug where switch cases containing a
..<operator were parsed incorrectly, resulting in wrong indentation - Fixed a potential bug where source code could be truncated after an error when running with
--fragmentenabled - Command-line tool installation via CocoaPods no longer requires a minimum deployment target of iOS 9 / macOS 10.11
0.24.6 (2017-02-16)
- Fixed critical bug where automatic removal of Void return type in closures could alter the type signature
- Command-line tool can now be installed via CocoaPods
0.24.5 (2017-02-12)
- Fixed critical bug where trailing commas were incorrectly added to array or dictionary type declarations
0.24.4 (2017-02-09)
- Fixed format rules not being applied when processing input from stdin
- Fixed allman brace formatting of optional computed vars
- Allman brace rule now removes the blank line immediately after an opening brace
0.24.3 (2017-01-26)
- Fixed critical bug where unused
inoutclosure arguments were mangled - Fixed critical bug where comma was incorrectly inserted into subscript expressions
- Fixed critical bug where functions named "get" could be incorrectly stripped
- Unused arguments are now handled correctly in
initandsubscriptfunctions - Fixed bug where
_was doubled up for unused closure arguments
0.24.2 (2017-01-20)
- Unused arguments are now handled correctly in non-Void functions
- Fixed another bug where keywords used as function argument names were not parsed correctly
- Fixed bug when parsing generics containing a
&protocol-combining operator - Fixed bug where parsing error location was reported incorrectly
0.24.1 (2017-01-19)
- Fixed crash in Xcode extension when formatted file has no changes
- Fixed caching bug that meant enabled/disabled rules were not taken into account
- Unix shebang/hashbang directive at start of a source file is no longer treated as an error
0.24 (2017-01-18)
- Fixed a critical bug where closure arguments could be mangled by the
unusedArgumentsrule - Added
trailingClosuresrule, to automatically convert closure arguments to trailing closure syntax - Added
--enableoption to enable optional rules such astrailingClosures(which is disabled by default) - Added
--stripunusedargsoption to provide more fine-grained control of theunusedArgumentsrule - Added
--decimalgrouping,--hexgrouping,--binarygroupingand--octalgroupingoptions - Added
--exponentcaseoption for controlling the case of "e" in exponential literals, e.g.3.4e-5 - Merged
hexLiteralsrule into newnumberFormattingrule that handles case and grouping of numbers - Renamed
--hexliteralsoption to--hexliteralcase - The
voidrule now converts(_: Void)to()automatically - The
redundantParensrule now removes empty()before a trailing closure - Fixed some bugs with floating-point hex literal support
- Fixed bug where keywords used as function argument names were not parsed correctly
- Added Swift Package Manager support
0.23.1 (2017-01-14)
- Fixed critical bug where closure return types could be mangled by the
unusedArgumentsrule - Fixed issue where console text appeared as black instead of the user's chosen default color
0.23 (2017-01-09)
- You can now specify a whitelist of specific rules to apply using the
--rulesoption - Input files are now processed concurrently, yielding a ~2x speed improvement
- SwiftFormat now continues if it encounters an error when processing multiple files
- Improved error messaging, and added color-coding to the command-line output
--inferoptionsnow accepts multiple space-delimited file paths, or piped input, just like formattingredundantVoidReturnTypenow removes Void return from closures as well as ordinary functionsunusedArgumentsnow works on closures as well as ordinary functionsunusedArgumentsis now more effective at detecting when an argument is unused- Fixed crash in
wrapArgumentsrule due to linebreak being incorrectly removed after a single-line comment - Format rules displayed using the
--rulesoption are now sorted alphabetically
0.22 (2017-01-03)
- Fixed critical bug where
>=operator was misidentified as end of generic argument list - Added
redundantRawValuesrule to remove string enum literals that match the associated case name - Added
redundantVoidReturnTyperule to remove unnecessaryVoidreturn type from function declarations - Added
unusedArgumentsrule, to replace unused arguments in function declarations with an underscore - Fixed bug with
--inferoptionsand argument wrapping - Fixed bug where extra space was added inside empty
TODO:comments
0.21 (2016-12-19)
- Added
redundantLetrule to remove unnecessaryletkeyword in statements likelet _ = foo() - Added
redundantPatternrule to simplify wildcard patterns like.foo(_, _)to just.foo - Rules are now run repeatedly until no changes are detected, fixing an issue where changes could be missed
- Fixed a bug where extra space was inserted between
?and.in optional chaining expressions - A space is no longer added between a comment and the following comma
- Fixed some performance regressions
0.20 (2016-12-09)
- Added
redundantNilInitrule, to remove unnecessary nil initialization of Optional vars - The
trailingCommasrule now removes trailing commas for inline array literals - Fixed bug in
voidrule when handling chains of throwing functions - Fixed some performance regressions
0.19 (2016-12-02)
- Fixed a critical bug where
redundantParensrule failed to insert space before a prefix operator - Fixed a crash when encountering generic arguments followed by ...
- Added
--disableoption for individually disabling rules without needing to recompile - Added
--rulescommand to display all the supported rules (useful in conjunction with--disable) - Added
--wrapargumentsoption for controlling how function arguments are wrapped - Added
--wrapelementsoption for controlling how array and dictionary elements are wrapped - Added
--symlinksoption for specifying if symlinks/aliases should be followed and formatted - Fixed bug where symlinks to Swift files would be replaced by a copy of the file
0.18 (2016-11-17)
- Added
--inferoptionscommand line argument for auto-configuring format options from existing source - Added
--ifdefcommand line argument for controlling how#if...#endifclauses are indented - Added
--hexliteralscommand line argument for specifying the case to use for hex literals - Added
redundantGetrule to remove unneededget {}clause in read-only computed properties - Fixed bug where
redundantParensrule merged identifiers on either side of a removed paren redundantParensnow removes unneeded parens from expressions and closure arguments
0.17.2 (2016-11-11)
- Fixed critical bug with
redundantParensrule removing required parens around a closure - Fixed bug with indenting of wrapped closures after a var declaration
0.17.1 (2016-11-09)
- Xcode Source Editor Extension now works with Playground files
- Fixed operator being incorrectly formatted when file ends with a single-line comment
- Fixed bug where the space at the start of a single line comment could increase after each format
- Fixed bug where
--cache clearjust ignored cache without actually clearing it - Added
--cache ignoreoption, which replicates previous--cache clearbehavior
0.17 (2016-11-08)
- Added cache, allowing SwiftFormat to skip formatting for files that haven't changed
- Added
stripHeadersrule to remove Xcode's copyright header comments (off by default) - Disabled
linebreakAtEndOfFilerule when formatted text is a fragment - Fixed bug where generics were wrongly formatted if followed by a greater-than sign in the same file
- Fixed space incorrectly added after
#available,#colorLiteral, etc - Fixed several bugs with indenting of blocks containing wrapped lines
0.16.4 (2016-11-07)
- SwiftFormat is now ~3X faster!
- Fixed bug with spacing after an
@convention()attribute - Fixed bug where the space at the start of a multi-line comment could increase after each format
- Fixed bug where wrong indent was applied to wrapped array literal values
- Fixed bug where K&R indenting would remove the linebreak before an inline block
0.16.3 (2016-11-03)
- Fixed bug with operators containing chevrons
- Fixed wrong indent after where statement in switch case
0.16.2 (2016-11-03)
- Fixed bug with spacing of deeply nested generic arguments, or generic operator functions
- Fixed spacing of
@autoclosure(escaping)syntax (only used in Swift 2.2) - Fixed bug where
(Void) throws -> Voidwas handled incorrectly
0.16.1 (2016-11-03)
- Fixed critical bug where
redundantParenswould remove parens from tuple inswitchcondition - Fixed incorrect spacing around attributes that have arguments, e.g.
@convention(block) --comments ignorecommand line option now disables leading space insertion in single-line comments
0.16 (2016-11-02)
- Added
redundantParensrule to remove parens aroundif,whileandswitchconditions - Added ability to specify multiple file paths for processing in a single command
- Fixed a bug with the formatting of
repeat ... whileloops - Added performance tests
- API refactoring
0.15 (2016-10-27)
- Added
allmancommand line option to enable Allman-style indenting instead of default K&R style - Added
removelinescommand line option to disable automatic removal of blank lines - Added
insertlinescommand line option to disable automatic blank line insertion - Added
trimwhitespacecommand line option for disabling truncation of blank lines - Added
commentscommand line option for disabling indenting of comments - Added
experimentalcommand line option for opting-in to bleeding-edge features - Fixed broken
commascommand line option from version 0.14 - Made
blankLinesBetweenScopesrule less aggressive
0.14 (2016-10-21)
- Xcode Source Editor Extension now automatically infers formatting options from the file
- Wrapped function arguments and array/dictionary literal value indenting now works more like Xcode
- Added
voidrule for normalizing howVoidreturn values are represented - Added
emptycommand line option for configuring the void rule - Added
commascommand line option for disabling trailing commas - Improved formatting of fragments containing unbalanced braces
0.13 (2016-10-17)
- Added Xcode Source Editor Extension (thanks @tonyarnold!)
- Fixed indenting of the line after a return statement (which is treated as the return value)
0.12.1 (2016-10-14)
- Fixed stripping of space after
@escaping,@autoclosureandinout - Fixed stripping of trailing linebreaks when using --fragment option
0.12 (2016-10-08)
- Linewrapped
caseelements are now vertically aligned - The
elsekeyword in aguardstatement is no longer indented - The
elseOnSameLinerule is no longer applied if previous `} is not on its own line - Fixed handling of
caseafter comma in anifstatement - Added support for formatting partial file fragments
- Reduced compilation time by ~500ms
0.11.4 (2016-10-05)
- Fixed critical bug where optionals with a default value were not handled correctly
- Fixed rare bug where code would be incorrectly indented after a custom operator declaration
0.11.3 (2016-10-04)
- Fixed spacing between closure capture list and arguments
- Fixed incorrect indenting of closures after an
ifstatement, and other braced clauses
0.11.2 (2016-10-04)
- Fixed incorrect indenting of closures inside
forloops, and other braced clauses
0.11.1 (2016-10-04)
- Fixed incorrect wrapping of chained closures
- Improved the logic for wrapped lines; now behaves more like Apple's implementation
- Fixed some bugs in command line tool when file paths contain escaped characters
0.11 (2016-09-24)
- Fixed handling of
prefixandpostfixspecifiers - Fixed bug where trailing comma was added to empty array or dictionary literal
- Fixed bug where trailing whitespace was added at the start of doc comments
- Improved correctness of numeric literal parsing
- Converted to Swift 3 syntax
0.10 (2016-09-18)
- The
blankLinesAtEndOfScoperule no longer removes trailing blank lines if immediately followed by other code - The
blankLinesBetweenScopesrule now adds a blank line after a scope as well as before it - The
blankLinesBetweenScopesrule no longer affects single-line functions, classes, etc. - Fixed formatting of
while caseandfor case ... instatements - Fixed bug when using
switchas an identifier inside aswitchstatement - Fixed parsing of numeric literals containing underscores
- Fixed parsing of binary, octal and hexadecimal literals
0.9.6 (2016-09-16)
- Fixed parsing error when
switchstatement is followed byenum - Fixed formatting of
guard casestatements
0.9.5 (2016-09-14)
- Fixed a number of cases where the use of keywords as identifiers was not being handled correctly
0.9.4 (2016-09-14)
- Fixed bug where parsing would fail if a
switch/casestatement containeddefaultorcaseidentifiers (valid in Swift 3)
0.9.3 (2016-09-12)
- Fixed bug where functions would be prefixed with an additional blank line if the preceding line had a trailing comment
0.9.2 (2016-09-09)
- Fixed bug where
caseexpressions containing a colon would not be parsed correctly
0.9.1 (2016-09-08)
- Fixed bug where
trailingCommasrule would place comma after a comment instead of before it
0.9 (2016-09-07)
- Added
blankLinesBetweenScopesrule that adds a blank line before each class, struct, enum, extension, protocol or function - Added
specifiersrule, for normalizing the order of access modifiers, etc - Fixed indent bugs when wrapping code before or after a
whereorelsekeyword - Fixed indent bugs when using an operator as a value (e.g. let greaterThan = >)
0.8.2 (2016-09-01)
- Fixed bug where consecutive spaces would not be removed in lines that appeared after a
//comment - SwiftFormat will no longer try to format code containing unbalanced braces
- Added pre-commit hook instructions
0.8.1 (2016-08-31)
- Fixed formatting of
/*! ... */and//!headerdoc comments, and/*: ... */and//:Swift Playground comments
0.8 (2016-08-31)
- Added new
rangesrules that adds or removes the spaces around range operators (e.g.0 ..< count,"a"..."z") - Added a new
--rangescommand-line option, which can be used to configure the spacing around range operators - Added new
spaceAroundCommentsrule, which adds a space around /* ... */ comments and before // comments - Added new
spaceInsideCommentsrule, which adds a space inside /* ... */ comments and at the start of // comments - Added new
blankLinesAtEndOfScoperule, which removes blank lines at the end of braces, brackets and parens - Removed double blank line at end of file
0.7.1 (2016-08-29)
- Fixed critical bug where failable generic init (e.g.
init?<T>()) was not handled correctly
0.7 (2016-08-28)
- swiftformat command-line tool now correctly handles paths with
\escaped spaces, or paths in quotes - Removed extra space added inside
@objcselectors - Fixed incorrect spacing for tuple bindings
- Fixed space before enum case inside closure
0.6 (2016-08-26)
- Refactored how switch/case is handled, and fixed a bunch of bugs
- Better indenting logic, now handles multiple closure arguments in a single function call
0.5.1 (2016-08-25)
- Fixed critical bug where double unwrap (e.g.
foo??.bar()) was not handled correctly - Fixed bug where
case let .SomeEnumwas not handled correctly
0.5 (2016-08-25)
- swiftformat command-line tool now supports reading from stdin/writing to stdout
- Added new
linebreaksrule for normalizing linebreak characters (defaults to LF) - More robust handling of linebreaks and whitespace within comments
- Trailing whitespace within comments is now stripped, as it was for other lines
0.4 (2016-08-24)
- Added new
semicolonsrule, which removes semicolons wherever it's safe to do so - Added
--semicolonscommand-line argument for enabling inline semicolon stripping - The
todosrule now correctsMARK :toMARK:instead ofMARK: : - Paths containing ~ are now handled correctly by the command line tool
- Fixed some bugs in generics and custom operator parsing, and added more tests
- Removed trailing whitespace on blank lines caused by the
indentrule
0.3 (2016-08-23)
- Fixed several cases where generics were misidentified as operators
- Fixed a bug where a comment on a line before a brace broke K&R indenting
- Fixed a bug where a comment on a previous line caused incorrect indenting for wrapped lines
- Added new
todosrule, for ensuringTODO:,MARK:, andFIXME:comments are formatted correctly - Whitespace at the start of comments is now handled differently, but it shouldn't affect output
0.2 (2016-08-22)
- Fixed formatting of generic function types
- Fixed indenting of
if casestatements - Fixed indenting of
elsewhen separated fromifstatement by a comment - Changed
private(set)spacing to match Apple standard - Added swiftformat as a build phase to SwiftFormat, so I'm eating my own dogfood
0.1 (2016-08-22)
- First release