JohnSundell / Marathon

[DEPRECATED] Marathon makes it easy to write, run and manage your Swift scripts πŸƒ
MIT License
1.86k stars 78 forks source link

Introduce SwiftLint tool to enforce Swift style and conventions #61

Closed pixyzehn closed 7 years ago

pixyzehn commented 7 years ago

Introduced SwiftLint and Fixed warnings and errors. Now Marathon doesn't have xcodeproj, so we just run SwiftLint in CI or each local env.

In type_body_length and file_length, I adjusted the boundary value based on the following warnings and errors

Marathon/Tests/MarathonTests/MarathonTests.swift:13:1: error: Type Body Length Violation: Type body should span 350 lines or less excluding comments and whitespace: currently spans 388 lines (type_body_length)
...

Marathon/Tests/MarathonTests/MarathonTests.swift:784: warning: File Line Length Violation: File should contain 400 lines or less: currently contains 784 (file_length)
...

Ref: https://github.com/krzysztofzablocki/Sourcery/blob/master/.swiftlint.yml https://www.buddybuild.com/blog/customizing-the-build-process

aksswami commented 7 years ago

We can also use SwiftFormat. The benefit of having SwiftFormat over SwiftLint is, it automate the process of maintaining one syntax styling. Whereas in SwiftLint it will generate all the warning and developer have to resolve these.

I would like a solution where a tool does this work for me, automatically.

pixyzehn commented 7 years ago

@aksswami I don't know the details, but you may use the same things by using swiftlint autocorrect.

pixyzehn commented 7 years ago

@JohnSundell Could you check my update?

JohnSundell commented 7 years ago

We could just execute swiftlint in our Travis & BuddyBuild scripts, right?

pixyzehn commented 7 years ago

@JohnSundell No problem:) Yes, we want!

We could just execute swiftlint in our Travis & BuddyBuild scripts, right?

That's right! But I think it's better to set it in other PR for now if possible. It needs some adjustments like installing SwiftLint by homebrew in Travis...

JohnSundell commented 7 years ago

@pixyzehn Sounds great! πŸ‘ Do you wanna create an issue for tracking adding this to CI? πŸ˜‰

pixyzehn commented 7 years ago

@JohnSundell Yes, I want! I'll investigate itπŸ‘ Thanks again!