chore(lint): enable exhaustive (#6487)

Switches on our own enum types must list every value, even when a default
exists, so adding a new value fails lint at each switch that forgot it.
Listed the missing values in 7 switches, keeping behaviour identical.
reflect.Kind and taglib.FileFormat are ignored: they are third-party enums.
This commit is contained in:
Deluan Quintão 2026-11-16 23:38:06 -05:00 committed by GitHub
parent 986000db44
commit 3fca50b808
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 12 additions and 0 deletions

View File

@ -16,6 +16,7 @@ linters:
- durationcheck
- errchkjson
- errorlint
- exhaustive
- forbidigo
- gocritic
- gocyclo
@ -137,6 +138,9 @@ linters:
- G401
- G505
- G115
exhaustive:
# third-party enums: listing every value only adds noise; our own enums must be listed in full
ignore-enum-types: ^(reflect\.Kind|go\.senan\.xyz/taglib\.FileFormat)$
forbidigo:
forbid:
- pattern: 'tx\.Exec$'

View File

@ -45,6 +45,8 @@ func (o outcome) String() string {
return "foundStale"
case outcomeAbsent:
return "absent"
case outcomeFailed:
fallthrough
default:
return "failed"
}

View File

@ -643,6 +643,7 @@ func (p *encoderProbe) has(cmdPath, encoder string) bool {
return true
case encoderProbeUnavailable:
return false
case encoderProbeUnknown:
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)

View File

@ -216,6 +216,8 @@ func clean(filePath string, tags model.RawTags) model.Tags {
switch mapping.Type {
case model.TagTypePair:
values = processPairMapping(name, mapping, lowered)
case model.TagTypeString, model.TagTypeInteger, model.TagTypeFloat, model.TagTypeDate, model.TagTypeUUID:
fallthrough
default:
values = processRegularMapping(mapping, lowered)
}
@ -409,6 +411,7 @@ func sanitize(filePath string, tagName model.TagName, tag model.TagConf, value s
// Store the canonical form: uuid.Parse accepts braces, urn: prefixes and any
// two-byte wrapper, and a wrapped value would never match an exact-match query
value = u.String()
case model.TagTypeString, model.TagTypePair:
}
return value
}

View File

@ -217,5 +217,6 @@ func (m *Manager) processPluginEvent(pluginName string) {
if err := m.removePluginFromDB(ctx, repo, dbPlugin); err != nil {
log.Error(m.ctx, "Failed to delete plugin from DB", "plugin", pluginName, err)
}
case actionNone:
}
}

View File

@ -105,6 +105,7 @@ func Split(input string) ([]string, error) {
return nil, ErrUnterminatedSingleQuote
case stateDoubleQuoted:
return nil, ErrUnterminatedDoubleQuote
case stateUnquoted:
}
if inWord {