Skip to content

Commit

Permalink
Merge branch 'fix-swiftlint-warnings'
Browse files Browse the repository at this point in the history
  • Loading branch information
buggmagnet committed Aug 14, 2024
2 parents cf3a7bd + 28a337c commit 7781ac5
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 20 deletions.
1 change: 1 addition & 0 deletions ios/.swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ disabled_rules:
- opening_brace # Differs from Google swift guidelines enforced by swiftformat
- trailing_comma
- switch_case_alignment # Enables expressions such as [return switch location {}]
- orphaned_doc_comment
opt_in_rules:
- empty_count

Expand Down
2 changes: 1 addition & 1 deletion ios/MullvadREST/ApiHandlers/RESTRequestFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension REST {
let networkTimeout: Duration
let bodyEncoder: JSONEncoder

class func withDefaultAPICredentials(
static func withDefaultAPICredentials(
pathPrefix: String,
bodyEncoder: JSONEncoder
) -> RequestFactory {
Expand Down
7 changes: 1 addition & 6 deletions ios/MullvadSettings/SettingsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ public enum SettingsManager {

public static func getLastUsedAccount() throws -> String {
let data = try store.read(key: .lastUsedAccount)

if let string = String(data: data, encoding: .utf8) {
return string
} else {
throw StringDecodingError(data: data)
}
return String(decoding: data, as: UTF8.self)
}

public static func setLastUsedAccount(_ string: String?) throws {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class StorePaymentManager: NSObject, SKPaymentTransactionObserver {
private var paymentToAccountToken = [SKPayment: String]()

/// Returns true if the device is able to make payments.
class var canMakePayments: Bool {
static var canMakePayments: Bool {
SKPaymentQueue.canMakePayments()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ extension LocationCellViewModel {
return false
}

var proxyNode = RootLocationNode(children: [node])
let proxyNode = RootLocationNode(children: [node])
let allLocations = Set(proxyNode.flattened.flatMap { $0.locations })
let hostCount = allLocations.filter { location in
if case .hostname = location { true } else { false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ final class TunnelControlView: UIView {
)
}

private class func makeBoldTextLabel(ofSize fontSize: CGFloat, numberOfLines: Int = 1) -> UILabel {
private static func makeBoldTextLabel(ofSize fontSize: CGFloat, numberOfLines: Int = 1) -> UILabel {
let textLabel = UILabel()
textLabel.translatesAutoresizingMaskIntoConstraints = false
textLabel.font = UIFont.boldSystemFont(ofSize: fontSize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import XCTest
final class APIAccessMethodsTests: XCTestCase {
static let store = InMemorySettingsStore<SettingNotFound>()

override class func setUp() {
override static func setUp() {
SettingsManager.unitTestStore = store
}

override class func tearDown() {
override static func tearDown() {
SettingsManager.unitTestStore = nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ final class IPOverrideRepositoryTests: XCTestCase {
static let store = InMemorySettingsStore<SettingNotFound>()
let repository = IPOverrideRepository()

override class func setUp() {
override static func setUp() {
SettingsManager.unitTestStore = store
}

override class func tearDown() {
override static func tearDown() {
SettingsManager.unitTestStore = nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ final class MigrationManagerTests: XCTestCase {
static let store = InMemorySettingsStore<SettingNotFound>()

var manager: MigrationManager!
override class func setUp() {
override static func setUp() {
SettingsManager.unitTestStore = store
}

override class func tearDown() {
override static func tearDown() {
SettingsManager.unitTestStore = nil
}

Expand Down Expand Up @@ -72,7 +72,7 @@ final class MigrationManagerTests: XCTestCase {

func testFailedMigrationResetsSettings() throws {
let store = Self.store
let data = try XCTUnwrap("Migration test".data(using: .utf8))
let data = Data("Migration test".utf8)
try store.write(data, for: .settings)
try store.write(data, for: .deviceState)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class TunnelManagerTests: XCTestCase {

var transportProvider: TransportProvider!

override class func setUp() {
override static func setUp() {
SettingsManager.unitTestStore = store
}

override class func tearDown() {
override static func tearDown() {
SettingsManager.unitTestStore = nil
}

Expand Down
2 changes: 1 addition & 1 deletion ios/PacketTunnelCore/Pinger/Pinger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public final class Pinger: PingerProtocol {
}
}

private class func makeIPAddress(from sa: sockaddr) -> IPAddress? {
private static func makeIPAddress(from sa: sockaddr) -> IPAddress? {
if sa.sa_family == AF_INET {
return withUnsafeBytes(of: sa) { buffer -> IPAddress? in
buffer.bindMemory(to: sockaddr_in.self).baseAddress.flatMap { boundPointer in
Expand Down

0 comments on commit 7781ac5

Please sign in to comment.