Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoUnsafeFinallyRule = rule.Rule{ Name: "no-unsafe-finally", Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { return rule.RuleListeners{ ast.KindReturnStatement: func(node *ast.Node) { if isInFinally(node, isReturnThrowSentinel, nil) { ctx.ReportNode(node, buildUnsafeUsageMessage("ReturnStatement")) } }, ast.KindThrowStatement: func(node *ast.Node) { if isInFinally(node, isReturnThrowSentinel, nil) { ctx.ReportNode(node, buildUnsafeUsageMessage("ThrowStatement")) } }, ast.KindBreakStatement: func(node *ast.Node) { breakStmt := node.AsBreakStatement() if breakStmt.Label != nil { if isInFinally(node, isReturnThrowSentinel, breakStmt.Label) { ctx.ReportNode(node, buildUnsafeUsageMessage("BreakStatement")) } } else { if isInFinally(node, isBreakSentinel, nil) { ctx.ReportNode(node, buildUnsafeUsageMessage("BreakStatement")) } } }, ast.KindContinueStatement: func(node *ast.Node) { continueStmt := node.AsContinueStatement() if continueStmt.Label != nil { if isInFinally(node, isContinueSentinel, continueStmt.Label) { ctx.ReportNode(node, buildUnsafeUsageMessage("ContinueStatement")) } } else { if isInFinally(node, isContinueSentinel, nil) { ctx.ReportNode(node, buildUnsafeUsageMessage("ContinueStatement")) } } }, } }, }
NoUnsafeFinallyRule disallows control flow statements in finally blocks
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.