Skip to content

Commit

Permalink
Merge pull request #170 from tbaranes/hotfix/swiftlint
Browse files Browse the repository at this point in the history
Bump SwiftLint 0.17.0
  • Loading branch information
bizz84 authored Mar 28, 2017
2 parents 1cfe1a9 + 768460a commit a1ce322
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 19 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# rule identifiers to exclude from running
disabled_rules:
- line_length
- identifier_name

# configurable rules can be customized from this configuration file
line_length: 250
Expand Down
2 changes: 1 addition & 1 deletion SwiftyStoreKit-iOS-Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
SwiftyStoreKit.completeTransactions(atomically: true) { products in

for product in products {

// swiftlint:disable:next for_where
if product.transaction.transactionState == .purchased || product.transaction.transactionState == .restored {

if product.needsFinishTransaction {
Expand Down
8 changes: 3 additions & 5 deletions SwiftyStoreKit-iOS-Demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,9 @@ class ViewController: UIViewController {
SwiftyStoreKit.restorePurchases(atomically: true) { results in
NetworkActivityIndicatorManager.networkOperationFinished()

for product in results.restoredProducts {
for product in results.restoredProducts where product.needsFinishTransaction {
// Deliver content from server, then:
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
SwiftyStoreKit.finishTransaction(product.transaction)
}
self.showAlert(self.alertForRestorePurchases(results))
}
Expand Down Expand Up @@ -196,7 +194,7 @@ extension ViewController {
}

func showAlert(_ alert: UIAlertController) {
guard let _ = self.presentedViewController else {
guard self.presentedViewController != nil else {
self.present(alert, animated: true, completion: nil)
return
}
Expand Down
2 changes: 1 addition & 1 deletion SwiftyStoreKit-macOS-Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
SwiftyStoreKit.completeTransactions(atomically: true) { products in

for product in products {

// swiftlint:disable:next for_where
if product.transaction.transactionState == .purchased || product.transaction.transactionState == .restored {

if product.needsFinishTransaction {
Expand Down
6 changes: 2 additions & 4 deletions SwiftyStoreKit-macOS-Demo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,9 @@ class ViewController: NSViewController {

SwiftyStoreKit.restorePurchases(atomically: true) { results in

for product in results.restoredProducts {
for product in results.restoredProducts where product.needsFinishTransaction {
// Deliver content from server, then:
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
SwiftyStoreKit.finishTransaction(product.transaction)
}

self.showAlert(self.alertForRestorePurchases(results))
Expand Down
6 changes: 2 additions & 4 deletions SwiftyStoreKit/PaymentsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ class PaymentsController: TransactionController {
private var payments: [Payment] = []

private func findPaymentIndex(withProductIdentifier identifier: String) -> Int? {
for payment in payments {
if payment.product.productIdentifier == identifier {
return payments.index(of: payment)
}
for payment in payments where payment.product.productIdentifier == identifier {
return payments.index(of: payment)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion SwiftyStoreKitTests/PaymentQueueControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class PaymentQueueControllerTests: XCTestCase {

let spy = PaymentQueueSpy()

let _ = PaymentQueueController(paymentQueue: spy)
_ = PaymentQueueController(paymentQueue: spy)

XCTAssertNil(spy.observer)
}
Expand Down
4 changes: 2 additions & 2 deletions SwiftyStoreKitTests/PaymentsControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class PaymentsControllerTests: XCTestCase {
let payment = makeTestPayment(product: testProduct) { result in

callbackCalled = true
if case .failed(_) = result {
if case .failed = result {

} else {
XCTFail("expected failed callback with error")
Expand Down Expand Up @@ -124,7 +124,7 @@ class PaymentsControllerTests: XCTestCase {
var callback2Called = false
let payment2 = makeTestPayment(product: testProduct2) { result in
callback2Called = true
if case .failed(_) = result {
if case .failed = result {

} else {
XCTFail("expected failed callback with error")
Expand Down
2 changes: 1 addition & 1 deletion SwiftyStoreKitTests/RestorePurchasesControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class RestorePurchasesControllerTests: XCTestCase {

XCTAssertEqual(results.count, 1)
let first = results.first!
if case .failed(_) = first {
if case .failed = first {

} else {
XCTFail("expected failed callback with error")
Expand Down

0 comments on commit a1ce322

Please sign in to comment.