Skip to content

Commit

Permalink
More fixed lint changes that would not work on older swift version
Browse files Browse the repository at this point in the history
  • Loading branch information
f-meloni committed Oct 14, 2024
1 parent 82cdc5a commit 2804c50
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Sources/Danger/DangerUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ public extension DangerUtils.Environment {
public var description: String {
switch self {
case let .string(string):
string
return string
case let .boolean(bool):
bool.description
return bool.description
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Danger/Extensions/DateFormatterExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public extension DateFormatter {
}
}

private final class OptionalFractionalSecondsDateFormatter: DateFormatter {
private final class OptionalFractionalSecondsDateFormatter: DateFormatter, @unchecked Sendable {
static let withMilliseconds: DateFormatter = {
let formatter = DateFormatter()
setUpFormatter(formatter)
Expand Down Expand Up @@ -81,7 +81,7 @@ extension OptionalFractionalSecondsDateFormatter {
var errorDescription: String? {
switch self {
case let .invalidFormat(path, dateString):
"Format Invalid with path \"\(path)\", date string: \"\(dateString)\""
return "Format Invalid with path \"\(path)\", date string: \"\(dateString)\""
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions Sources/Danger/GitDiff.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public struct FileDiff: Equatable, CustomStringConvertible {
public var changes: Changes {
switch parsedHeader.change {
case .created:
.created(addedLines: hunks.flatMap { hunk in hunk.lines.map(\.text) })
return .created(addedLines: hunks.flatMap { hunk in hunk.lines.map(\.text) })
case .deleted:
.deleted(deletedLines: hunks.flatMap { hunk in hunk.lines.map(\.text) })
return .deleted(deletedLines: hunks.flatMap { hunk in hunk.lines.map(\.text) })
case .modified:
.modified(hunks: hunks)
return .modified(hunks: hunks)
case let .renamed(oldPath: oldPath):
.renamed(oldPath: oldPath, hunks: hunks)
return .renamed(oldPath: oldPath, hunks: hunks)
}
}

Expand Down Expand Up @@ -73,11 +73,11 @@ public extension FileDiff {
public var description: String {
switch changeType {
case .added:
"+" + text
return "+" + text
case .removed:
"-" + text
return "-" + text
case .unchanged:
" " + text
return " " + text
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/Danger/GitLabDSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ public extension GitLab {
public var id: Int {
switch self {
case let .group(id), let .project(id):
id
return id
}
}

public var isGroup: Bool {
if case .group = self {
true
return true
} else {
false
return false
}
}

Expand Down
8 changes: 4 additions & 4 deletions Sources/Danger/Plugins/SwiftLint/SwiftLint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public enum SwiftLint {
var command: String {
switch self {
case let .bin(path):
path
return path
case let .swiftPackage(path):
"swift run --package-path \(path) swiftlint"
return "swift run --package-path \(path) swiftlint"
}
}
}
Expand Down Expand Up @@ -308,9 +308,9 @@ extension SwiftLint {

private static var tmpSwiftlintOutputFilePath: String {
if #available(OSX 10.12, *) {
FileManager.default.temporaryDirectory.appendingPathComponent("swiftlintReport.json").path
return FileManager.default.temporaryDirectory.appendingPathComponent("swiftlintReport.json").path
} else {
NSTemporaryDirectory() + "swiftlintReport.json"
return NSTemporaryDirectory() + "swiftlintReport.json"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Danger/Report.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ private var testingResults = DangerResults()
private var globalResults: DangerResults {
get {
if ProcessInfo.processInfo.processName.hasSuffix("xctest") {
testingResults
return testingResults
} else {
DangerRunner.shared.results
return DangerRunner.shared.results
}
}
set {
Expand Down

0 comments on commit 2804c50

Please sign in to comment.