Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var NoUnmodifiedLoopConditionRule = rule.Rule{ Name: "no-unmodified-loop-condition", RequiresTypeInfo: true, Run: func(ctx rule.RuleContext, options any) rule.RuleListeners { if ctx.TypeChecker == nil { return rule.RuleListeners{} } return rule.RuleListeners{ ast.KindWhileStatement: func(node *ast.Node) { whileStmt := node.AsWhileStatement() if whileStmt == nil { return } checkLoopCondition(ctx, whileStmt.Expression, whileStmt.Statement, nil) }, ast.KindDoStatement: func(node *ast.Node) { doStmt := node.AsDoStatement() if doStmt == nil { return } checkLoopCondition(ctx, doStmt.Expression, doStmt.Statement, nil) }, ast.KindForStatement: func(node *ast.Node) { forStmt := node.AsForStatement() if forStmt == nil { return } checkLoopCondition(ctx, forStmt.Condition, forStmt.Statement, forStmt.Incrementor) }, } }, }
NoUnmodifiedLoopConditionRule disallows variables in loop conditions that are not modified in the loop
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.