Files
SwiftLint/Source/SwiftLintBuiltInRules/Rules/Metrics/ClosureBodyLengthRule.swift
Danny Mösch 40bd97038a Support arbitrary configurations in @SwiftSyntaxRule (#5275)
Almost all rules based on SwiftSyntax can be set up now by just adding
`@SwiftSyntaxRule` to the rule struct.
2023-10-16 19:34:43 +02:00

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)
}
}