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

Recommend a linter for Swift? #10

Closed
kytrinyx opened this issue Aug 17, 2014 · 12 comments
Closed

Recommend a linter for Swift? #10

kytrinyx opened this issue Aug 17, 2014 · 12 comments
Labels

Comments

@kytrinyx
Copy link
Member

This may or may not be appropriate in this language. See exercism/docs#54 for details.

@masters3d
Copy link
Contributor

There is an experimental one
https://github.com/realm/SwiftLint

@masters3d
Copy link
Contributor

We probably wont have a real linter for some time.

@yurrriq
Copy link
Member

yurrriq commented Jan 9, 2016

👍 for SwiftLint!

@jonallured
Copy link
Contributor

I've been using SwiftLint on a production project and we've really liked it. Also, houndci.com supports Swift. What's important to me is having some sort of consistency, which ruleset is used less so.

What can I do to move this forward?

@masters3d
Copy link
Contributor

hound looks interesting. https://houndci.com/configuration#swift
@kytrinyx what do you think?

@masters3d
Copy link
Contributor

This would be something that would fit perfectly when we move to swift 3 in a couple of months.

@kytrinyx
Copy link
Member Author

kytrinyx commented Jun 5, 2016

I haven't written any swift, so I don't have a basis for comparison.

@marianaiam have you by any chance written enough Swift in production to have experiential knowledge of linters and style rules?

@yurrriq
Copy link
Member

yurrriq commented Jun 5, 2016

It looks like Hound CI wraps SwiftLint. I've found SwiftLint to be great over the last n months and would definitely recommend it. Perhaps the real question is: what's a good config to recommend?

@masters3d
Copy link
Contributor

I think the default rules are fine except for these:

disabled_rules: # rule identifiers to exclude from running
  - force_try
  - function_body_length
  - line_length
  - variable_name

The reason is that some of the tests have really long lines while others use force try to keep the code simple for the tests. Variable names rule is really opinionated as it won't even allow short variables like i

I am going to turn on the swiftlinter as part of Travis when we update to swift 3.0
#155

@jonallured
Copy link
Contributor

jonallured commented Jun 20, 2016

@masters3d agreed!

The only quibble I'd have is the variable names one: I think short var names are an anti-pattern, but maybe not worth having the linter complain?

@masters3d
Copy link
Contributor

I guess instead of disabling variable_name we could downgrade it to a warning instead of an error.

variable_name: 
    min_length: 
        warning: 1
        error: 0

force_try: warning

disabled_rules: # rule identifiers to exclude from running
  - function_body_length
  - line_length

masters3d added a commit that referenced this issue Jul 19, 2016
* [wip] remove swift 3 directive

* [wip] mechanical transition with code migrator

* Swift 3 preview 1 changes

* travis xcode8 update

* travis update OS X 10.12

* updated documentation to swift 3 and Xcode 8

* Removed "Foundation not needed" comment

Unlike Objc, swift doesn’t need foundation for most simple operations.
I was planning to remove the foundation requirement but now swift 3.0
will provide a Swift version of foundation.
https://github.com/apple/swift-corelibs-foundation

* ran swiftLink locally with autocorrect

- This next step is to turn this on on Travis CI to warn on commit

* travis update with swiftlint

* update travis

* added swiftlint rules yml

* update read me with contribution guides

closes #66

* update swiftLint rules

* force swift3 for XCTest classes by using compiler directive.

By wrapping the import to only import when swift 3 is present I am
hoping to impress to users that swift 3 is required. Plus this would
make it easy to go back and keep requiring a certain a version  in the
future.

* BinarySearchTree using indirect enums

closes #152

reference:
https://airspeedvelocity.net/2015/07/22/a-persistent-tree-using-indirect
-enums-in-swift/

* update swiftlint format requirement

update swift lint doc and script in Xcode project
`swiftlint autocorrect --format`

* operator_whitespace removal

* removed leading white space

* mid triple new lines clean up

* closes #10
@masters3d
Copy link
Contributor

We are adopting SwiftLint for swift3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants