mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-19 15:23:36 +00:00
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:
parent
986000db44
commit
3fca50b808
@ -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$'
|
||||
|
||||
@ -45,6 +45,8 @@ func (o outcome) String() string {
|
||||
return "foundStale"
|
||||
case outcomeAbsent:
|
||||
return "absent"
|
||||
case outcomeFailed:
|
||||
fallthrough
|
||||
default:
|
||||
return "failed"
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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:
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,6 +105,7 @@ func Split(input string) ([]string, error) {
|
||||
return nil, ErrUnterminatedSingleQuote
|
||||
case stateDoubleQuoted:
|
||||
return nil, ErrUnterminatedDoubleQuote
|
||||
case stateUnquoted:
|
||||
}
|
||||
|
||||
if inWord {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user