mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
40bd97038a
Almost all rules based on SwiftSyntax can be set up now by just adding `@SwiftSyntaxRule` to the rule struct.
17 lines
717 B
Swift
17 lines
717 B
Swift
struct ClosureBodyLengthRule: OptInRule, SwiftSyntaxRule {
|
|
var configuration = SeverityLevelsConfiguration<Self>(warning: 30, error: 100)
|
|
|
|
static let description = RuleDescription(
|
|
identifier: "closure_body_length",
|
|
name: "Closure Body Length",
|
|
description: "Closure bodies should not span too many lines",
|
|
kind: .metrics,
|
|
nonTriggeringExamples: ClosureBodyLengthRuleExamples.nonTriggeringExamples,
|
|
triggeringExamples: ClosureBodyLengthRuleExamples.triggeringExamples
|
|
)
|
|
|
|
func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor<ConfigurationType> {
|
|
BodyLengthRuleVisitor(kind: .closure, file: file, configuration: configuration)
|
|
}
|
|
}
|