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