Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shchukin-alex committed Sep 29, 2022
1 parent bd0057c commit ce3f6b4
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ disabled_rules:
- shorthand_operator
- unused_closure_parameter

- inclusive_language

opt_in_rules:
- first_where
- last_where
Expand Down
2 changes: 1 addition & 1 deletion Form/FormStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public struct FormStyle: Style {

public struct DynamicFormStyle: DynamicStyle {
public var styleGenerator: (UITraitCollection) -> FormStyle
public init(generateStyle : @escaping (UITraitCollection) -> FormStyle) {
public init(generateStyle: @escaping (UITraitCollection) -> FormStyle) {
self.styleGenerator = generateStyle
}
}
Expand Down
2 changes: 1 addition & 1 deletion Form/FormView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public extension FormView {
return visibleViews
}

//swiftlint:disable:next unused_setter_value
// swiftlint:disable superfluous_disable_command unused_setter_value
set { /* Always computed */ }
}

Expand Down
2 changes: 1 addition & 1 deletion Form/HeaderFooterStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct HeaderFooterStyle: Style {

public struct DynamicHeaderFooterStyle: DynamicStyle {
public var styleGenerator: (UITraitCollection) -> HeaderFooterStyle
public init(generateStyle : @escaping (UITraitCollection) -> HeaderFooterStyle) {
public init(generateStyle: @escaping (UITraitCollection) -> HeaderFooterStyle) {
self.styleGenerator = generateStyle
}
}
Expand Down
2 changes: 1 addition & 1 deletion Form/ParentChildRelational.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public extension ParentChildRelational {
}
}

///Returns the first ancestor of type `type` if any.
/// Returns the first ancestor of type `type` if any.
func firstAncestor<T>(ofType type: T.Type) -> T? {
guard let parent = parent else { return nil }
if let matching = parent as? T {
Expand Down
2 changes: 1 addition & 1 deletion Form/SectionStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public extension SectionStyle {

public struct DynamicSectionStyle: DynamicStyle {
public var styleGenerator: (UITraitCollection) -> SectionStyle
public init(generateStyle : @escaping (UITraitCollection) -> SectionStyle) {
public init(generateStyle: @escaping (UITraitCollection) -> SectionStyle) {
self.styleGenerator = generateStyle
}
}
Expand Down
2 changes: 1 addition & 1 deletion Form/SectionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public extension SectionView {
return elements
}

//swiftlint:disable:next unused_setter_value
// swiftlint:disable superfluous_disable_command unused_setter_value
set { /* Always computed */ }
}

Expand Down
2 changes: 1 addition & 1 deletion Form/UIScrollView+Keyboard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public extension UIScrollView {
}

public extension UIScrollView {
/// Will dynamically adjust the content offset of `self` to reveal first responders.
/// Will dynamically adjust the content offset of `self` to reveal first responders.
/// Parameter adjustInsets: Function to adjust the frame of the first responder view used to calculate the content offset. Defaults to `alignToRow`.
/// - Returns: A disposable that will stop adjustments when being disposed.
func scrollToRevealFirstResponder(_ adjustInsets: @escaping (UIView) -> UIEdgeInsets = alignToRow) -> Disposable {
Expand Down
4 changes: 2 additions & 2 deletions Form/UIScrollView+Pinning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ private extension UIScrollView {
switch edge {
case .bottom:
// FIXME: enable for iOS 11 if we can remove the re-pin hack
//precondition(self[insets: insetKey].bottom == 0, "Only one view can be pinned to bottom")
// precondition(self[insets: insetKey].bottom == 0, "Only one view can be pinned to bottom")
bag += viewHeight.atOnce().onValue { height in
self[insets: insetKey].bottom = height
}
Expand Down Expand Up @@ -223,7 +223,7 @@ private extension UIScrollView {

case .top:
// FIXME: enable for iOS 11 if we can remove the re-pin hack
//precondition(self[insets: insetKey].bottom == 0, "Only one view can be pinned to top")
// precondition(self[insets: insetKey].bottom == 0, "Only one view can be pinned to top")
bag += viewHeight.atOnce().onValue { height in
self[insets: insetKey].top = height
}
Expand Down
2 changes: 1 addition & 1 deletion Form/UIScrollView+Spacing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public extension UIScrollView {
disembedBag += { deactivate(constraints) }

// .equalSpacing gives ambigious layout on iOS < 11, help out by calculating spacing manually.
if #available(iOS 11, *) {} else if !orderedViews.isEmpty {
if #unavailable(iOS 11), !orderedViews.isEmpty {
let contentHeight = signal(for: \.contentSize)[\.height].toVoid().atValue {
for view in orderedViews { view.layoutIfNeeded() }
}.map {
Expand Down
10 changes: 4 additions & 6 deletions Form/UITableViewCell+Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,8 @@ public extension UITableViewCell {

extension UITableViewCell {
var reorderControlView: UIView? {
for view in subviews as [UIView] {
if type(of: view).description() == "UITableViewCellReorderControl" {
return view
}
for view in subviews as [UIView] where type(of: view).description() == "UITableViewCellReorderControl" {
return view
}
return nil
}
Expand Down Expand Up @@ -208,8 +206,8 @@ private extension UITableViewCell {
// Passing through touches if the touch doesn't hit a subview
private class TapThroughView: UIView {
fileprivate override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
for subview in subviews {
if subview.point(inside: convert(point, to: subview), with: event) { return true }
for subview in subviews where subview.point(inside: convert(point, to: subview), with: event) {
return true
}
return false
}
Expand Down
4 changes: 2 additions & 2 deletions Form/ValueField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public final class ValueField<Value>: UIControl, UIKeyInput {
get {
editor.accessibilityValue
}
//swiftlint:disable:next unused_setter_value
// swiftlint:disable superfluous_disable_command unused_setter_value
set { /* accessibilityValue is always read from the editor. */ }
}

Expand All @@ -191,7 +191,7 @@ public final class ValueField<Value>: UIControl, UIKeyInput {
/// Always use `.no` autocorrection as the system keyboard will be confused if it is used.
public dynamic var autocorrectionType: UITextAutocorrectionType {
get { return .no }
//swiftlint:disable:next unused_setter_value
// swiftlint:disable:next unused_setter_value
set { /* ignore */ }
}

Expand Down
1 change: 1 addition & 0 deletions FormTests/CollectionDiffTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func changes<T: Hashable>(from old: [T], to new: [T]) -> [ChangeStep<T, Int>] {
}

func randomizedArray(length: Int) -> [Int] {
// swiftlint:disable:next legacy_random
return (1...length).map { _ in Int(arc4random_uniform(UInt32(length))) }
}

Expand Down

0 comments on commit ce3f6b4

Please sign in to comment.