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

Plans for Swift 3 #816

Closed
cfilipov opened this issue Sep 15, 2016 · 12 comments
Closed

Plans for Swift 3 #816

cfilipov opened this issue Sep 15, 2016 · 12 comments
Labels
discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions.

Comments

@cfilipov
Copy link
Contributor

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.

  1. Are there plans to update this project to Swift 3 (the source code itself)?
    1. Of course this requires the dependencies be updated.
    2. Is this even necessary for linting Swift 3 code? I assume yes.
  2. Can/will SwiftLint handle multiple versions of Swift?
    1. It's likely people will have multiple projects at various stages of migration, but only a single installation of SwiftLint.
    2. One option would be for Swift 2.x SwiftLint to ignore Swift 3.x and Swift 3.x SwiftLint to treat all Swift 2.x as a rule violation (now that Swift 3 is released).
    3. Although the majority of breaking changes are behind us, there is still the possibility that new versions of Swift can introduce or remove features that result in lint errors. It would be helpful if SwiftLint had at least some rudimentary handling of multiple Swift versions.
  3. What happens when the current version of SwiftLint is run on a Swift 3 project? False positives? Does it know to ignore these files?

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.

@Reedyuk
Copy link

Reedyuk commented Sep 16, 2016

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.

@norio-nomura
Copy link
Collaborator

norio-nomura commented Sep 19, 2016

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.

@norio-nomura
Copy link
Collaborator

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.

@cfilipov
Copy link
Contributor Author

So you are saying each rule could support multiple versions of Swift by implementing validateSwift2_2File, validateSwift2_3File, validateSwift3_0Fileetc..?

@norio-nomura
Copy link
Collaborator

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.

@SerenadeX
Copy link

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?

@norio-nomura
Copy link
Collaborator

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.

@norio-nomura norio-nomura added the discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions. label Oct 8, 2016
@alak
Copy link

alak commented Nov 4, 2016

any news about swift 3 support ?

@norio-nomura
Copy link
Collaborator

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 #832

@jpsim
Copy link
Collaborator

jpsim commented Nov 25, 2016

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.

@alak
Copy link

alak commented Nov 25, 2016 via email

@marcelofabri
Copy link
Collaborator

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions.
Projects
None yet
Development

No branches or pull requests

7 participants