Skip to content

Commit

Permalink
Require Swift 4.2 (realm#2466)
Browse files Browse the repository at this point in the history
This bumps the minimum version required to build SwiftLint to 4.2. The primary motivating factor to drop support for Swift 4.0-4.1.x is that SwiftLint now uses CryptoSwift, which requires 4.2.

* Add changelog entry

* Remove --allow-warnings flag from CocoaPods commands

* Update CryptoSwift to 0.13.0

* Migrate to Swift 4.2

* Remove CircleCI tests for Swift < 4.2

* Update English and Chinese README

Korean README doesn't yet have a version table like this.

* Update gems

* Add changelog entry for fixed compiler warnings

* Update CocoaPods to 1.6.0.beta.2

To work around CocoaPods/CocoaPods#7708
  • Loading branch information
jpsim authored Nov 19, 2018
1 parent 265b4fd commit 5901d30
Show file tree
Hide file tree
Showing 29 changed files with 131 additions and 201 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#### Breaking

* None.
* SwiftLint now requires Swift 4.2 or higher to build.
[JP Simard](https://github.com/jpsim)

#### Experimental

Expand All @@ -14,7 +15,9 @@

#### Bug Fixes

* None.
* Fix compiler warnings when building with Swift 4.2 introduced in the last
release.
[JP Simard](https://github.com/jpsim)

## 0.28.1: EnviroBoost

Expand Down
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "Carthage/Commandant" ~> 0.15.0
github "jpsim/Yams" ~> 1.0.1
github "jspahrsummers/xcconfigs" ~> 0.12.0
github "krzyzanowskim/CryptoSwift" == 0.8.3
github "krzyzanowskim/CryptoSwift" ~> 0.13.0
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ github "drmohundro/SWXMLHash" "4.7.4"
github "jpsim/SourceKitten" "0.21.2"
github "jpsim/Yams" "1.0.1"
github "jspahrsummers/xcconfigs" "0.12"
github "krzyzanowskim/CryptoSwift" "0.8.3"
github "krzyzanowskim/CryptoSwift" "0.13.0"
github "scottrhoyt/SwiftyTextTable" "0.8.2"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/CryptoSwift
Submodule CryptoSwift updated 141 files
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
source "https://rubygems.org"

gem "danger"
gem "cocoapods"
gem "cocoapods", "~> 1.6.0.beta"
92 changes: 49 additions & 43 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,109 +1,115 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (2.3.5)
activesupport (4.2.8)
CFPropertyList (3.0.0)
activesupport (4.2.10)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
claide (1.0.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
atomos (0.1.3)
claide (1.0.2)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
cocoapods (1.2.1)
cocoapods (1.6.0.beta.2)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.1, < 2.0)
cocoapods-core (= 1.2.1)
cocoapods-deintegrate (>= 1.0.1, < 2.0)
cocoapods-downloader (>= 1.1.3, < 2.0)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.6.0.beta.2)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.2.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (~> 2.0.1)
gh_inspector (~> 1.0)
molinillo (~> 0.5.7)
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.1)
xcodeproj (>= 1.4.4, < 2.0)
cocoapods-core (1.2.1)
activesupport (>= 4.0.2, < 5)
ruby-macho (~> 1.3, >= 1.3.1)
xcodeproj (>= 1.7.0, < 2.0)
cocoapods-core (1.6.0.beta.2)
activesupport (>= 4.0.2, < 6)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.3)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.2.2)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.2.0)
cocoapods-trunk (1.3.1)
nap (>= 0.8, < 2.0)
netrc (= 0.7.8)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.1.3)
cork (0.3.0)
colored2 (~> 3.1)
danger (5.2.2)
danger (5.8.0)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (~> 0.9)
faraday-http-cache (~> 1.0)
git (~> 1)
git (~> 1.5)
kramdown (~> 1.5)
octokit (~> 4.2)
no_proxy_fix
octokit (~> 4.7)
terminal-table (~> 1)
escape (0.0.4)
faraday (0.12.1)
faraday (0.15.3)
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday (~> 0.8)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.0.3)
git (1.3.0)
i18n (0.8.4)
kramdown (1.13.2)
minitest (5.10.2)
molinillo (0.5.7)
gh_inspector (1.1.3)
git (1.5.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
kramdown (1.17.0)
minitest (5.11.3)
molinillo (0.6.6)
multipart-post (2.0.0)
nanaimo (0.2.3)
nanaimo (0.2.6)
nap (1.1.0)
netrc (0.7.8)
octokit (4.7.0)
netrc (0.11.0)
no_proxy_fix (0.1.2)
octokit (4.13.0)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
public_suffix (2.0.5)
ruby-macho (1.1.0)
public_suffix (3.0.3)
ruby-macho (1.3.1)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
tzinfo (1.2.3)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.2.1)
xcodeproj (1.4.4)
CFPropertyList (~> 2.3.3)
claide (>= 1.0.1, < 2.0)
unicode-display_width (1.4.0)
xcodeproj (1.7.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.3)
nanaimo (~> 0.2.6)

PLATFORMS
ruby

DEPENDENCIES
cocoapods
cocoapods (~> 1.6.0.beta)
danger

BUNDLED WITH
1.15.1
1.16.6
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ archive:
release: package archive portable_zip

docker_test:
docker run -v `pwd`:`pwd` -w `pwd` --name swiftlint --rm norionomura/swift:40 swift test --parallel
docker run -v `pwd`:`pwd` -w `pwd` --name swiftlint --rm norionomura/swift:42 swift test --parallel

docker_htop:
docker run -it --rm --pid=container:swiftlint terencewestphal/htop || reset
Expand All @@ -130,7 +130,7 @@ display_compilation_time:

publish:
brew update && brew bump-formula-pr --tag=$(shell git describe --tags) --revision=$(shell git rev-parse HEAD) swiftlint
pod trunk push SwiftLintFramework.podspec --allow-warnings --swift-version=4.2
pod trunk push SwiftLintFramework.podspec --swift-version=4.2
pod trunk push SwiftLint.podspec --swift-version=4.2

get_version:
Expand Down
16 changes: 8 additions & 8 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
"repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift.git",
"state": {
"branch": null,
"revision": "f2ca9c377d4b44596a131e37eeb908221fb6e6be",
"version": "0.8.3"
"revision": "874280173e082cdd7ac6602be235914efe3f4dbc",
"version": "0.13.0"
}
},
{
"package": "Nimble",
"repositoryURL": "https://github.com/Quick/Nimble.git",
"state": {
"branch": null,
"revision": "7c61d8e7e830dd37f7161ce2b894be178532163c",
"version": "7.3.0"
"revision": "cd6dfb86f496fcd96ce0bc6da962cd936bf41903",
"version": "7.3.1"
}
},
{
"package": "Quick",
"repositoryURL": "https://github.com/Quick/Quick.git",
"state": {
"branch": null,
"revision": "b060679e70d13c3c7dcd124201b5b1b34ce6f340",
"version": "1.3.1"
"revision": "5fbf13871d185526993130c3a1fad0b70bfe37ce",
"version": "1.3.2"
}
},
{
Expand Down Expand Up @@ -69,8 +69,8 @@
"repositoryURL": "https://github.com/drmohundro/SWXMLHash.git",
"state": {
"branch": null,
"revision": "24698592b581aef2bdbfc86ce18695708038c624",
"version": "4.7.1"
"revision": "b130217d81833cecd7ddf78b76d60200f1070d98",
"version": "4.7.4"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
.package(url: "https://github.com/Carthage/Commandant.git", from: "0.15.0"),
.package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.21.2"),
.package(url: "https://github.com/jpsim/Yams.git", from: "1.0.1"),
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", "0.8.0"..<"0.9.0"),
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "0.13.0"),
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.8.2"),
],
targets: [
Expand Down
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ running it.
### Compiling from source:

You can also build from source by cloning this project and running
`git submodule update --init --recursive; make install` (Xcode 9.0 or later).
`git submodule update --init --recursive; make install` (Xcode 10.0 or later).

## Usage

Expand Down Expand Up @@ -207,12 +207,13 @@ environment variable.

Here's a reference of which SwiftLint version to use for a given Swift version.

| Swift version | Last supported SwiftLint release |
| ------------- | -------------------------------- |
| Swift 1.x | SwiftLint 0.1.2 |
| Swift 2.x | SwiftLint 0.18.1 |
| Swift 3.x | Latest |
| Swift 4.x | Latest |
| Swift version | Last supported SwiftLint release |
|:----------------|:---------------------------------|
| Swift 1.x | SwiftLint 0.1.2 |
| Swift 2.x | SwiftLint 0.18.1 |
| Swift 3.x | SwiftLint 0.25.1 |
| Swift 4.0-4.1.x | SwiftLint 0.28.1 |
| Swift 4.2+ | Latest |

## Rules

Expand Down
13 changes: 7 additions & 6 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ $ TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 swiftlint autocorrect

这里有一份 SwiftLint 版本和对应该 Swift 版本的对照表作为参考。

| Swift 版本 | 最后一个 SwiftLint 支持版本 |
| ------------- | -------------------------------- |
| Swift 1.x | SwiftLint 0.1.2 |
| Swift 2.x | SwiftLint 0.18.1 |
| Swift 3.x | 最新的 |
| Swift 4.x | 最新的 |
| Swift 版本 | 最后一个 SwiftLint 支持版本 |
|:----------------|:----------------------------|
| Swift 1.x | SwiftLint 0.1.2 |
| Swift 2.x | SwiftLint 0.18.1 |
| Swift 3.x | SwiftLint 0.25.1 |
| Swift 4.0-4.1.x | SwiftLint 0.28.1 |
| Swift 4.2+ | 最新的 |

## 规则

Expand Down
15 changes: 15 additions & 0 deletions Rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -16859,6 +16859,21 @@ let foo = ["אבג", "αβγ", "🇺🇸"↓,]
```
```swift
class C {
#if true
func f() {
let foo = [1, 2, 3↓,]
}
#endif
}
```
```swift
foo([1: "\(error)"↓,])
```
</details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,7 @@ extension Configuration {
return nil
}

let isDirectory: Bool
#if os(Linux) && !swift(>=4.1)
isDirectory = isDirectoryObjC
#else
isDirectory = isDirectoryObjC.boolValue
#endif

if isDirectory {
if isDirectoryObjC.boolValue {
return rootPath
} else {
return rootPath.bridge().deletingLastPathComponent
Expand Down
4 changes: 0 additions & 4 deletions Source/SwiftLintFramework/Extensions/String+SwiftLint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ extension String {
internal var isFile: Bool {
var isDirectoryObjC: ObjCBool = false
if FileManager.default.fileExists(atPath: self, isDirectory: &isDirectoryObjC) {
#if os(Linux) && !swift(>=4.1)
return !isDirectoryObjC
#else
return !isDirectoryObjC.boolValue
#endif
}
return false
}
Expand Down
11 changes: 0 additions & 11 deletions Source/SwiftLintFramework/Extensions/shim.swift

This file was deleted.

Loading

0 comments on commit 5901d30

Please sign in to comment.