Skip to content

Commit 67ec08e

Browse files
Mark Pospeselmpospese
authored andcommitted
[CM-995] Add new linter rules and fix warnings
1 parent e05d96b commit 67ec08e

File tree

9 files changed

+21
-42
lines changed

9 files changed

+21
-42
lines changed

.swiftlint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ opt_in_rules: # some rules are turned off by default, so you need to opt-in
99
- empty_count
1010
- first_where
1111
- force_unwrapping
12+
- implicit_return
13+
- missing_docs
1214
- multiline_arguments
1315
- multiline_arguments_brackets
1416
- multiline_function_chains

Sources/YCoreUI/Extensions/UIKit/UIColor+rgbComponents.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
import UIKit
1010

11+
// This relatively simple tuple (four float values representing the color channels)
12+
// is already a released public api.
13+
// swiftlint: disable large_tuple
14+
1115
/// Tuple representing Red, Green, Blue, and Alpha color channel components
1216
public typealias RGBAComponents = (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)
1317

Sources/YCoreUI/Extensions/UIKit/UIView+constrainEdges.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ import UIKit
1010

1111
extension NSDirectionalRectEdge {
1212
/// Horizontal edges only (consisting of `.leading` and `.trailing`)
13-
public static var horizontal: NSDirectionalRectEdge { return [.leading, .trailing] }
13+
public static var horizontal: NSDirectionalRectEdge { [.leading, .trailing] }
1414

1515
/// Vertical edges only (consisting of `.top` and `.bottom`)
16-
public static var vertical: NSDirectionalRectEdge { return [.top, .bottom] }
16+
public static var vertical: NSDirectionalRectEdge { [.top, .bottom] }
1717

1818
/// All edges except `.top`
19-
public static var notTop: NSDirectionalRectEdge { return [.leading, .bottom, .trailing] }
19+
public static var notTop: NSDirectionalRectEdge { [.leading, .bottom, .trailing] }
2020

2121
/// All edges except `.leading`
22-
public static var notLeading: NSDirectionalRectEdge { return [.top, .bottom, .trailing] }
22+
public static var notLeading: NSDirectionalRectEdge { [.top, .bottom, .trailing] }
2323

2424
/// All edges except `.bottom`
25-
public static var notBottom: NSDirectionalRectEdge { return [.top, .leading, .trailing] }
25+
public static var notBottom: NSDirectionalRectEdge { [.top, .leading, .trailing] }
2626

2727
/// All edges except `.trailing`
28-
public static var notTrailing: NSDirectionalRectEdge { return [.top, .leading, .bottom] }
28+
public static var notTrailing: NSDirectionalRectEdge { [.top, .leading, .bottom] }
2929
}
3030

3131
extension UIView {

Tests/YCoreUITests/Extensions/Foundation/CGFloat+roundedTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import XCTest
1010
@testable import YCoreUI
1111

12+
// Large tuples help us build unit test expectations concisely
13+
// swiftlint:disable large_tuple
14+
1215
final class CGFloatRoundedTests: XCTestCase {
1316
typealias ScalingInputs = (
1417
value: CGFloat,

Tests/YCoreUITests/Extensions/UIKit/UIColor+WCAGTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import XCTest
1010
@testable import YCoreUI
1111

12+
// Large tuples help us build unit test expectations concisely
13+
// swiftlint:disable large_tuple
14+
1215
final class UIColorWCAGTests: XCTestCase {
1316
typealias ColorInputs = (foreground: UIColor, background: UIColor, context: WCAGContext)
1417

Tests/YCoreUITests/Extensions/UIKit/UIColor+rgbValueTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
import XCTest
1010

11+
// Large tuples help us build unit test expectations concisely
12+
// swiftlint:disable large_tuple
13+
1114
final class UIColorRgbValueTests: XCTestCase {
1215
typealias ColorTest = (color: UIColor, prefix: String?, isUppercase: Bool, output: String)
1316

Tests/YCoreUITests/Extensions/UIKit/UIView+constrainAnchorTests.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
import XCTest
1010
@testable import YCoreUI
1111

12-
// It's not a problem having too many tests!
13-
// swiftlint:disable type_body_length
14-
1512
final class UIViewConstrainAnchorTests: XCTestCase {
1613
func testXAxisConstraints() {
1714
let (sut, relations) = makeSUT()

Tests/YCoreUITests/Extensions/UIKit/UIView+constrainEdgesTests.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
import XCTest
1010

11-
// It's not a problem having too many tests!
12-
// swiftlint:disable function_body_length
13-
1411
final class UIViewConstrainEdgesTests: XCTestCase {
1512
func testSimple() {
1613
let (sut, insets) = makeSUT()

Tests/YCoreUITests/Foundations/UIColor+TestHarness.swift

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ extension UIColor {
4646
}
4747

4848
extension UIColor {
49-
/// 0x0067B1
50-
static let brand = UIColor(rgb: 0x0067B1)
51-
5249
/// 0x0050AC
5350
static let interactive = UIColor(rgb: 0x0050AC)
5451

@@ -57,9 +54,6 @@ extension UIColor {
5754

5855
/// 0xE7F3FE
5956
static let shade2 = UIColor(rgb: 0xE7F3FE)
60-
61-
/// 0x6390BC
62-
static let shade3 = UIColor(rgb: 0x6390BC)
6357
}
6458

6559
extension UIColor {
@@ -113,17 +107,6 @@ extension UIColor {
113107
}
114108
}
115109

116-
static let separatorSecondary: UIColor =
117-
UIColor { (traitCollection: UITraitCollection) -> UIColor in
118-
switch(traitCollection.userInterfaceStyle,
119-
traitCollection.accessibilityContrast) {
120-
case (.dark, .high): return .gray600
121-
case (.dark, _): return .gray500
122-
case (_, .high): return .gray600
123-
default: return .white
124-
}
125-
}
126-
127110
static let backgroundPrimaryCTA: UIColor =
128111
UIColor { (traitCollection: UITraitCollection) -> UIColor in
129112
switch(traitCollection.userInterfaceStyle,
@@ -143,17 +126,4 @@ extension UIColor {
143126
default: return .white
144127
}
145128
}
146-
147-
static let backgroundAccent: UIColor =
148-
UIColor { (traitCollection: UITraitCollection) -> UIColor in
149-
switch(traitCollection.userInterfaceStyle,
150-
traitCollection.accessibilityContrast) {
151-
case (.dark, .high): return .gray400
152-
case (.dark, _): return .gray300
153-
case (_, .high): return .accent.darkened(by: 0.25)
154-
default: return .accent
155-
}
156-
}
157-
158-
public static let contentAccent: UIColor = .white
159129
}

0 commit comments

Comments
 (0)