Closed cfilipov closed 7 years ago
I think it makes sense that the .swiftlint
file, determines the version of swift the project is using, that way it would work fine on CI's.
SourceKitten can use sourcekitd.framework
from Swift toolchains both of 2.x and 3.0.
So basically, we don't need migrating SwiftLint itself to Swift 3.0 for supporting lints codes written in Swift 3.0.
But, we may need to create testing method on both of Swift 2.x and Swift 3.0, if we would support both of them. If we would not support both of Swift 2.x and 3.0 simultaneously, users who needs both of them may be required to install multiple version of SwiftLint.
So you are saying each rule could support multiple versions of Swift by implementing validateSwift2_2File
, validateSwift2_3File
, validateSwift3_0File
etc..?
Yes. We can detect version of Swift by using such as #703, and run rules selected by that.
I guess we would be able to support versions of Swift that supported by single Xcode version, e.g. Swift 2.3 and 3.0 on Xcode 8.
One issue I am having is updating an existing installation of SwiftLint while Xcode 8 is installed. It won't work with brew
as it has to compile it after cloning it down. Any plans on making it work in at least Swift 2.3 so it can compile on install with Xcode 8?
master
branch is compatible with swift 2.3, but not yet released.
On Sierra with Xcode 8, please try brew install --HEAD swiftlint
for installing SwiftLint.
any news about swift 3 support ?
I think most rules are compatible with Swift 3 other than missing_docs
and valid_docs
.
Migrating SwiftLint itself to Swift 3 is tracking on https://github.com/realm/SwiftLint/pull/832
One thing to keep in mind is that the version of Swift used to build SwiftLint does not impact which versions of Swift can be linted or corrected by SwiftLint.
That's because SourceKit is dynamically found and linked at runtime, based on a hierarchy of search locations (see How is SourceKit resolved?).
SourceKit's API is fairly stable in practice, which makes it possible for a version of SwiftLint compiled with Swift 2.x to successfully lint or correct a codebase written with Swift 3.0.
However, Apple makes no guarantees about this and reserves the right to change things drastically with no warning or reason.
There are rare times where SourceKit does change in ways that affect SwiftLint, the removal of the __raw_doc_comment
attribute (#728/SR-2487) comes to mind as an example of this.
So when @Alak asks "any news about swift 3 support ?", well SwiftLint has supported it automatically as soon as the Swift 3 betas came out.
If there are specific issues with Swift 3 (such as #728), we ask that you be diligent about thoroughly reporting these as GitHub Issues, which we'll then be able to address on an individual basis.
Great answer, I will try it next week :). Thank you
Le sam. 26 nov. 2016 à 00:01, JP Simard notifications@github.com a écrit :
One thing to keep in mind is that the version of Swift used to build SwiftLint does not impact which versions of Swift can be linted or corrected by SwiftLint.
That's because SourceKit is dynamically found and linked at runtime, based on a hierarchy of search locations (see How is SourceKit resolved? https://github.com/jpsim/SourceKitten#how-is-sourcekit-resolved).
SourceKit's API is fairly stable in practice, which makes it possible for a version of SwiftLint compiled with Swift 2.x to successfully lint or correct a codebase written with Swift 3.0.
However, Apple makes no guarantees about this and reserves the right to change things drastically with no warning or reason.
There are rare times where SourceKit does change in ways that affect SwiftLint, the removal of the __raw_doc_comment attribute (#728 https://github.com/realm/SwiftLint/issues/728/SR-2487 https://bugs.swift.org/browse/SR-2487) comes to mind as an example of this.
So when @Alak https://github.com/Alak asks "any news about swift 3 support ?", well SwiftLint has supported it automatically as soon as the Swift 3 betas came out.
If there are specific issues with Swift 3 (such as #728 https://github.com/realm/SwiftLint/issues/728), we ask that you be diligent about thoroughly reporting these as GitHub Issues, which we'll then be able to address on an individual basis.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/realm/SwiftLint/issues/816#issuecomment-263030753, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIu6P8DQlTP19E9quTlowlrq8LOwtInks5rB2jMgaJpZM4J-Vn_ .
Closing this now since SwiftLint was migrated to Swift 3 in #832 and there're specific issues for Swift 3 bugs/enhancements (such as #728).
I searched and found a number of issues that mention Swift 3, but nothing specifically about this project as a whole, forgive me if this has already been brought up. A recent comment on #781 has got me thinking about Swift 3 support and how it will work with SwiftLint.
I think these things should be mentioned in the README. I am particularly concerned about those of us who have SwiftLint as part of their CI process and using it in git hooks. Once people start updating their projects to Swift 3 or updating to a new SwiftLint with older projects things should be handled as gracefully as possible.