diff --git a/.travis.yml b/.travis.yml index 5534737dc..90da1b8af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,4 @@ language: objective-c -osx_image: xcode8.2 +osx_image: xcode8.3 script: xcodebuild -project SwiftFormat.xcodeproj -scheme "SwiftFormat (Framework)" -sdk macosx diff --git a/CHANGELOG.md b/CHANGELOG.md index b2a57d27f..dc97c78c8 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## [0.28.3](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.28.3) (2017-04-20) + +- Fixed bug where `self` was incorrectly removed in a closure immediately after a var declaration +- Fixed incorrect insertion of `self` before a subscript `get` or `set` block +- Fixed incorrect insertion of `self` after an `import class` statement +- Fixed bug where `self` was not inserted after a return statement + ## [0.28.2](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.28.2) (2017-03-30) - Fixed error when parsing an `enum` declaration inside a `switch` statement diff --git a/CommandLineTool/swiftformat b/CommandLineTool/swiftformat index ac209e527..10fb04ea2 100755 Binary files a/CommandLineTool/swiftformat and b/CommandLineTool/swiftformat differ diff --git a/EditorExtension/Application/Info.plist b/EditorExtension/Application/Info.plist index 719134671..051e321d3 100644 --- a/EditorExtension/Application/Info.plist +++ b/EditorExtension/Application/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.28.2 + 0.28.3 CFBundleVersion $(CURRENT_PROJECT_VERSION) LSMinimumSystemVersion diff --git a/EditorExtension/Extension/Info.plist b/EditorExtension/Extension/Info.plist index a658deffd..06d79b370 100644 --- a/EditorExtension/Extension/Info.plist +++ b/EditorExtension/Extension/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 0.28.2 + 0.28.3 CFBundleVersion $(CURRENT_PROJECT_VERSION) LSMinimumSystemVersion diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib index ae35f01dd..8ba68b185 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftAppKit.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib index 9a8b01b0a..7a63e7b3f 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCore.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib index 296465d5d..152ad06a6 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreData.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib index 04f273978..e0ba6f96e 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreGraphics.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib index ac6ba0c19..dc54106b2 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftCoreImage.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib index 7483621ad..8b2716509 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDarwin.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib index 003b9056f..fb7f20ed9 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftDispatch.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib index 19b400d76..15537a87a 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftFoundation.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib index a1ff554cb..e9d1a51a2 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftIOKit.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib index b58c3bce8..4468a1fd5 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftObjectiveC.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib index 7b2c9fc4a..4abb74861 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftQuartzCore.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib index f20684ee2..3cf96a83c 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Frameworks/libswiftXPC.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist index d3b4bd135..a634c789b 100644 --- a/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist +++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 16D32 + 16E195 CFBundleDevelopmentRegion en CFBundleExecutable @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.28.2 + 0.28.3 CFBundleSupportedPlatforms MacOSX @@ -27,7 +27,7 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 8E162 + 8E2002 DTPlatformVersion GM DTSDKBuild @@ -35,9 +35,9 @@ DTSDKName macosx10.12 DTXcode - 0830 + 0832 DTXcodeBuild - 8E162 + 8E2002 LSMinimumSystemVersion 10.11 NSHumanReadableCopyright diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode b/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode index a97c8e458..1db011d88 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode and b/EditorExtension/SwiftFormat for Xcode.app/Contents/MacOS/SwiftFormat for Xcode differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist index 944402777..cc2a3b8d7 100644 --- a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist +++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 16D32 + 16E195 CFBundleDevelopmentRegion en CFBundleExecutable @@ -17,7 +17,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 0.28.2 + 0.28.3 CFBundleSupportedPlatforms MacOSX @@ -27,7 +27,7 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 8E162 + 8E2002 DTPlatformVersion GM DTSDKBuild @@ -35,9 +35,9 @@ DTSDKName macosx10.12 DTXcode - 0830 + 0832 DTXcodeBuild - 8E162 + 8E2002 LSMinimumSystemVersion 10.11 NSExtension diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat index 0b383bf60..fb8a5c63a 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat and b/EditorExtension/SwiftFormat for Xcode.app/Contents/PlugIns/SwiftFormat.appex/Contents/MacOS/SwiftFormat differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist index ac3f70dd1..8251433bb 100644 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib index abf321e2b..1bbc904f8 100644 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib index 9bb302e9b..312595630 100644 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib index ecdfe2f16..7308e0265 100644 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/ViewController.nib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib index c0081de8b..b13254324 100644 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/libswiftRemoteMirror.dylib b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/libswiftRemoteMirror.dylib index 6f66dd747..d3e6def01 100755 Binary files a/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/libswiftRemoteMirror.dylib and b/EditorExtension/SwiftFormat for Xcode.app/Contents/Resources/libswiftRemoteMirror.dylib differ diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources b/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources index c9ac9c935..f444338a7 100644 --- a/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources +++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources @@ -6,27 +6,27 @@ Resources/Base.lproj/Main.storyboardc/Info.plist - 4/7kh3bSmZELe+14b4KgOTedKss= + pUVlmSRiuDMnBYOeR8ToNVAsWUk= Resources/Base.lproj/Main.storyboardc/MainMenu.nib - xMOIEsz4qNxW73Ir1wG9D/pb8Lw= + COrVwg3CcTMjndM4AiG9qsifpK0= Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib - v5Y/LlTHmMMuKnbg3av4xdycu5U= + BJTRulQZNZEhPB6eGn6kTjGD+ao= Resources/Base.lproj/Main.storyboardc/ViewController.nib - 70MSPvGkXtDuwk6uD1Hz+//T9Fs= + CrIcbhjeOGx07T7fsM4Z7J3jxkQ= Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib - KNdDu1AfzzTX4YQzIMZOT0OeEVY= + 4lk0GVK5qwkqIUGnlkRLSMjxDgI= Resources/libswiftRemoteMirror.dylib - oM6XvS+m270N7giczsdiiy7zgmQ= + cwnvSw1VOaErp/FPWmYj9iCf+lI= files2 @@ -35,7 +35,7 @@ cdhash - N2/y3bxPEhRoS5ERLrh3kJnPpTQ= + 3CgG7dcOOayfXYYtmNGTrnQxaqg= requirement identifier "com.apple.dt.runtime.swiftAppKit" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -44,7 +44,7 @@ cdhash - iS0KpuqxxtNkTj7Gb/sWxr3Mr8o= + XQ2fCPa6QFIzwAS3sOP/cUVR5Q8= requirement identifier "com.apple.dt.runtime.swiftCore" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -53,7 +53,7 @@ cdhash - GDaciwj3iyh5abQTeozJu0YAQmI= + 6qxXOGg8u0BPsMSiLhr83sS6834= requirement identifier "com.apple.dt.runtime.swiftCoreData" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -62,7 +62,7 @@ cdhash - V2+q3IBskaUQ5IOcn4GCmULtS1Y= + RTdZtaV6sUM9pY2P5VdUHwI+PM4= requirement identifier "com.apple.dt.runtime.swiftCoreGraphics" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -71,7 +71,7 @@ cdhash - fxQ2/arY/aOSqdE7TgXFcXXii0Q= + FuyXhpwyonqtUXBYJ2V0QkIK2mk= requirement identifier "com.apple.dt.runtime.swiftCoreImage" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -80,7 +80,7 @@ cdhash - xInpMEvY0ZgZy3sscc63vvK0feI= + REVvHym35ZPZ+qMud+HnmH6wpzM= requirement identifier "com.apple.dt.runtime.swiftDarwin" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -89,7 +89,7 @@ cdhash - cAGqMrEoTHrStlJfulS6Ck1b6Ec= + mH+MrED3Wj9pM/H1YG0h8YIAKww= requirement identifier "com.apple.dt.runtime.swiftDispatch" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -98,7 +98,7 @@ cdhash - yahTEStbSj2XjOiWAvrgWW0cz40= + EBY7dqV3Qnaf2Z25f2u+SsjJ9WM= requirement identifier "com.apple.dt.runtime.swiftFoundation" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -107,7 +107,7 @@ cdhash - uuxh/Ry4KqEQEt9o7YPS1Gy4wds= + pF1M8VAQOblFcRyxJz4gHoXp6yo= requirement identifier "com.apple.dt.runtime.swiftIOKit" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -116,7 +116,7 @@ cdhash - DbrCViMODB8zmvePpmo0uRjWFxk= + aKCZNiB87h0h1GBiBU27O55l2J0= requirement identifier "com.apple.dt.runtime.swiftObjectiveC" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -125,7 +125,7 @@ cdhash - J0/Z+9ny1zl3KdyAADtj6Fk3O0g= + lGj/SBLxl5HCoXIDIxgI2Tjfj7Q= requirement identifier "com.apple.dt.runtime.swiftQuartzCore" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -134,7 +134,7 @@ cdhash - yQDqENXOLz+aHRdCrEZrMzzP6W4= + TB6CLzoUuXqXUVFVUuimQBpTjl4= requirement identifier "com.apple.dt.runtime.swiftXPC" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -143,7 +143,7 @@ cdhash - iF2puP7p2HOEIK7E7WOQFmoLCoQ= + p3BSaS1zG21eDmhNFIf5zXjZXSo= requirement identifier "com.charcoaldesign.SwiftFormat-for-Xcode.SourceEditorExtension" and anchor apple generic and certificate leaf[subject.CN] = "Mac Developer: Nick Lockwood (XDQ4XJZXHD)" and certificate 1[field.1.2.840.113635.100.6.2.1] /* exists */ @@ -152,66 +152,66 @@ hash - 4/7kh3bSmZELe+14b4KgOTedKss= + pUVlmSRiuDMnBYOeR8ToNVAsWUk= hash2 - AfLZXpCXl0CCFhZCTKqWUuJ/ghjSmjWmTIMc6+1hIrM= + y/gKMZwwa++7PNfWIhq6K/c9fdl+kO+Ycz4lCo1TbeU= Resources/Base.lproj/Main.storyboardc/MainMenu.nib hash - xMOIEsz4qNxW73Ir1wG9D/pb8Lw= + COrVwg3CcTMjndM4AiG9qsifpK0= hash2 - cPh/k5xoCqVgrNlKDKtb+Smo1rY/rootQH/GYAwNjW8= + Xk5ThvWJr7VXB6Us9hz7Gq8rUs0WBbLSL1oeW1BQkfY= Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib hash - v5Y/LlTHmMMuKnbg3av4xdycu5U= + BJTRulQZNZEhPB6eGn6kTjGD+ao= hash2 - atQJvKArgTki/amJrGPxBEFWCrABJblpFs3fb7w86rU= + gVQC53diss4ZR+/589IZkYwx5tPyOR8DJLJsI3u5d9s= Resources/Base.lproj/Main.storyboardc/ViewController.nib hash - 70MSPvGkXtDuwk6uD1Hz+//T9Fs= + CrIcbhjeOGx07T7fsM4Z7J3jxkQ= hash2 - XbjCACHrYvX9AKZXdqwl3aqJC3eNVbir3CQf0ywGxQ8= + Ak54GyV48U6XuGTurH4pnx6N1vxEqS9fi5fZIxhVaYI= Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib hash - KNdDu1AfzzTX4YQzIMZOT0OeEVY= + 4lk0GVK5qwkqIUGnlkRLSMjxDgI= hash2 - OPl9O7kTHvODVOLqI2IoLm0bU9rJp4osQtd+NghJfqA= + 0jfUCuNG0DU4VA3/GCGfwlRODrwZsXhbo+71TkInUvw= Resources/libswiftRemoteMirror.dylib hash - oM6XvS+m270N7giczsdiiy7zgmQ= + cwnvSw1VOaErp/FPWmYj9iCf+lI= hash2 - w+IFvQLjqZEH+fABtGvOAwfv7p31NBbKbzaWoOm9WGk= + C8J9UT6G1Y/eS/74xQvzUBsrusLG5S4/gvVNdUSUIBc= diff --git a/README.md b/README.md index 45f8df8cd..dc064ef63 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,27 @@ -[![Travis](https://img.shields.io/travis/nicklockwood/SwiftFormat.svg?maxAge=2592000)](https://travis-ci.org/nicklockwood/SwiftFormat) -[![License](https://img.shields.io/badge/license-zlib-lightgrey.svg?maxAge=2592000)](https://opensource.org/licenses/Zlib) -[![Twitter](https://img.shields.io/badge/twitter-@nicklockwood-blue.svg?maxAge=2592000)](http://twitter.com/nicklockwood) +[![Travis](https://img.shields.io/travis/nicklockwood/SwiftFormat.svg)](https://travis-ci.org/nicklockwood/SwiftFormat) +[![License](https://img.shields.io/badge/license-zlib-lightgrey.svg)](https://opensource.org/licenses/Zlib) +[![Twitter](https://img.shields.io/badge/twitter-@nicklockwood-blue.svg)](http://twitter.com/nicklockwood) Table of Contents ----------------- - [What?](#what-is-this) - [Why?](#why-would-i-want-to-do-that) -- [How To Install](#how-do-i-install-it) - - [Install Via: Command-Line Tool](#command-line-tool) - - [Install Via: Xcode Source Editor Extension](#xcode-source-editor-extension) - - [Install Via: Xcode Build Phase](#xcode-build-phase) - - [Install Via: Git Pre-Commit Hook](#git-pre-commit-hook) -- [How?](#so-what-does-swiftformat-actually-do) -- [Options](#options) -- [Rules](#rules) +- [How?](#how-do-i-install-it) + - [Command-Line Tool](#command-line-tool) + - [Xcode Source Editor Extension](#xcode-source-editor-extension) + - [Xcode Build Phase](#xcode-build-phase) + - [Git Pre-Commit Hook](#git-pre-commit-hook) +- [Usage](#so-what-does-swiftformat-actually-do) + - [Options](#options) + - [Rules](#rules) - [FAQ](#faq) - [Cache](#cache) - [File Headers](#file-headers) - [Known Issues](#known-issues) - [Credits](#credits) + What is this? ---------------- @@ -348,6 +349,8 @@ Here are all the rules that SwiftFormat currently applies, and the effect that t - `--header strip`: removes all automated comment header blocks - `--header "Copyright Text {year}"`: replaces all automated comment header blocks with the text specified + See the File Headers section below for more information. + ***hoistPatternLet*** - moves `let` or `var` bindings inside patterns to the start of the expression, or vice-versa. Use the `--patternlet` command-line option to toggle between hoisted and inline style. ```diff @@ -942,9 +945,11 @@ And the `{year}` token will be automatically replaced by the current year whenev Known issues --------------- +* When using the `--self remove` option, the `redundantSelf` rule will remove references to `self` in autoclosure arguments, which may change the meaning of the code, or cause it not to compile. Currently, the only workaround is to use `--disable redundantSelf` to disable the rule for any affected files. If you are using the `--self insert` option then this is not an issue. + * The `--self insert` option can only recognize locally declared member variables, not ones inherited from superclasses or extensions, so it cannot insert missing `self` references for those. Note that the reverse is not true: `--self remove` should remove *all* redundant `self` references. -* The `trailingClosures` rule will sometimes generate ambiguous code that breaks your program. For this reason, the rule is disabled by default. It is recommended that you apply this rule manually and review the changes, rather than including it in an automatic formatting process. +* The `trailingClosures` rule will sometimes generate ambiguous code that breaks your program. For this reason, the rule is disabled by default. It is recommended that you apply this rule manually and review the changes, rather than including it in an automated formatting process. * Under rare circumstances, SwiftFormat may misinterpret a generic type followed by an `=` sign as a pair of `<` and `>=` expressions. For example, the following case would be handled incorrectly: diff --git a/Sources/Info.plist b/Sources/Info.plist index 037daa394..aaccf8d86 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.28.2 + 0.28.3 CFBundleSignature ???? CFBundleVersion diff --git a/Sources/Rules.swift b/Sources/Rules.swift index 94de5b6a8..a27fee039 100644 --- a/Sources/Rules.swift +++ b/Sources/Rules.swift @@ -590,7 +590,7 @@ extension FormatRules { .keyword("struct"), .keyword("extension"), .keyword("enum"): - isSpaceableScopeType = true + isSpaceableScopeType = (formatter.last(.nonSpaceOrCommentOrLinebreak, before: i) != .keyword("import")) case .keyword("func"), .keyword("var"): isSpaceableScopeType = false case .startOfScope("{"): @@ -749,8 +749,11 @@ extension FormatRules { switch token { case let .keyword(string): switch string { - case "class", "struct", "enum", "protocol", "extension", - "var", "func", "init", "subscript", + case "class", "struct", "enum", "protocol", "var", "func": + if formatter.last(.nonSpaceOrCommentOrLinebreak, before: i) != .keyword("import") { + return false + } + case "extension", "init", "subscript", "if", "switch", "guard", "else", "for", "while", "repeat", "do", "catch": @@ -1434,6 +1437,7 @@ extension FormatRules { .keyword("if"), .keyword("case"), .keyword("switch"), + .keyword("import"), ] if disallowed.contains(prevKeyword) { break diff --git a/Sources/SwiftFormat.swift b/Sources/SwiftFormat.swift index c1dab4d12..8ebee4d2f 100644 --- a/Sources/SwiftFormat.swift +++ b/Sources/SwiftFormat.swift @@ -32,7 +32,7 @@ import Foundation /// The current SwiftFormat version -public let version = "0.28.2" +public let version = "0.28.3" /// An enumeration of the types of error that may be thrown by SwiftFormat public enum FormatError: Error, CustomStringConvertible { diff --git a/SwiftFormat.podspec.json b/SwiftFormat.podspec.json index f708fd6b0..65e4453ba 100644 --- a/SwiftFormat.podspec.json +++ b/SwiftFormat.podspec.json @@ -1,6 +1,6 @@ { "name": "SwiftFormat", - "version": "0.28.2", + "version": "0.28.3", "license": { "type": "zlib", "file": "LICENCE.md" @@ -10,7 +10,7 @@ "authors": "Nick Lockwood", "source": { "git": "https://github.com/nicklockwood/SwiftFormat.git", - "tag": "0.28.2" + "tag": "0.28.3" }, "default_subspecs": "Core", "subspecs": [ diff --git a/Tests/Info.plist b/Tests/Info.plist index b429de3a1..633553474 100644 --- a/Tests/Info.plist +++ b/Tests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.28.2 + 0.28.3 CFBundleSignature ???? CFBundleVersion diff --git a/Tests/PerformanceTests.swift b/Tests/PerformanceTests.swift index d2095d579..2e38f403e 100644 --- a/Tests/PerformanceTests.swift +++ b/Tests/PerformanceTests.swift @@ -26,14 +26,12 @@ class PerformanceTests: XCTestCase { func testTokenizing() { let files = PerformanceTests.files - var tokens = [[Token]]() + var tokens = [Token]() measure { - tokens = files.map { tokenize($0) } + tokens = files.flatMap { tokenize($0) } } - for tokens in tokens { - if let token = tokens.last, case let .error(msg) = token { - XCTFail("error: \(msg)") - } + for case let .error(msg) in tokens { + XCTFail("error: \(msg)") } }