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

Function assertGoCommentFirst

coderd/coderdtest/swaggerparser.go:303–319  ·  view source on GitHub ↗
(t *testing.T, comment SwaggerComment)

Source from the content-addressed store, hash-verified

301}
302
303func assertGoCommentFirst(t *testing.T, comment SwaggerComment) {
304 var inSwaggerBlock bool
305
306 for _, line := range comment.raw {
307 text := strings.TrimSpace(line.Text)
308
309 if inSwaggerBlock {
310 if !strings.HasPrefix(text, "// @") && !strings.HasPrefix(text, "// nolint:") {
311 assert.Fail(t, "Go function comment must be placed before swagger comments")
312 return
313 }
314 }
315 if strings.HasPrefix(text, "// @Summary") {
316 inSwaggerBlock = true
317 }
318 }
319}
320
321var urlParameterRegexp = regexp.MustCompile(`{[^{}]*}`)
322

Callers 1

VerifySwaggerDefinitionsFunction · 0.85

Calls 1

FailMethod · 0.45

Tested by

no test coverage detected