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

Use SwiftLint via CocoaPods #78

Merged
merged 9 commits into from
Apr 9, 2018
Merged

Use SwiftLint via CocoaPods #78

merged 9 commits into from
Apr 9, 2018

Conversation

djbe
Copy link
Member

@djbe djbe commented Mar 27, 2018

Copy link
Contributor

@AliSoftware AliSoftware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically almost same remarks/questions as in SwiftGen/SwiftGen#401 😉

- type_name

opt_in_rules:
- force_unwrapping
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍, + 💯

XCTAssertTrue(try Filters.parseBool(from: ["true"])!)
XCTAssertTrue(try Filters.parseBool(from: ["yes"])!)
XCTAssertTrue(try Filters.parseBool(from: ["1"])!)
// swiftlint:enable force_unwrapping
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should instead use XCTAssertTrue((try …) ?? false) or XCTAssertEquals(try …, true) to avoid the force-unwrap here? Especially, in case there's a regression one day and the test parseBool(from: ["true"]) starts to fail and return an unexpected nil, that force-unwrap will make the test harness crash and stop the whole test process, instead of marking that test as failed and continue with other test cases…

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd have to be careful then to provide the "inverse" value as a fallback for each test. Here it's true, for the parseBool(from: ["false"]) it should be false, ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's why I'd prefer to use the more readable XCTAssertEquals(…, true) there rather than XCTAssertTrue(… ?? false)

@@ -4,7 +4,6 @@ machine:

dependencies:
post:
- bundle exec rake lint:install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same questions as in SwiftGen/SwiftGen#401 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same answer :trollface:

task :code do |task|
Utils.print_header 'Linting the code'
config = Pathname.getwd + '.swiftlint.yml'
Utils.run(%(#{SWIFTLINT} lint --strict --path Sources --config "#{config}"), task)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#!/bin/bash

SWIFTLINT="$(PWD)/Pods/SwiftLint/swiftlint"
CONFIG="$(PWD)/.swiftlint.yml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djbe djbe merged commit 6c16ba3 into master Apr 9, 2018
@djbe djbe deleted the feature/swiftlint-pod branch April 9, 2018 14:54
@djbe djbe added this to the 2.5.0 milestone Oct 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants