Files
SwiftLint/Source/SwiftLintCore/Extensions/Configuration+IndentationStyle.swift
T
JP Simard 6e3bfc1a45 Fix more strict concurrency warnings (#5324)
These aren't enough to enable `-strict-concurrency=complete` for more
modules, but they address some warnings with that flag on and reduces
the scope of what remains to be migrated.
2023-11-01 12:41:54 -04:00

25 lines
923 B
Swift

public extension Configuration {
/// The style of indentation used in a Swift project.
enum IndentationStyle: Hashable {
/// 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.
@_spi(TestHelper)
public 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
}
}
}
}