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

Fix SonarCloud Empty Closure warning #293

Merged
merged 2 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions OmiseSDK/Sources/OmiseSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class OmiseSDK {
public static var shared = OmiseSDK(publicKey: "pkey_")

/// OmiseSDK version
public let version: String = "5.2.0"
public let version: String = "5.2.1"

/// Public Key associated with this instance of OmiseSDK
public let publicKey: String
Expand Down Expand Up @@ -219,7 +219,9 @@ public class OmiseSDK {

private extension OmiseSDK {
private func preloadCapabilityAPI() {
client.capability { _ in }
client.capability { _ in
// Preload capability and auto cache it as client.latestLoadedCapability
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions OmiseSDK/Sources/Views/Components/TextFieldView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ class TextFieldView: UIView {
}()

var onTextFieldShouldReturn: () -> (Bool) = { return false }
var onTextChanged: () -> Void = { }
var onBeginEditing: () -> Void = { }
var onEndEditing: () -> Void = { }
var onTextChanged: () -> Void = { /* Non-optional default empty implementation */ }
var onBeginEditing: () -> Void = { /* Non-optional default empty implementation */ }
var onEndEditing: () -> Void = { /* Non-optional default empty implementation */ }

// swiftlint:disable attributes
@ProxyProperty(\TextFieldView.textField.keyboardType) var keyboardType: UIKeyboardType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class OmiseTextField: UITextField {
}

public var onTextFieldShouldReturn: () -> (Bool) = { return false }
public var onValueChanged: () -> Void = { }
public var onValueChanged: () -> Void = { /* Non-optional default empty implementation */ }

@IBInspectable var borderWidth: CGFloat {
get {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AtomePaymentFormViewModel: AtomePaymentFormViewModelProtocol, CountryListV
}
}

var onSelectCountry: (Country) -> Void = { _ in }
var onSelectCountry: (Country) -> Void = { _ in /* Non-optional default empty implementation */ }

var countryListViewModel: CountryListViewModelProtocol { return self }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import UIKit

class PaymentFormController: UIViewController {
var onSubmitButtonTappedClosure: () -> Void = { }
var onSubmitButtonTappedClosure: () -> Void = { /* Non-optional default empty implementation */ }

@ProxyProperty(\PaymentFormController.headerTextLabel.text)
var details: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class FPXPaymentFormController: UIViewController, PaymentFormUIController {

@IBAction private func submitForm(_ sender: AnyObject) {
emailValue = emailTextField.text?.trimmingCharacters(in: CharacterSet.whitespaces)
delegate?.fpxDidCompleteWith(email: emailValue) {}
delegate?.fpxDidCompleteWith(email: emailValue) { /* no action is required */ }
}

@IBAction private func validateFieldData(_ textField: OmiseTextField) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ class SelectPaymentController: UITableViewController {

let viewModel: SelectPaymentPresentableProtocol

var customizeCellAtIndexPathClosure: (UITableViewCell, IndexPath) -> Void = { _, _ in }
var customizeCellAtIndexPathClosure: (UITableViewCell, IndexPath) -> Void = { _, _ in
// Non-optional default empty implementation
}

init(viewModel: SelectPaymentPresentableProtocol) {
self.viewModel = viewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ extension SelectPaymentPresentableProtocol {
var errorMessage: String? { nil }
var viewShowsCloseButton: Bool { false }
var viewDisplayLargeTitle: Bool { false }
func viewDidTapClose() {}
func viewDidTapClose() { /* Default empty implementation */ }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import UIKit
class SelectDuitNowOBWBankViewModel {
private weak var delegate: SelectSourcePaymentDelegate?

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SelectFPXBankViewModel {

let errorMessage: String?

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SelectInstallmentTermsViewModel {
weak var delegate: SelectSourcePaymentDelegate?
let sourceType: SourceType

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SelectPaymentMethodViewModel {
private let filter: Filter
private weak var delegate: SelectPaymentMethodDelegate?

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SelectSourceTypePaymentViewModel {
private weak var delegate: SelectSourceTypeDelegate?
private let title: String

private var viewOnDataReloadHandler: () -> Void = { } {
private var viewOnDataReloadHandler: () -> Void = { /* Non-optional default empty implementation */ } {
didSet {
self.viewOnDataReloadHandler()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CCVInfoController: UIViewController {
}
}

var onCloseTapped: () -> Void = { }
var onCloseTapped: () -> Void = { /* Non-optional default empty implementation */ }

override func viewDidLoad() {
super.viewDidLoad()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class CreditCardPaymentViewModel: CreditCardPaymentViewModelProtocol, CountryLis
}
}
}
var onSelectCountry: (Country) -> Void = { _ in }

var onSelectCountry: (Country) -> Void = { _ in /* Non-optional default empty implementation */ }

func error(for field: AddressField, validate text: String?) -> String? {
guard isAddressFieldsVisible else { return nil }
Expand Down
Loading