Skip to content
New issue

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

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

Already on GitHub? # to your account

Swift version specific rules #700

Closed
jonah-williams opened this issue Jun 17, 2016 · 2 comments
Closed

Swift version specific rules #700

jonah-williams opened this issue Jun 17, 2016 · 2 comments

Comments

@jonah-williams
Copy link

Do you all have thoughts about how to manage sets of rules which are Swift 2.3 or Swift 3.0 specific?

Given Xcode 8 supporting both Swift versions how might we allow developers using SwiftLint to specify which set of rules should apply to a specific project? We could maintain rules with different names and include and exclude them individually but that's not a great interface to work with.

Should we specify the swift version as part of of our .swiftlint.yml? Could we resolve this at the same time as #221 by specifying a version of the ruleset to apply?

@jpsim
Copy link
Collaborator

jpsim commented Jun 17, 2016

SwiftLint works against any Swift version after 1.0, and will resolve the Swift version to use in the following order:

  • $XCODE_DEFAULT_TOOLCHAIN_OVERRIDE
  • $TOOLCHAIN_DIR
  • xcrun -find swift
  • /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • ~/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • ~/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain

That being said, I'm not aware of any rule that semantically should behave differently across Swift versions other than the change that came in #660.

If you can think of other rules that might need to behave differently with Swift 3, please let us know!

@jpsim
Copy link
Collaborator

jpsim commented Jan 21, 2017

As of #1081, we can detect the current Swift version and adjust rule behavior based on that.

@jpsim jpsim closed this as completed Jan 21, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants