diff --git a/.gitmodules b/.gitmodules index f534e1db62..d451957f2e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "Carthage/Checkouts/Result"] - path = Carthage/Checkouts/Result - url = https://github.com/antitypical/Result.git [submodule "Carthage/Checkouts/SWXMLHash"] path = Carthage/Checkouts/SWXMLHash url = https://github.com/drmohundro/SWXMLHash.git diff --git a/CHANGELOG.md b/CHANGELOG.md index 8761ee8ddf..dc22c7365a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ [PaulTaykalo](https://github.com/PaulTaykalo) [#2922](https://github.com/realm/SwiftLint/issues/2922) +* Update Commandant dependency to version 0.17.0, removing the + `antitypical/Result` dependency in favor of the Swift standard + library's `Result` type. + [JP Simard](https://github.com/jpsim) + [#623](https://github.com/jpsim/SourceKitten/issues/623) + #### Experimental * None. diff --git a/Cartfile b/Cartfile index 90f552f7a7..3365297ce5 100644 --- a/Cartfile +++ b/Cartfile @@ -1,2 +1,2 @@ -github "jpsim/SourceKitten" ~> 0.26.0 +github "jpsim/SourceKitten" ~> 0.27.0 github "scottrhoyt/SwiftyTextTable" ~> 0.9.0 diff --git a/Cartfile.private b/Cartfile.private index 083fb6a0bf..2a3b3d6a44 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,3 +1,3 @@ -github "Carthage/Commandant" ~> 0.16.0 +github "Carthage/Commandant" ~> 0.17.0 github "jpsim/Yams" ~> 2.0.0 github "jspahrsummers/xcconfigs" ~> 0.12.0 diff --git a/Cartfile.resolved b/Cartfile.resolved index 7a31a24920..28ac2ecfe0 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,7 +1,6 @@ -github "Carthage/Commandant" "0.16.0" -github "antitypical/Result" "4.1.0" +github "Carthage/Commandant" "0.17.0" github "drmohundro/SWXMLHash" "5.0.1" -github "jpsim/SourceKitten" "0.26.0" +github "jpsim/SourceKitten" "0.27.0" github "jpsim/Yams" "2.0.0" github "jspahrsummers/xcconfigs" "0.12" github "scottrhoyt/SwiftyTextTable" "0.9.0" diff --git a/Carthage/Checkouts/Commandant b/Carthage/Checkouts/Commandant index 2cd0210f89..ab68611013 160000 --- a/Carthage/Checkouts/Commandant +++ b/Carthage/Checkouts/Commandant @@ -1 +1 @@ -Subproject commit 2cd0210f897fe46c6ce42f52ccfa72b3bbb621a0 +Subproject commit ab68611013dec67413628ac87c1f29e8427bc8e4 diff --git a/Carthage/Checkouts/Result b/Carthage/Checkouts/Result deleted file mode 160000 index 2ca499ba45..0000000000 --- a/Carthage/Checkouts/Result +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2ca499ba456795616fbc471561ff1d963e6ae160 diff --git a/Carthage/Checkouts/SourceKitten b/Carthage/Checkouts/SourceKitten index cc1f16acc7..356551fc51 160000 --- a/Carthage/Checkouts/SourceKitten +++ b/Carthage/Checkouts/SourceKitten @@ -1 +1 @@ -Subproject commit cc1f16acc70630d27498e81078789f5fa55d7463 +Subproject commit 356551fc513eb12ed779bb369f79cf86a3a01599 diff --git a/Package.resolved b/Package.resolved index 1e4407e4aa..6b8d410da6 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/Carthage/Commandant.git", "state": { "branch": null, - "revision": "2cd0210f897fe46c6ce42f52ccfa72b3bbb621a0", - "version": "0.16.0" + "revision": "ab68611013dec67413628ac87c1f29e8427bc8e4", + "version": "0.17.0" } }, { @@ -46,22 +46,13 @@ "version": "2.2.0" } }, - { - "package": "Result", - "repositoryURL": "https://github.com/antitypical/Result.git", - "state": { - "branch": null, - "revision": "2ca499ba456795616fbc471561ff1d963e6ae160", - "version": "4.1.0" - } - }, { "package": "SourceKitten", "repositoryURL": "https://github.com/jpsim/SourceKitten.git", "state": { "branch": null, - "revision": "cc1f16acc70630d27498e81078789f5fa55d7463", - "version": "0.26.0" + "revision": "356551fc513eb12ed779bb369f79cf86a3a01599", + "version": "0.27.0" } }, { diff --git a/Package.swift b/Package.swift index 7ad049f391..c2ebe5aac1 100644 --- a/Package.swift +++ b/Package.swift @@ -14,8 +14,8 @@ let package = Package( .library(name: "SwiftLintFramework", targets: ["SwiftLintFramework"]) ], dependencies: [ - .package(url: "https://github.com/Carthage/Commandant.git", .upToNextMinor(from: "0.16.0")), - .package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.26.0"), + .package(url: "https://github.com/Carthage/Commandant.git", .upToNextMinor(from: "0.17.0")), + .package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.27.0"), .package(url: "https://github.com/jpsim/Yams.git", from: "2.0.0"), .package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.9.0"), ] + (addCryptoSwift ? [.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", .upToNextMinor(from: "1.0.0"))] : []), diff --git a/Source/swiftlint/Commands/AnalyzeCommand.swift b/Source/swiftlint/Commands/AnalyzeCommand.swift index 6bcb3a043b..d9f5256889 100644 --- a/Source/swiftlint/Commands/AnalyzeCommand.swift +++ b/Source/swiftlint/Commands/AnalyzeCommand.swift @@ -1,5 +1,4 @@ import Commandant -import Result import SwiftLintFramework struct AnalyzeCommand: CommandProtocol { diff --git a/Source/swiftlint/Commands/AutoCorrectCommand.swift b/Source/swiftlint/Commands/AutoCorrectCommand.swift index 71ee17bdf0..89fb56b093 100644 --- a/Source/swiftlint/Commands/AutoCorrectCommand.swift +++ b/Source/swiftlint/Commands/AutoCorrectCommand.swift @@ -1,5 +1,4 @@ import Commandant -import Result import SwiftLintFramework struct AutoCorrectCommand: CommandProtocol { diff --git a/Source/swiftlint/Commands/GenerateDocsCommand.swift b/Source/swiftlint/Commands/GenerateDocsCommand.swift index 3c7a7ff4aa..54a28b4573 100644 --- a/Source/swiftlint/Commands/GenerateDocsCommand.swift +++ b/Source/swiftlint/Commands/GenerateDocsCommand.swift @@ -1,5 +1,4 @@ import Commandant -import Result import SwiftLintFramework struct GenerateDocsCommand: CommandProtocol { diff --git a/Source/swiftlint/Commands/LintCommand.swift b/Source/swiftlint/Commands/LintCommand.swift index 216d2a89bf..f9b26be9ea 100644 --- a/Source/swiftlint/Commands/LintCommand.swift +++ b/Source/swiftlint/Commands/LintCommand.swift @@ -1,5 +1,4 @@ import Commandant -import Result struct LintCommand: CommandProtocol { let verb = "lint" diff --git a/Source/swiftlint/Commands/RulesCommand.swift b/Source/swiftlint/Commands/RulesCommand.swift index ac69cc9b96..fa7a558363 100644 --- a/Source/swiftlint/Commands/RulesCommand.swift +++ b/Source/swiftlint/Commands/RulesCommand.swift @@ -6,7 +6,6 @@ import Glibc #else #error("Unsupported platform") #endif -import Result import SwiftLintFramework import SwiftyTextTable diff --git a/Source/swiftlint/Commands/VersionCommand.swift b/Source/swiftlint/Commands/VersionCommand.swift index 48e8ccb2e3..992c181d76 100644 --- a/Source/swiftlint/Commands/VersionCommand.swift +++ b/Source/swiftlint/Commands/VersionCommand.swift @@ -1,5 +1,4 @@ import Commandant -import Result import SwiftLintFramework struct VersionCommand: CommandProtocol { diff --git a/Source/swiftlint/Extensions/Configuration+CommandLine.swift b/Source/swiftlint/Extensions/Configuration+CommandLine.swift index 8102348f54..cbc1341b9a 100644 --- a/Source/swiftlint/Extensions/Configuration+CommandLine.swift +++ b/Source/swiftlint/Extensions/Configuration+CommandLine.swift @@ -1,7 +1,6 @@ import Commandant import Dispatch import Foundation -import Result import SourceKittenFramework import SwiftLintFramework @@ -28,7 +27,7 @@ private func scriptInputFiles() -> Result<[SwiftLintFile], CommandantError<()>> }() return count.flatMap { count in - let inputFiles = (0.. SwiftLintFile? in + return .success((0.. Result<[SwiftLintFile], CommandantError<()>> queuedPrintError(String(describing: error)) return nil } - } - return Result(inputFiles) + }) } } diff --git a/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift b/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift index 83eddbe5e7..e0d68fd412 100644 --- a/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift +++ b/Source/swiftlint/Helpers/LintOrAnalyzeCommand.swift @@ -1,7 +1,6 @@ import Commandant import Dispatch import Foundation -import Result import SwiftLintFramework enum LintOrAnalyzeMode { diff --git a/Source/swiftlint/Helpers/LintableFilesVisitor.swift b/Source/swiftlint/Helpers/LintableFilesVisitor.swift index 468bbb290f..d8c9c5f413 100644 --- a/Source/swiftlint/Helpers/LintableFilesVisitor.swift +++ b/Source/swiftlint/Helpers/LintableFilesVisitor.swift @@ -1,6 +1,5 @@ import Commandant import Foundation -import Result import SourceKittenFramework import SwiftLintFramework diff --git a/SwiftLint.xcodeproj/project.pbxproj b/SwiftLint.xcodeproj/project.pbxproj index aeb6fd8f4d..3b9ae6be16 100644 --- a/SwiftLint.xcodeproj/project.pbxproj +++ b/SwiftLint.xcodeproj/project.pbxproj @@ -135,10 +135,8 @@ 6C1D763221A4E69600DEF783 /* Request+DisableSourceKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C1D763121A4E69600DEF783 /* Request+DisableSourceKit.swift */; }; 6C7045441C6ADA450003F15A /* SourceKitCrashTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C7045431C6ADA450003F15A /* SourceKitCrashTests.swift */; }; 6CB8A80C1D11A7E10052816E /* Commandant.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8BA7E101B07A3EC003E02D0 /* Commandant.framework */; }; - 6CB8A80D1D11A7E10052816E /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8BA7E121B07A3F3003E02D0 /* Result.framework */; }; 6CC4259B1C77046200AEA885 /* SyntaxMap+SwiftLint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CC4259A1C77046200AEA885 /* SyntaxMap+SwiftLint.swift */; }; 6CCFCF2A1CFEF729003239EB /* Commandant.framework in Embed Frameworks into SwiftLintFramework.framework */ = {isa = PBXBuildFile; fileRef = E8BA7E101B07A3EC003E02D0 /* Commandant.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 6CCFCF2C1CFEF72D003239EB /* Result.framework in Embed Frameworks into SwiftLintFramework.framework */ = {isa = PBXBuildFile; fileRef = E8BA7E121B07A3F3003E02D0 /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 6CCFCF2D1CFEF731003239EB /* SourceKittenFramework.framework in Embed Frameworks into SwiftLintFramework.framework */ = {isa = PBXBuildFile; fileRef = E876BFBD1B07828500114ED5 /* SourceKittenFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 6CCFCF2E1CFEF73A003239EB /* SWXMLHash.framework in Embed Frameworks into SwiftLintFramework.framework */ = {isa = PBXBuildFile; fileRef = E8C0DFCC1AD349DB007EE3D4 /* SWXMLHash.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 6CCFCF2F1CFEF73E003239EB /* SwiftyTextTable.framework in Embed Frameworks into SwiftLintFramework.framework */ = {isa = PBXBuildFile; fileRef = 3BBF2F9C1C640A0F006CD775 /* SwiftyTextTable.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; @@ -469,7 +467,6 @@ dstSubfolderSpec = 10; files = ( 6CCFCF2A1CFEF729003239EB /* Commandant.framework in Embed Frameworks into SwiftLintFramework.framework */, - 6CCFCF2C1CFEF72D003239EB /* Result.framework in Embed Frameworks into SwiftLintFramework.framework */, 6CCFCF2D1CFEF731003239EB /* SourceKittenFramework.framework in Embed Frameworks into SwiftLintFramework.framework */, 6CCFCF2E1CFEF73A003239EB /* SWXMLHash.framework in Embed Frameworks into SwiftLintFramework.framework */, 6CCFCF2F1CFEF73E003239EB /* SwiftyTextTable.framework in Embed Frameworks into SwiftLintFramework.framework */, @@ -933,7 +930,6 @@ E8B067801C13E49600E9E13F /* Configuration+CommandLine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Configuration+CommandLine.swift"; sourceTree = ""; }; E8B67C3D1C095E6300FDED8E /* Correction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Correction.swift; sourceTree = ""; }; E8BA7E101B07A3EC003E02D0 /* Commandant.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Commandant.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - E8BA7E121B07A3F3003E02D0 /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Result.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E8BB8F9B1B17DE3B00199606 /* RulesTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RulesTests.swift; sourceTree = ""; }; E8BDE3FE1EDF91B6002EC12F /* RuleList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RuleList.swift; sourceTree = ""; }; E8BE1FCB1E07687400F781C7 /* Yams.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Yams.framework; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -974,7 +970,6 @@ buildActionMask = 2147483647; files = ( 6CB8A80C1D11A7E10052816E /* Commandant.framework in Frameworks */, - 6CB8A80D1D11A7E10052816E /* Result.framework in Frameworks */, D0E7B65319E9C6AD00EDBA4D /* SwiftLintFramework.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1066,7 +1061,6 @@ isa = PBXGroup; children = ( E8BA7E101B07A3EC003E02D0 /* Commandant.framework */, - E8BA7E121B07A3F3003E02D0 /* Result.framework */, 5499CA961A2394B700783309 /* Components.plist */, 5499CA971A2394B700783309 /* Info.plist */, ); diff --git a/SwiftLint.xcworkspace/contents.xcworkspacedata b/SwiftLint.xcworkspace/contents.xcworkspacedata index ea52241d91..9cc392b015 100644 --- a/SwiftLint.xcworkspace/contents.xcworkspacedata +++ b/SwiftLint.xcworkspace/contents.xcworkspacedata @@ -10,9 +10,6 @@ - - diff --git a/SwiftLintFramework.podspec b/SwiftLintFramework.podspec index 8c63d18ae6..4e211bac0a 100644 --- a/SwiftLintFramework.podspec +++ b/SwiftLintFramework.podspec @@ -8,8 +8,8 @@ Pod::Spec.new do |s| s.author = { 'JP Simard' => 'jp@jpsim.com' } s.platform = :osx, '10.10' s.source_files = 'Source/SwiftLintFramework/**/*.swift' - s.swift_versions = ['4.2', '5.0'] + s.swift_versions = ['5.0', '5.1'] s.pod_target_xcconfig = { 'APPLICATION_EXTENSION_API_ONLY' => 'YES' } - s.dependency 'SourceKittenFramework', '~> 0.26.0' + s.dependency 'SourceKittenFramework', '~> 0.27.0' s.dependency 'Yams', '~> 2.0' end diff --git a/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift b/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift index 8dfc7cabd5..fbbf5d37e5 100644 --- a/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift +++ b/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift @@ -301,7 +301,9 @@ class LinterCacheTests: XCTestCase { // swiftlint:disable:next function_body_length func testDetectSwiftVersion() { - #if compiler(>=5.1.1) + #if compiler(>=5.1.2) + let version = "5.1.2" + #elseif compiler(>=5.1.1) let version = "5.1.1" #elseif compiler(>=5.1.0) let version = "5.1.0"