diff --git a/CHANGELOG.md b/CHANGELOG.md index d59826256..caa49d8f8 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## [0.31.0](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.31.0) (2017-11-24) + +- Switched to a more conventional MIT license +- Added `strongOutlets` rule that removes weak from `@IBOutlet` properties in accordance with Apple guidelines +- Added `sortedImports` rule for sorting `import` statements 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 ignore` option was ignored for comments inside `switch` statements +- Code that has been temporarily commented out should no longer be re-indented + ## [0.30.2](https://github.com/nicklockwood/SwiftFormat/releases/tag/0.30.2) (2017-11-19) - Fixed incorrect indenting of case statements for cases with `where` clauses containing `<` operator diff --git a/CommandLineTool/main.swift b/CommandLineTool/main.swift index 52aabd3b0..c1797f019 100644 --- a/CommandLineTool/main.swift +++ b/CommandLineTool/main.swift @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 12/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation diff --git a/CommandLineTool/swiftformat b/CommandLineTool/swiftformat index 169bde2e1..91928ee51 100755 Binary files a/CommandLineTool/swiftformat and b/CommandLineTool/swiftformat differ diff --git a/EditorExtension/Application/AppDelegate.swift b/EditorExtension/Application/AppDelegate.swift index f39875d61..0c3e87738 100644 --- a/EditorExtension/Application/AppDelegate.swift +++ b/EditorExtension/Application/AppDelegate.swift @@ -5,28 +5,28 @@ // Created by Tony Arnold on 5/10/16. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Cocoa diff --git a/EditorExtension/Application/Info.plist b/EditorExtension/Application/Info.plist index a8e75593f..ee5b852af 100644 --- a/EditorExtension/Application/Info.plist +++ b/EditorExtension/Application/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.30.2 + 0.31.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) LSMinimumSystemVersion diff --git a/EditorExtension/Application/ViewController.swift b/EditorExtension/Application/ViewController.swift index 6fc241674..a7d66b00f 100644 --- a/EditorExtension/Application/ViewController.swift +++ b/EditorExtension/Application/ViewController.swift @@ -5,28 +5,28 @@ // Created by Tony Arnold on 5/10/16. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Cocoa diff --git a/EditorExtension/Extension/CommandErrors.swift b/EditorExtension/Extension/CommandErrors.swift index 2199bf9ee..98d3e6da6 100644 --- a/EditorExtension/Extension/CommandErrors.swift +++ b/EditorExtension/Extension/CommandErrors.swift @@ -5,28 +5,28 @@ // Created by Tony Arnold on 6/10/16. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIY license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // enum FormatCommandError: Error, CustomStringConvertible { diff --git a/EditorExtension/Extension/FormatEntireFileCommand.swift b/EditorExtension/Extension/FormatEntireFileCommand.swift index f3ddfcdc3..d69ae5489 100644 --- a/EditorExtension/Extension/FormatEntireFileCommand.swift +++ b/EditorExtension/Extension/FormatEntireFileCommand.swift @@ -5,28 +5,28 @@ // Created by Tony Arnold on 5/10/16. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation @@ -64,7 +64,7 @@ class FormatEntireFileCommand: NSObject, XCSourceEditorCommand { guard let lastLine = invocation.buffer.lines.lastObject as? String else { return completionHandler(FormatCommandError.invalidSelection) } - let position = XCSourceTextPosition(line: invocation.buffer.lines.count - 1, column: lastLine.characters.count) + let position = XCSourceTextPosition(line: invocation.buffer.lines.count - 1, column: lastLine.count) let updatedSelectionRange = XCSourceTextRange(start: position, end: position) invocation.buffer.selections.add(updatedSelectionRange) diff --git a/EditorExtension/Extension/FormatSelectedSourceCommand.swift b/EditorExtension/Extension/FormatSelectedSourceCommand.swift index ae96ba668..2a45314b9 100644 --- a/EditorExtension/Extension/FormatSelectedSourceCommand.swift +++ b/EditorExtension/Extension/FormatSelectedSourceCommand.swift @@ -5,28 +5,28 @@ // Created by Tony Arnold on 5/10/16. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation diff --git a/EditorExtension/Extension/Info.plist b/EditorExtension/Extension/Info.plist index c67679a9e..9b79ead5d 100644 --- a/EditorExtension/Extension/Info.plist +++ b/EditorExtension/Extension/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 0.30.2 + 0.31.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) LSMinimumSystemVersion diff --git a/EditorExtension/Extension/SourceEditorExtension.swift b/EditorExtension/Extension/SourceEditorExtension.swift index 9ea2b8f42..44e89b420 100644 --- a/EditorExtension/Extension/SourceEditorExtension.swift +++ b/EditorExtension/Extension/SourceEditorExtension.swift @@ -5,28 +5,28 @@ // Created by Tony Arnold on 5/10/16. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation diff --git a/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist b/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist index 22326d502..11fbb1765 100644 --- a/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist +++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.30.2 + 0.31.0 CFBundleSupportedPlatforms MacOSX 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 d30864a90..8347ae2ee 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 f02bc5751..096bec6e7 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 @@ -17,7 +17,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 0.30.2 + 0.31.0 CFBundleSupportedPlatforms MacOSX 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 680871b51..a5205cb0d 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/_CodeSignature/CodeResources b/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources index 39ec77ffc..48bea1eae 100644 --- a/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources +++ b/EditorExtension/SwiftFormat for Xcode.app/Contents/_CodeSignature/CodeResources @@ -170,7 +170,7 @@ cdhash - 7JV51Gmie7qqrzy6FVBa/TYap7A= + na9aZD9ntjJCYtBthJwYlOwlYC0= 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 */ diff --git a/LICENCE.md b/LICENCE.md deleted file mode 100755 index ff78c1a32..000000000 --- a/LICENCE.md +++ /dev/null @@ -1,21 +0,0 @@ -SwiftFormat - -Copyright (c) 2016 Nick Lockwood - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md new file mode 100755 index 000000000..6fc7a2cec --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Nick Lockwood + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index eab7db0bd..168fe1a1f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Coveralls](https://coveralls.io/repos/github/nicklockwood/SwiftFormat/badge.svg)](https://coveralls.io/github/nicklockwood/SwiftFormat) [![Swift 3.2](https://img.shields.io/badge/swift-3.2-orange.svg?style=flat)](https://developer.apple.com/swift) [![Swift 4.0](https://img.shields.io/badge/swift-4.0-red.svg?style=flat)](https://developer.apple.com/swift) -[![License](https://img.shields.io/badge/license-zlib-lightgrey.svg)](https://opensource.org/licenses/Zlib) +[![License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://opensource.org/licenses/MIT) [![Twitter](https://img.shields.io/badge/twitter-@nicklockwood-blue.svg)](http://twitter.com/nicklockwood) Table of Contents diff --git a/Sources/CommandLine.swift b/Sources/CommandLine.swift index df40eb354..780c0ade3 100644 --- a/Sources/CommandLine.swift +++ b/Sources/CommandLine.swift @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 10/01/2017. // Copyright 2017 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation diff --git a/Sources/Formatter.swift b/Sources/Formatter.swift index 8f9ab14e7..216787876 100644 --- a/Sources/Formatter.swift +++ b/Sources/Formatter.swift @@ -2,33 +2,33 @@ // Formatter.swift // SwiftFormat // -// Version 0.30.2 +// Version 0.31.0 // // Created by Nick Lockwood on 12/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation diff --git a/Sources/Info.plist b/Sources/Info.plist index adfa38588..d2c66b4a4 100644 --- a/Sources/Info.plist +++ b/Sources/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.30.2 + 0.31.0 CFBundleSignature ???? CFBundleVersion diff --git a/Sources/Options.swift b/Sources/Options.swift index 643cfd903..d2257bdfc 100644 --- a/Sources/Options.swift +++ b/Sources/Options.swift @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 21/10/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation diff --git a/Sources/Rules.swift b/Sources/Rules.swift index 9213b709f..8c05ede95 100644 --- a/Sources/Rules.swift +++ b/Sources/Rules.swift @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 12/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation @@ -679,82 +679,78 @@ extension FormatRules { var lineIndex = 0 func tokenIsEndOfStatement(_ i: Int) -> Bool { - if let token = formatter.token(at: i) { - switch token { - case .endOfScope("case"), .endOfScope("default"): + guard let token = formatter.token(at: i) else { return true } + switch token { + case .endOfScope("case"), .endOfScope("default"): + return false + case let .keyword(string): + // TODO: handle in + // TODO: handle context-specific keywords + // associativity, convenience, dynamic, didSet, final, get, infix, indirect, + // lazy, left, mutating, none, nonmutating, open, optional, override, postfix, + // precedence, prefix, Protocol, required, right, set, Type, unowned, weak, willSet + switch string { + case "let", "func", "var", "if", "as", "import", "try", "guard", "case", + "for", "init", "switch", "throw", "where", "subscript", "is", + "while", "associatedtype", "inout": return false - case let .keyword(string): - // TODO: handle in - // TODO: handle context-specific keywords - // associativity, convenience, dynamic, didSet, final, get, infix, indirect, - // lazy, left, mutating, none, nonmutating, open, optional, override, postfix, - // precedence, prefix, Protocol, required, right, set, Type, unowned, weak, willSet - switch string { - case "let", "func", "var", "if", "as", "import", "try", "guard", "case", - "for", "init", "switch", "throw", "where", "subscript", "is", - "while", "associatedtype", "inout": - return false - case "return": - guard let nextToken = - formatter.next(.nonSpaceOrCommentOrLinebreak, after: i) - else { return true } - switch nextToken { - case .keyword, .endOfScope("case"), .endOfScope("default"): - return true - default: - return false - } - default: + case "return": + guard let nextToken = + formatter.next(.nonSpaceOrCommentOrLinebreak, after: i) + else { return true } + switch nextToken { + case .keyword, .endOfScope("case"), .endOfScope("default"): return true + default: + return false } - case .delimiter(","): - // For arrays or argument lists, we already indent - return ["<", "[", "(", "case"].contains(scopeStack.last?.string ?? "") - case .delimiter(":"), .operator(_, .infix), .operator(_, .prefix): - return false - case .operator("?", .postfix), .operator("!", .postfix): - if let prevToken = formatter.token(at: i - 1) { - switch prevToken { - case .keyword("as"), .keyword("try"): - return false - default: - return true - } - } - return true default: return true } + case .delimiter(","): + // For arrays or argument lists, we already indent + return ["<", "[", "(", "case"].contains(scopeStack.last?.string ?? "") + case .delimiter(":"), .operator(_, .infix), .operator(_, .prefix): + return false + case .operator("?", .postfix), .operator("!", .postfix): + if let prevToken = formatter.token(at: i - 1) { + switch prevToken { + case .keyword("as"), .keyword("try"): + return false + default: + return true + } + } + return true + default: + return true } - return true } func tokenIsStartOfStatement(_ i: Int) -> Bool { - if let token = formatter.token(at: i) { - switch token { - case let .keyword(string) where [ // TODO: handle "in" - "where", "dynamicType", "rethrows", "throws", - ].contains(string): - return false - case .keyword("as"), .keyword("in"): - if scopeStack.last?.string == "case" { - // For case statements, we already indent - return true - } - return false - case .delimiter(","), .delimiter(":"): - if let scope = scopeStack.last?.string, ["<", "[", "(", "case"].contains(scope) { - // For arrays, dictionaries, cases, or argument lists, we already indent - return true - } - return false - case .delimiter("->"), .operator(_, .infix), .operator(_, .postfix): - return false - default: + guard let token = formatter.token(at: i) else { return true } + switch token { + case let .keyword(string) where [ // TODO: handle "in" + "where", "dynamicType", "rethrows", "throws", + ].contains(string): + return false + case .keyword("as"), .keyword("in"): + if scopeStack.last?.string == "case" { + // For case statements, we already indent return true } + return false + case .delimiter(","), .delimiter(":"): + if let scope = scopeStack.last?.string, ["<", "[", "(", "case"].contains(scope) { + // For arrays, dictionaries, cases, or argument lists, we already indent + return true + } + return false + case .delimiter("->"), .operator(_, .infix), .operator(_, .postfix): + return false + default: + return true } - return true } func tokenIsStartOfClosure(_ i: Int) -> Bool { @@ -1425,27 +1421,23 @@ extension FormatRules { /// Remove redundant parens around the arguments for loops, if statements, closures, etc. @objc public class func redundantParens(_ formatter: Formatter) { func tokenOutsideParenRequiresSpacing(at index: Int) -> Bool { - if let token = formatter.token(at: index) { - switch token { - case .identifier, .keyword, .number: - return true - default: - return false - } + guard let token = formatter.token(at: index) else { return false } + switch token { + case .identifier, .keyword, .number: + return true + default: + return false } - return false } func tokenInsideParenRequiresSpacing(at index: Int) -> Bool { - if let token = formatter.token(at: index) { - switch token { - case .operator, .startOfScope("{"), .endOfScope("}"): - return true - default: - return tokenOutsideParenRequiresSpacing(at: index) - } + guard let token = formatter.token(at: index) else { return false } + switch token { + case .operator, .startOfScope("{"), .endOfScope("}"): + return true + default: + return tokenOutsideParenRequiresSpacing(at: index) } - return false } func removeParen(at index: Int) { @@ -2910,50 +2902,35 @@ extension FormatRules { var range: ClosedRange var tokens: [Token] var importStartIndex: Int - var moduleName: String? { - for token in tokens[importStartIndex ..< tokens.endIndex] { - if case let .identifier(moduleName) = token { - return moduleName - } + for case let .identifier(moduleName) in tokens[importStartIndex ..< tokens.endIndex] { + return moduleName } return nil } } - - func process(imports: [Import]) { - var imports = imports - + func process(imports: [Import]?) { + guard var imports = imports else { return } imports.reversed().map { $0.range }.forEach(formatter.removeTokens(inRange:)) - - guard let firstIndex = imports.first?.range.lowerBound else { - return - } - - imports.sort { (lhs, rhs) -> Bool in - guard let lhsModuleName = lhs.moduleName, let rhsModuleName = rhs.moduleName else { return true } + guard let firstIndex = imports.first?.range.lowerBound else { return } + imports.sort { + guard let lhsModuleName = $0.moduleName, let rhsModuleName = $1.moduleName else { return true } return lhsModuleName.caseInsensitiveCompare(rhsModuleName) == .orderedAscending } - formatter.insertTokens(imports.flatMap { $0.tokens }, at: firstIndex) } - - var importsStack: [[Import]] = [[]] + var importsStack = [[Import]()] var removeTrailingToken = false formatter.forEachToken { i, token in - - let shouldBeginScope = [.startOfScope("#if"), .keyword("#else"), .keyword("#elseif")].contains(token) - let shouldEndScope = [.keyword("#else"), .keyword("#elseif"), .endOfScope("#endif")].contains(token) - - if shouldEndScope, let imports = importsStack.popLast() { - process(imports: imports) - } - - if shouldBeginScope { + switch token { + case .startOfScope("#if"): importsStack.append([]) - } - - if token == .keyword("import") { + case .keyword("#else"), .keyword("#elseif"): + process(imports: importsStack.popLast()) + importsStack.append([]) + case .endOfScope("#endif"): + process(imports: importsStack.popLast()) + case .keyword("import"): let importEndIndex: Int if let index = formatter.index(of: .linebreak, after: i) { importEndIndex = index @@ -2962,22 +2939,23 @@ extension FormatRules { importEndIndex = formatter.tokens.count - 1 removeTrailingToken = true } - - // Search for a line break (or beginning of file) backwards to include whitespace / @testable... in our Import structure - let beginIndex = (formatter.index(before: i, where: { (prev) -> Bool in - prev.isLinebreak - }) ?? -1) + 1 - + // Search for a line break (or beginning of file) backwards to include + // whitespace / @testable... in our Import structure + let beginIndex = (formatter.index(of: .linebreak, before: i) ?? -1) + 1 let range: ClosedRange = beginIndex ... importEndIndex - let currentImport = Import(range: range, tokens: Array(formatter.tokens[range]), importStartIndex: i - beginIndex) + let currentImport = Import( + range: range, + tokens: Array(formatter.tokens[range]), + importStartIndex: i - beginIndex + ) importsStack[importsStack.endIndex - 1].append(currentImport) + default: + break } } - while let imports = importsStack.popLast() { process(imports: imports) } - if removeTrailingToken { formatter.removeLastToken() } diff --git a/Sources/SwiftFormat.h b/Sources/SwiftFormat.h index 089a11b22..3e32b2105 100644 --- a/Sources/SwiftFormat.h +++ b/Sources/SwiftFormat.h @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 12/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. -// -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: -// -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // #import diff --git a/Sources/SwiftFormat.swift b/Sources/SwiftFormat.swift index 473340650..9396d0b4d 100644 --- a/Sources/SwiftFormat.swift +++ b/Sources/SwiftFormat.swift @@ -5,34 +5,34 @@ // Created by Nick Lockwood on 12/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation /// The current SwiftFormat version -public let version = "0.30.2" +public let version = "0.31.0" /// An enumeration of the types of error that may be thrown by SwiftFormat public enum FormatError: Error, CustomStringConvertible { diff --git a/Sources/Tokenizer.swift b/Sources/Tokenizer.swift index 58892353f..f8ce67d3d 100644 --- a/Sources/Tokenizer.swift +++ b/Sources/Tokenizer.swift @@ -2,33 +2,33 @@ // Tokenizer.swift // SwiftFormat // -// Version 0.30.2 +// Version 0.31.0 // // Created by Nick Lockwood on 11/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import Foundation diff --git a/SwiftFormat.podspec.json b/SwiftFormat.podspec.json index 6dc2d3a64..c624240ab 100644 --- a/SwiftFormat.podspec.json +++ b/SwiftFormat.podspec.json @@ -1,16 +1,16 @@ { "name": "SwiftFormat", - "version": "0.30.2", + "version": "0.31.0", "license": { - "type": "zlib", - "file": "LICENCE.md" + "type": "MIT", + "file": "LICENSE.md" }, "summary": "Mac and iOS library for formatting Swift source code.", "homepage": "https://github.com/nicklockwood/SwiftFormat", "authors": "Nick Lockwood", "source": { "git": "https://github.com/nicklockwood/SwiftFormat.git", - "tag": "0.30.2" + "tag": "0.31.0" }, "default_subspecs": "Core", "subspecs": [ diff --git a/Tests/CommandLineTests.swift b/Tests/CommandLineTests.swift index 59b15f505..da5c15fd5 100644 --- a/Tests/CommandLineTests.swift +++ b/Tests/CommandLineTests.swift @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 10/01/2017. // Copyright 2017 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // @testable import SwiftFormat diff --git a/Tests/FormatterTests.swift b/Tests/FormatterTests.swift index f42f1b7dc..3a598b540 100644 --- a/Tests/FormatterTests.swift +++ b/Tests/FormatterTests.swift @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 30/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import SwiftFormat diff --git a/Tests/Info.plist b/Tests/Info.plist index 22235b4b5..8da24c3f0 100644 --- a/Tests/Info.plist +++ b/Tests/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType BNDL CFBundleShortVersionString - 0.30.2 + 0.31.0 CFBundleSignature ???? CFBundleVersion diff --git a/Tests/RulesTests.swift b/Tests/RulesTests.swift index 08a43aac2..f33ae2523 100644 --- a/Tests/RulesTests.swift +++ b/Tests/RulesTests.swift @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 12/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import SwiftFormat diff --git a/Tests/SwiftFormatTests.swift b/Tests/SwiftFormatTests.swift index 05913fd9c..672303db9 100644 --- a/Tests/SwiftFormatTests.swift +++ b/Tests/SwiftFormatTests.swift @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 28/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import SwiftFormat diff --git a/Tests/TokenizerTests.swift b/Tests/TokenizerTests.swift index 906a1dc3c..b780e6587 100644 --- a/Tests/TokenizerTests.swift +++ b/Tests/TokenizerTests.swift @@ -5,28 +5,28 @@ // Created by Nick Lockwood on 12/08/2016. // Copyright 2016 Nick Lockwood // -// Distributed under the permissive zlib license +// Distributed under the permissive MIT license // Get the latest version from here: // // https://github.com/nicklockwood/SwiftFormat // -// This software is provided 'as-is', without any express or implied -// warranty. In no event will the authors be held liable for any damages -// arising from the use of this software. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: // -// Permission is granted to anyone to use this software for any purpose, -// including commercial applications, and to alter it and redistribute it -// freely, subject to the following restrictions: +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. // -// 1. The origin of this software must not be misrepresented; you must not -// claim that you wrote the original software. If you use this software -// in a product, an acknowledgment in the product documentation would be -// appreciated but is not required. -// -// 2. Altered source versions must be plainly marked as such, and must not be -// misrepresented as being the original software. -// -// 3. This notice may not be removed or altered from any source distribution. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. // import SwiftFormat