Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 4.1.0, 4.1.1 and 4.2.0 to Swift version detection #2143

Merged
merged 3 commits into from
Apr 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
[Ornithologist Coder](https://github.com/ornithocoder)
[#1885](https://github.com/realm/SwiftLint/issues/1885)

* Add 4.1.0, 4.1.1 and 4.2.0 to Swift version detection.
[norio-nomura](https://github.com/norio-nomura)
[#2143](https://github.com/realm/SwiftLint/issues/2143)

#### Bug Fixes

* Fixes an issue with the `yoda_condition` rule where the severity would always
Expand Down
12 changes: 11 additions & 1 deletion Source/SwiftLintFramework/Models/SwiftVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ extension SwiftVersion {
}

let file = File(contents: """
#if swift(>=4.1.0)
#if swift(>=4.2.0)
let version = "4.2.0"
#elseif swift(>=4.1.1)
let version = "4.1.1"
#elseif swift(>=4.1.0)
let version = "4.1.0"
#elseif swift(>=4.0.3)
let version = "4.0.3"
Expand All @@ -53,6 +57,12 @@ extension SwiftVersion {
let version = "4.0.1"
#elseif swift(>=4.0.0)
let version = "4.0.0"
#elseif swift(>=3.4.0)
let version = "3.4.0"
#elseif swift(>=3.3.1)
let version = "3.3.1"
#elseif swift(>=3.3.0)
let version = "3.3.0"
#elseif swift(>=3.2.3)
let version = "3.2.3"
#elseif swift(>=3.2.2)
Expand Down
12 changes: 11 additions & 1 deletion Tests/SwiftLintFrameworkTests/LinterCacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,11 @@ class LinterCacheTests: XCTestCase {
}

func testDetectSwiftVersion() {
#if swift(>=4.1.0)
#if swift(>=4.2.0)
let version = "4.2.0"
#elseif swift(>=4.1.1)
let version = "4.1.1"
#elseif swift(>=4.1.0)
let version = "4.1.0"
#elseif swift(>=4.0.3)
let version = "4.0.3"
Expand All @@ -339,6 +343,12 @@ class LinterCacheTests: XCTestCase {
let version = "4.0.1"
#elseif swift(>=4.0.0)
let version = "4.0.0"
#elseif swift(>=3.4.0)
let version = "4.2.0" // Since we can't pass SWIFT_VERSION=3 to sourcekit, it returns 4.2.0
#elseif swift(>=3.3.1)
let version = "4.1.1" // Since we can't pass SWIFT_VERSION=3 to sourcekit, it returns 4.1.1
#elseif swift(>=3.3.0)
let version = "4.1.0" // Since we can't pass SWIFT_VERSION=3 to sourcekit, it returns 4.1.0
#elseif swift(>=3.2.3)
let version = "4.0.3" // Since we can't pass SWIFT_VERSION=3 to sourcekit, it returns 4.0.3
#elseif swift(>=3.2.2)
Expand Down