Files
SwiftLint/Source/SwiftLintFramework/Configuration/Configuration+IndentationStyle.swift
Danny Mösch a6c4fd98bc Move files from SwiftLintCore to SwiftLintFramework
Ideally, SwiftLintCore would some day only contain components
that are needed to define rules. Consequently, it would be the
only bundle required to import for (external) rule development.
2024-12-23 12:51:43 +01:00

24 lines
908 B
Swift

public extension Configuration {
/// The style of indentation used in a Swift project.
enum IndentationStyle: Hashable, Sendable {
/// Swift source code should be indented using tabs.
case tabs
/// Swift source code should be indented using spaces with `count` spaces per indentation level.
case spaces(count: Int)
/// The default indentation style if none is explicitly provided.
package static let `default` = spaces(count: 4)
/// Creates an indentation style based on an untyped configuration value.
///
/// - parameter object: The configuration value.
internal init?(_ object: Any?) {
switch object {
case let value as Int: self = .spaces(count: value)
case let value as String where value == "tabs": self = .tabs
default: return nil
}
}
}
}