From 43dbdad8dce5347fbf9539d53d5220145b502050 Mon Sep 17 00:00:00 2001 From: Antoine van der Lee <4329185+AvdLee@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:57:00 +0100 Subject: [PATCH] Fix SwiftLint warnings inside example project --- .../Supporting Files/AppDelegate.swift | 13 ++++++++++--- Sources/DiagnosticsReporter.swift | 9 +++++++-- Sources/Logging/Loggable.swift | 4 ++-- Sources/Reporters/GeneralInfoReporter.swift | 1 + 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Example/Diagnostics-Example/Supporting Files/AppDelegate.swift b/Example/Diagnostics-Example/Supporting Files/AppDelegate.swift index 608f7f2..6a12816 100644 --- a/Example/Diagnostics-Example/Supporting Files/AppDelegate.swift +++ b/Example/Diagnostics-Example/Supporting Files/AppDelegate.swift @@ -5,7 +5,6 @@ // Created by Antoine van der Lee on 02/12/2019. // Copyright © 2019 WeTransfer. All rights reserved. // -// swiftlint:disable line_length import Diagnostics import UIKit @@ -24,7 +23,10 @@ final class AppDelegate: UIResponder, UIApplicationDelegate { } } - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { do { try DiagnosticsLogger.setup() } catch { @@ -34,6 +36,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate { DiagnosticsLogger.log(message: "Application started") DiagnosticsLogger.log(error: ExampleError.missingData) DiagnosticsLogger.log(error: ExampleLocalizedError.missingLocalizedData) + // swiftlint:disable:next line_length DiagnosticsLogger.log(message: "A very long string: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque condimentum facilisis arcu, at fermentum diam fermentum in. Nullam lectus libero, tincidunt et risus vel, feugiat vulputate nunc. Nunc malesuada congue risus fringilla lacinia. Aliquam suscipit nulla nec faucibus mattis. Suspendisse quam nunc, interdum vel dapibus in, vulputate ac enim. Morbi placerat commodo leo, nec condimentum eros dictum sit amet. Vivamus maximus neque in dui rutrum, vel consectetur metus mollis. Nulla ultricies sodales viverra. Etiam ut velit consectetur, consectetur turpis eu, volutpat purus. Maecenas vitae consectetur tortor, at eleifend lacus. Nullam sed augue vel purus mollis sagittis at sed dui. Quisque faucibus fermentum lectus eget porttitor. Phasellus efficitur aliquet lobortis. Suspendisse at lectus imperdiet, sollicitudin arcu non, interdum diam. Sed ornare ante dolor. In pretium auctor sem, id vestibulum sem molestie in.") // Override point for customization after application launch. return true @@ -41,7 +44,11 @@ final class AppDelegate: UIResponder, UIApplicationDelegate { // MARK: UISceneSession Lifecycle - func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { + func application( + _ application: UIApplication, + configurationForConnecting connectingSceneSession: UISceneSession, + options: UIScene.ConnectionOptions + ) -> UISceneConfiguration { // Called when a new scene session is being created. // Use this method to select a configuration to create the new scene with. return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) diff --git a/Sources/DiagnosticsReporter.swift b/Sources/DiagnosticsReporter.swift index b8d9844..ef9f9c1 100644 --- a/Sources/DiagnosticsReporter.swift +++ b/Sources/DiagnosticsReporter.swift @@ -5,7 +5,6 @@ // Created by Antoine van der Lee on 02/12/2019. // Copyright © 2019 WeTransfer. All rights reserved. // -// swiftlint:disable line_length import Foundation @@ -120,6 +119,7 @@ extension DiagnosticsReporter { return html } + // swiftlint:disable line_length private static func footer() -> HTML { return """ """ } + // swiftlint:enable line_length static func style() -> HTML { guard let cssURL = Bundle.module.url(forResource: "style.css", withExtension: nil), let css = try? String(contentsOf: cssURL) else { @@ -140,12 +141,15 @@ extension DiagnosticsReporter { } static func scripts() -> HTML { - guard let scriptsURL = Bundle.module.url(forResource: "functions.js", withExtension: nil), let scripts = try? String(contentsOf: scriptsURL) else { + guard + let scriptsURL = Bundle.module.url(forResource: "functions.js", withExtension: nil), + let scripts = try? String(contentsOf: scriptsURL) else { return "" } return "" } + // swiftlint:disable line_length static func menu(using chapters: [DiagnosticsChapter]) -> HTML { var html = "" return html } + // swiftlint:enable line_length static func mainContent(using chapters: [DiagnosticsChapter]) -> HTML { var html = "
" diff --git a/Sources/Logging/Loggable.swift b/Sources/Logging/Loggable.swift index 1658aa1..87a840d 100644 --- a/Sources/Logging/Loggable.swift +++ b/Sources/Logging/Loggable.swift @@ -200,7 +200,7 @@ extension MXCallStackTree { extension String.StringInterpolation { // swiftlint:disable:next cyclomatic_complexity mutating func appendInterpolation(exceptionType: Int32?) { - guard let exceptionType = exceptionType else { + guard let exceptionType else { appendLiteral("") return } @@ -244,7 +244,7 @@ extension String.StringInterpolation { // swiftlint:disable:next cyclomatic_complexity function_body_length mutating func appendInterpolation(signal: Int32?) { - guard let signal = signal else { + guard let signal else { appendLiteral("") return } diff --git a/Sources/Reporters/GeneralInfoReporter.swift b/Sources/Reporters/GeneralInfoReporter.swift index 32e519c..ca59e14 100644 --- a/Sources/Reporters/GeneralInfoReporter.swift +++ b/Sources/Reporters/GeneralInfoReporter.swift @@ -35,3 +35,4 @@ open class GeneralInfoReporter: DiagnosticsReporting { return DiagnosticsChapter(title: title, diagnostics: description, shouldShowTitle: false) } } +// swiftlint:enable line_length