mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
1e25cf6be6
* Migrate VerticalWhitespaceRule from SourceKit to SwiftSyntax * Adds tests for new horizontal whitespace behavior
21 lines
708 B
Swift
21 lines
708 B
Swift
import SwiftLintCore
|
|
|
|
@AutoConfigParser
|
|
struct VerticalWhitespaceConfiguration: SeverityBasedRuleConfiguration {
|
|
typealias Parent = VerticalWhitespaceRule
|
|
|
|
static let defaultDescriptionReason = "Limit vertical whitespace to a single empty line"
|
|
|
|
@ConfigurationElement(key: "severity")
|
|
private(set) var severityConfiguration = SeverityConfiguration<Parent>(.warning)
|
|
@ConfigurationElement(key: "max_empty_lines")
|
|
private(set) var maxEmptyLines = 1
|
|
|
|
var configuredDescriptionReason: String {
|
|
guard maxEmptyLines == 1 else {
|
|
return "Limit vertical whitespace to maximum \(maxEmptyLines) empty lines"
|
|
}
|
|
return Self.defaultDescriptionReason
|
|
}
|
|
}
|