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 four to SwiftVersion #1716

Merged
merged 1 commit into from
Jul 27, 2017
Merged

Add four to SwiftVersion #1716

merged 1 commit into from
Jul 27, 2017

Conversation

marcelofabri
Copy link
Collaborator

This will allow rules like #1714 to be implemented.

Credits to @ornithocoder for the idea of using #if swift.

@SwiftLintBot
Copy link

1 Warning
⚠️ Please include a CHANGELOG entry to credit yourself!
You can find it at CHANGELOG.md.
12 Messages
📖 Linting Aerial with this PR took 0.36s vs 0.33s on master (9% slower)
📖 Linting Alamofire with this PR took 2.46s vs 2.46s on master (0% slower)
📖 Linting Firefox with this PR took 10.5s vs 10.72s on master (2% faster)
📖 Linting Kickstarter with this PR took 15.27s vs 15.48s on master (1% faster)
📖 Linting Moya with this PR took 0.7s vs 0.75s on master (6% faster)
📖 Linting Nimble with this PR took 1.39s vs 1.45s on master (4% faster)
📖 Linting Quick with this PR took 0.44s vs 0.47s on master (6% faster)
📖 Linting Realm with this PR took 2.13s vs 2.28s on master (6% faster)
📖 Linting SourceKitten with this PR took 0.82s vs 0.81s on master (1% slower)
📖 Linting Sourcery with this PR took 3.49s vs 3.56s on master (1% faster)
📖 Linting Swift with this PR took 9.99s vs 10.27s on master (2% faster)
📖 Linting WordPress with this PR took 9.55s vs 9.38s on master (1% slower)

Here's an example of your CHANGELOG entry:

* Add four to SwiftVersion.  
  [marcelofabri](https://github.com/marcelofabri)
  [#issue_number](https://github.com/realm/SwiftLint/issues/issue_number)

note: There are two invisible spaces after the entry's text.

Generated by 🚫 Danger

@codecov-io
Copy link

Codecov Report

Merging #1716 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1716   +/-   ##
=======================================
  Coverage   87.43%   87.43%           
=======================================
  Files         208      208           
  Lines       10291    10291           
=======================================
  Hits         8998     8998           
  Misses       1293     1293

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d61ec1...7c5da2f. Read the comment docs.

@jpsim
Copy link
Collaborator

jpsim commented Jul 27, 2017

Does the same approach not work for #if swift(>=3.2)?

Also, kind of a shame that SourceKit itself can't be used to query the Swift version it was built with. There's a "protocol version" request you can make, but that's always been 1.0: https://github.com/apple/swift/blob/master/tools/SourceKit/docs/Protocol.md#protocol-version

@marcelofabri
Copy link
Collaborator Author

Does the same approach not work for #if swift(>=3.2)?

Yes, but that is also true for Swift 4. Since they're the same compiler, just with different modes, I don't even know how SourceKit deals with that (maybe it doesn't?).

There's a "protocol version" request you can make, but that's always been 1.0

Yeah, I've tried that too 😢

@jpsim
Copy link
Collaborator

jpsim commented Jul 27, 2017

Anyway, 👍

@marcelofabri marcelofabri merged commit 8ae9635 into master Jul 27, 2017
@marcelofabri marcelofabri deleted the mf-recognize-swift-4 branch July 27, 2017 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants