BodyLengthVisitor
open class BodyLengthVisitor<Parent> : ViolationsSyntaxVisitor<SeverityLevelsConfiguration<Parent>> where Parent : Rule
Violation visitor customized to collect violations of code blocks that exceed a specified number of lines.
-
Declaration
Swift
@inlinable override public init(configuration: SeverityLevelsConfiguration<Parent>, file: SwiftLintFile)
-
Registers a violation if a body exceeds the configured line count.
Declaration
Swift
public func registerViolations(leftBrace: TokenSyntax, rightBrace: TokenSyntax, violationNode: some SyntaxProtocol, objectName: String)
Parameters
leftBrace
The left brace token of the body.
rightBrace
The right brace token of the body.
violationNode
The syntax node where the violation is to be reported.
objectName
The name of the object (e.g., “Function”, “Closure”) used in the violation message.