Skip to content

Commit

Permalink
Merge pull request #164 from WeTransfer/feature/fix-swiftlint-warnings
Browse files Browse the repository at this point in the history
Fix SwiftLint warnings inside example project
  • Loading branch information
AvdLee authored Mar 4, 2024
2 parents 678e060 + 43dbdad commit 0449744
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
13 changes: 10 additions & 3 deletions Example/Diagnostics-Example/Supporting Files/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 {
Expand All @@ -34,14 +36,19 @@ 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
}

// 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)
Expand Down
9 changes: 7 additions & 2 deletions Sources/DiagnosticsReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -120,6 +119,7 @@ extension DiagnosticsReporter {
return html
}

// swiftlint:disable line_length
private static func footer() -> HTML {
return """
<footer>
Expand All @@ -131,6 +131,7 @@ extension DiagnosticsReporter {
</footer>
"""
}
// 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 {
Expand All @@ -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 "<script type=\"text/javascript\">\(scripts)</script>"
}

// swiftlint:disable line_length
static func menu(using chapters: [DiagnosticsChapter]) -> HTML {
var html = "<aside class=\"nav-container\"><nav><ul>"
chapters.forEach { chapter in
Expand All @@ -159,6 +163,7 @@ extension DiagnosticsReporter {
html += "</ul></nav></aside>"
return html
}
// swiftlint:enable line_length

static func mainContent(using chapters: [DiagnosticsChapter]) -> HTML {
var html = "<div class=\"main-content\">"
Expand Down
4 changes: 2 additions & 2 deletions Sources/Logging/Loggable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
1 change: 1 addition & 0 deletions Sources/Reporters/GeneralInfoReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ open class GeneralInfoReporter: DiagnosticsReporting {
return DiagnosticsChapter(title: title, diagnostics: description, shouldShowTitle: false)
}
}
// swiftlint:enable line_length

0 comments on commit 0449744

Please sign in to comment.