MCPcopy Index your code
hub / github.com/coder/coder / reportCallMisuse

Function reportCallMisuse

scripts/intxcheck/analyzer.go:153–173  ·  view source on GitHub ↗
(pass *analysis.Pass, call *ast.CallExpr, ctx txContext, suppressed map[int]bool)

Source from the content-addressed store, hash-verified

151}
152
153func reportCallMisuse(pass *analysis.Pass, call *ast.CallExpr, ctx txContext, suppressed map[int]bool) bool {
154 kind, pos := classifyCall(pass, call, ctx.outerStore)
155 switch kind {
156 case misuseDirect:
157 reportIfNotSuppressed(pass, suppressed, pos, fmt.Sprintf(
158 "outer store '%s' used inside InTx; use transaction store '%s' instead",
159 ctx.outerStore.display,
160 ctx.txName,
161 ))
162 return true
163 case misusePassThrough:
164 reportIfNotSuppressed(pass, suppressed, pos, fmt.Sprintf(
165 "outer store '%s' passed as argument inside InTx; use transaction store '%s' instead",
166 ctx.outerStore.display,
167 ctx.txName,
168 ))
169 return true
170 default:
171 return false
172 }
173}
174
175func funcLitCall(call *ast.CallExpr) (*ast.FuncLit, bool) {
176 funcLit, ok := unparen(call.Fun).(*ast.FuncLit)

Callers 1

inspectInTxBodyFunction · 0.85

Calls 2

classifyCallFunction · 0.85
reportIfNotSuppressedFunction · 0.85

Tested by

no test coverage detected