Files
SwiftLint/Source/SwiftLintCore/Models/Correction.swift
Danny Mösch 792032480e Support SwiftLint on Windows (#6636)
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>
Co-authored-by: Roman Lavrov <roman.lavrov@thebrowser.company>
2026-05-27 22:02:06 +02:00

29 lines
1.1 KiB
Swift

import Foundation
/// A value describing a SwiftLint violation that was corrected.
public struct Correction: Equatable, Sendable {
/// The name of the rule that was corrected.
public let ruleName: String
/// The path to the file that was corrected.
public let filePath: URL?
/// The number of corrections that were made.
public let numberOfCorrections: Int
/// The console-printable description for this correction.
public var consoleDescription: String {
let times = numberOfCorrections == 1 ? "time" : "times"
return "\(filePath?.relativeDisplayPath ?? "<nopath>"): Corrected \(ruleName) \(numberOfCorrections) \(times)"
}
/// Memberwise initializer.
///
/// - parameter ruleName: The name of the rule that was corrected.
/// - parameter filePath: The path to the file that was corrected.
/// - parameter numberOfCorrections: The number of corrections that were made.
public init(ruleName: String, filePath: URL?, numberOfCorrections: Int) {
self.ruleName = ruleName
self.filePath = filePath
self.numberOfCorrections = numberOfCorrections
}
}