Skip to content

Commit ff78b6e

Browse files
committed
Fix linting issues.
1 parent 7e81982 commit ff78b6e

File tree

6 files changed

+20
-19
lines changed

6 files changed

+20
-19
lines changed

.swiftlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ disabled_rules:
44
- switch_case_alignment
55
- type_body_length
66
- identifier_name
7+
- trailing_comma
78

89
opt_in_rules:
910
- anyobject_protocol

Example/DeviceKitPlayground.playground/Contents.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ if Device.volumeAvailableCapacityForImportantUsage ?? 0 > Int64(1_000) {
9696
// Get the underlying device
9797
let simulator = Device.simulator(.iPhone8Plus)
9898
let realDevice = Device.iPhone8Plus
99-
simulator.realDevice == realDevice // true
100-
realDevice.realDevice == realDevice // true
99+
100+
_ = simulator.realDevice == realDevice // true
101+
_ = realDevice.realDevice == realDevice // true
101102

102103
// Get device thermal state
103104
if device.thermalState == .nominal {

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// swift-tools-version:5.3
2-
//===----------------------------------------------------------------------===//
2+
// ===----------------------------------------------------------------------=== //
33
//
44
// This source file is part of the DeviceKit open source project
55
//
@@ -8,7 +8,7 @@
88
// License: https://github.com/dennisweissmann/DeviceKit/blob/master/LICENSE
99
// Contributors: https://github.com/dennisweissmann/DeviceKit#contributors
1010
//
11-
//===----------------------------------------------------------------------===//
11+
// ===----------------------------------------------------------------------=== //
1212

1313
import PackageDescription
1414

Source/Device.generated.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@ extension Device {
21272127

21282128
/// The volume’s available capacity in bytes for storing nonessential resources.
21292129
@available(iOS 11.0, *)
2130-
public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { //swiftlint:disable:this identifier_name
2130+
public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { // swiftlint:disable:this identifier_name
21312131
return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForOpportunisticUsageKey]))?.volumeAvailableCapacityForOpportunisticUsage
21322132
}
21332133

Source/Device.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1268,7 +1268,7 @@ extension Device {
12681268

12691269
/// The volume’s available capacity in bytes for storing nonessential resources.
12701270
@available(iOS 11.0, *)
1271-
public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { //swiftlint:disable:this identifier_name
1271+
public static var volumeAvailableCapacityForOpportunisticUsage: Int64? { // swiftlint:disable:this identifier_name
12721272
return (try? rootURL.resourceValues(forKeys: [.volumeAvailableCapacityForOpportunisticUsageKey]))?.volumeAvailableCapacityForOpportunisticUsage
12731273
}
12741274

Tests/Tests.swift

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===----------------------------------------------------------------------===//
1+
// ===----------------------------------------------------------------------=== //
22
//
33
// This source file is part of the DeviceKit open source project
44
//
@@ -7,7 +7,7 @@
77
// License: https://github.com/dennisweissmann/DeviceKit/blob/master/LICENSE
88
// Contributors: https://github.com/dennisweissmann/DeviceKit#contributors
99
//
10-
//===----------------------------------------------------------------------===//
10+
// ===----------------------------------------------------------------------=== //
1111

1212
@testable import DeviceKit
1313
import XCTest
@@ -325,7 +325,7 @@ class DeviceKitTests: XCTestCase {
325325
XCTAssertEqual(Device.unknown(UUID().uuidString).diagonal, -1)
326326
}
327327

328-
func testDescription() { // swiftlint:disable:this function_body_length
328+
func testDescription() {
329329
XCTAssertEqual(Device.iPodTouch5.description, "iPod touch (5th generation)")
330330
XCTAssertEqual(Device.iPodTouch6.description, "iPod touch (6th generation)")
331331
XCTAssertEqual(Device.iPodTouch7.description, "iPod touch (7th generation)")
@@ -616,16 +616,15 @@ class DeviceKitTests: XCTestCase {
616616
XCTAssertTrue(device.hasCamera)
617617
XCTAssertTrue(device.hasWideCamera || device.hasTelephotoCamera || device.hasUltraWideCamera)
618618
}
619-
for device in Device.allPhones + Device.allPads + Device.allPods {
620-
if !Device.allDevicesWithCamera.contains(device) {
621-
XCTAssertFalse(device.cameras.contains(.wide))
622-
XCTAssertFalse(device.cameras.contains(.telephoto))
623-
XCTAssertFalse(device.cameras.contains(.ultraWide))
624-
XCTAssertFalse(device.hasCamera)
625-
XCTAssertFalse(device.hasWideCamera)
626-
XCTAssertFalse(device.hasTelephotoCamera)
627-
XCTAssertFalse(device.hasUltraWideCamera)
628-
}
619+
let devices = Device.allPhones + Device.allPads + Device.allPods
620+
for device in devices where !Device.allDevicesWithCamera.contains(device) {
621+
XCTAssertFalse(device.cameras.contains(.wide))
622+
XCTAssertFalse(device.cameras.contains(.telephoto))
623+
XCTAssertFalse(device.cameras.contains(.ultraWide))
624+
XCTAssertFalse(device.hasCamera)
625+
XCTAssertFalse(device.hasWideCamera)
626+
XCTAssertFalse(device.hasTelephotoCamera)
627+
XCTAssertFalse(device.hasUltraWideCamera)
629628
}
630629
for device in Device.allDevicesWithWideCamera {
631630
XCTAssertTrue(device.cameras.contains(.wide))

0 commit comments

Comments
 (0)