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.
15 lines
549 B
Swift
15 lines
549 B
Swift
struct FunctionBodyLengthRule: SwiftSyntaxRule {
|
|
var configuration = SeverityLevelsConfiguration<Self>(warning: 50, error: 100)
|
|
|
|
static let description = RuleDescription(
|
|
identifier: "function_body_length",
|
|
name: "Function Body Length",
|
|
description: "Function bodies should not span too many lines",
|
|
kind: .metrics
|
|
)
|
|
|
|
func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor<ConfigurationType> {
|
|
BodyLengthRuleVisitor(kind: .function, file: file, configuration: configuration)
|
|
}
|
|
}
|