SwiftLintFile
public final class SwiftLintFile
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 private(set) var isTestFile: Bool { get } -
A file is virtual if it is not backed by a filesystem path.
Declaration
Swift
public private(set) var isVirtual: Bool { get } -
Creates a
SwiftLintFilewith a SourceKittenFile.Declaration
Swift
public init(file: File)Parameters
fileA file from SourceKitten.
-
Creates a
SwiftLintFileby specifying its path on disk. Fails if the file does not exist.Declaration
Swift
public convenience init?(path: String)Parameters
pathThe path to a file on disk. Relative and absolute paths supported.
-
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)Parameters
contentsThe contents of the file.
-
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