SwiftLintFile
public final class SwiftLintFile : Sendable
extension SwiftLintFile: Equatable, Hashable
A unit of Swift source code, either on disk or in memory.
-
The underlying SourceKitten file.
Declaration
Swift
public let file: File -
The associated unique identifier for this file.
Declaration
Swift
public let id: UUID -
Whether or not this is a file generated for testing purposes.
Declaration
Swift
public let isTestFile: Bool -
A file is virtual if it is not backed by a filesystem path.
Declaration
Swift
public let isVirtual: Bool -
Creates a
SwiftLintFilewith a SourceKittenFile.Declaration
Swift
public init(file: File, isTestFile: Bool = false, isVirtual: Bool = false)Parameters
fileA file from SourceKitten.
isTestFileMark the file as being generated for testing purposes only.
isVirtualMark the file as virtual (in-memory).
-
Creates a
SwiftLintFileby specifying its path on disk. Fails if the file does not exist.Declaration
Swift
public convenience init?(path: String, isTestFile: Bool = false)Parameters
pathThe path to a file on disk. Relative and absolute paths supported.
isTestFileMark the file as being generated for testing purposes only.
-
Creates a
SwiftLintFileby specifying its path on disk. Unlike theSwiftLintFile(path:)initializer, this one does not read its contents immediately, but rather traps at runtime when attempting to access its contents.Declaration
Swift
public convenience init(pathDeferringReading path: String)Parameters
pathThe path to a file on disk. Relative and absolute paths supported.
-
Creates a
SwiftLintFilethat is not backed by a file on disk by specifying its contents.Declaration
Swift
public convenience init(contents: String, isTestFile: Bool = false)Parameters
contentsThe contents of the file.
isTestFileMark the file as being generated for testing purposes only.
-
The path on disk for this file.
Declaration
Swift
public var path: String? { get } -
The file’s contents.
Declaration
Swift
public var contents: String { get } -
A string view into the contents of this file optimized for string manipulation operations.
Declaration
Swift
public var stringView: StringView { get } -
The parsed lines for this file’s contents.
Declaration
Swift
public var lines: [Line] { get }
-
Declaration
Swift
public static func == (lhs: SwiftLintFile, rhs: SwiftLintFile) -> Bool -
Declaration
Swift
public func hash(into hasher: inout Hasher)
View on GitHub
Install in Dash