Skip to content

Commit

Permalink
fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilveirah committed Jan 24, 2024
1 parent 9d2955e commit a0a57ba
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 11 deletions.
7 changes: 4 additions & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
disabled_rules:
- switch_case_alignment
- void_function_in_ternary
analyzer_rules:
- unused_declaration
- unused_import
opt_in_rules:
- force_unwrapping
- trailing_semicolon
Expand All @@ -21,9 +24,7 @@ opt_in_rules:
- unused_capture_list
- unused_closure_parameter
- unused_control_flow_label
- unused_declaration
- unused_enumerated
- unused_import
- unused_optional_binding
- unused_setter_value
- valid_ibinspectable
Expand All @@ -40,8 +41,8 @@ opt_in_rules:
- yoda_condition
included: # paths to include during linting. `--path` is ignored if present.
- ConsentViewController/Classes
- Example
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Example/*
- Example/AuthExample
- Example/Pods
- Example/SourcePointMetaAppUITests
Expand Down
2 changes: 2 additions & 0 deletions ConsentViewController/Classes/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ struct Constants {

static let prod = (Bundle.framework.object(forInfoDictionaryKey: "SPEnv") as? String) != "preprod"
}

// swiftlint:enable force_unwrapping
2 changes: 2 additions & 0 deletions ConsentViewController/Classes/Extensions/Date.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ extension Date {
Calendar.current.date(bySettingHour: 12, minute: 0, second: 0, of: self)!
}
}

// swiftlint:enable force_unwrapping
11 changes: 7 additions & 4 deletions ConsentViewController/Classes/OSLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
// GDPRConsentViewController
//
// Created by Andre Herculano on 06.10.19.
// swiftlint:disable all

import Foundation
import os

// swiftlint:disable force_unwrapping

protocol SPLogger {
func log(_ message: String)
func debug(_ message: String)
Expand Down Expand Up @@ -126,15 +127,15 @@ struct NoopLogger: SPLogger {
struct OSLogger: SPLogger {
static let category = "SPSDK"
static var standard: OSLogger { OSLogger() }
private let logger: SPLogger

static var defaultLevel: SPLogLevel {
static var defaultLevel: SPLogLevel {
SPLogLevel(rawValue:
Bundle.main.object(forInfoDictionaryKey: "SPLogLevel") as? String ??
Bundle.framework.object(forInfoDictionaryKey: "SPLogLevel") as? String ??
"prod"
) ?? .prod}

private let logger: SPLogger

private init (level: SPLogLevel? = Self.defaultLevel) {
if level == .prod {
logger = NoopLogger()
Expand Down Expand Up @@ -177,3 +178,5 @@ struct OSLogger: SPLogger {
logger.error(message)
}
}

// swiftlint:enable force_unwrapping
2 changes: 2 additions & 0 deletions ConsentViewController/Classes/SPError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,5 @@ public enum InvalidResponsAPICode: String {
"\(rawValue)"
}
}

// swiftlint:enable line_length
2 changes: 2 additions & 0 deletions ConsentViewController/Classes/SPMessageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,5 @@ extension RenderingAppEvents: ExpressibleByStringLiteral {
fatalError("not implemented")
}
}

// swiftlint:enable unavailable_function
Original file line number Diff line number Diff line change
Expand Up @@ -539,3 +539,5 @@ extension SourcePointClient {
}
}
}

// swiftlint:enable function_parameter_count
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ class SourcepointClientCoordinator: SPClientCoordinator {
}
}

// swiftlint:disable:next function_body_length
func handleConsentStatusResponse(_ response: ConsentStatusResponse) {
state.localState = response.localState
if let gdpr = response.consentStatusData.gdpr {
Expand Down Expand Up @@ -1079,3 +1078,5 @@ class SourcepointClientCoordinator: SPClientCoordinator {
spClient.setRequestTimeout(timeout)
}
}

// swiftlint:enable type_body_length
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ import WebKit
getCookies { handler($0[name, default: ""], $1) }
}
}

// swiftlint:enable line_length
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,5 @@ class FocusableScrollView: UIScrollView {
true
}
}

// swiftlint:enable function_body_length
7 changes: 4 additions & 3 deletions Example/.swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
disabled_rules:
- switch_case_alignment
- void_function_in_ternary
analyzer_rules:
- unused_declaration
- unused_import
opt_in_rules:
- force_unwrapping
- trailing_semicolon
Expand All @@ -19,9 +22,7 @@ opt_in_rules:
- unused_capture_list
- unused_closure_parameter
- unused_control_flow_label
- unused_declaration
- unused_enumerated
- unused_import
- unused_optional_binding
- unused_setter_value
- valid_ibinspectable
Expand All @@ -38,8 +39,8 @@ opt_in_rules:
- yoda_condition
included: # paths to include during linting. `--path` is ignored if present.
- ../ConsentViewController/Classes
- ./
excluded: # paths to ignore during linting. Takes precedence over `included`.
- ./
- AuthExample
- Pods
- SourcePointMetaAppUITests
Expand Down
2 changes: 2 additions & 0 deletions Example/ConsentViewController/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,5 @@ extension ViewController {
sdkStatusLabel.text = sdkStatus.rawValue
}
}

// swiftlint:enable force_unwrapping

0 comments on commit a0a57ba

Please sign in to comment.