mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
Fail in debug builds if a rule produces corrections while not being correctable (#5684)
This commit is contained in:
@@ -46,8 +46,13 @@ public extension SwiftSyntaxRule {
|
||||
return []
|
||||
}
|
||||
|
||||
return makeVisitor(file: file)
|
||||
let violations = makeVisitor(file: file)
|
||||
.walk(tree: syntaxTree, handler: \.violations)
|
||||
assert(
|
||||
violations.allSatisfy { $0.correction == nil || self is any SwiftSyntaxCorrectableRule },
|
||||
"\(Self.self) produced corrections without being correctable."
|
||||
)
|
||||
return violations
|
||||
.sorted()
|
||||
.map { makeViolation(file: file, violation: $0) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user