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
SwiftLintFile
with a SourceKittenFile
.Declaration
Swift
public init(file: File)
Parameters
file
A file from SourceKitten.
-
Creates a
SwiftLintFile
by specifying its path on disk. Fails if the file does not exist.Declaration
Swift
public convenience init?(path: String)
Parameters
path
The path to a file on disk. Relative and absolute paths supported.
-
Creates a
SwiftLintFile
by 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
path
The path to a file on disk. Relative and absolute paths supported.
-
Creates a
SwiftLintFile
that is not backed by a file on disk by specifying its contents.Declaration
Swift
public convenience init(contents: String)
Parameters
contents
The 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)