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

Function slogUUIDFieldNameHasIDSuffix

scripts/rules.go:360–368  ·  view source on GitHub ↗

slogUUIDFieldNameHasIDSuffix ensures that "uuid.UUID" field has ID prefix in the field name.

(m dsl.Matcher)

Source from the content-addressed store, hash-verified

358// slogUUIDFieldNameHasIDSuffix ensures that "uuid.UUID" field has ID prefix
359// in the field name.
360func slogUUIDFieldNameHasIDSuffix(m dsl.Matcher) {
361 m.Import("cdr.dev/slog/v3")
362 m.Import("github.com/google/uuid")
363 m.Match(
364 `slog.F($name, $value)`,
365 ).
366 Where(m["value"].Type.Is("uuid.UUID") && !m["name"].Text.Matches(`_id"$`)).
367 Report(`uuid.UUID field $name must have "_id" suffix.`)
368}
369
370// slogMessageFormat ensures that the log message starts with lowercase, and does not
371// end with special character.

Callers

nothing calls this directly

Calls 4

MatchMethod · 0.80
ReportMethod · 0.65
IsMethod · 0.45
MatchesMethod · 0.45

Tested by

no test coverage detected