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

Function slogFieldNameSnakeCase

scripts/rules.go:349–356  ·  view source on GitHub ↗

slogFieldNameSnakeCase is a lint rule that ensures naming consistency of logged field names.

(m dsl.Matcher)

Source from the content-addressed store, hash-verified

347// slogFieldNameSnakeCase is a lint rule that ensures naming consistency
348// of logged field names.
349func slogFieldNameSnakeCase(m dsl.Matcher) {
350 m.Import("cdr.dev/slog/v3")
351 m.Match(
352 `slog.F($name, $value)`,
353 ).
354 Where(m["name"].Const && !m["name"].Text.Matches(`^"[a-z]+(_[a-z]+)*"$`)).
355 Report("Field name $name must be snake_case.")
356}
357
358// slogUUIDFieldNameHasIDSuffix ensures that "uuid.UUID" field has ID prefix
359// in the field name.

Callers

nothing calls this directly

Calls 3

MatchMethod · 0.80
ReportMethod · 0.65
MatchesMethod · 0.45

Tested by

no test coverage detected