From 7a348655eee11484d92d449aec4c02ea7d1a46af Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Tue, 29 Sep 2026 06:57:04 +0000 Subject: [PATCH] Keep newFromSmartConfig within the length limit (closes #64) Rebasing onto the four settings from https://git.eeqj.de/sneak/pixa/pulls/142 put newFromSmartConfig at 82 lines, over the linter's 80-line limit. validateKnownKeys now returns early for a nil config (no config file) itself, as lookupValue already does, so the caller drops its own nil check. Behavior is unchanged. Model: opus-5-5 --- internal/config/config.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index d815802..b8e041b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -236,14 +236,12 @@ func New(_ fx.Lifecycle, params Params) (*Config, error) { // unparseable or invalid is an error: defaults apply only to omitted // keys, never to invalid explicit values. func newFromSmartConfig(sc *smartconfig.Config) (*Config, error) { - if sc != nil { - err := validateKnownKeys(sc) - if err != nil { - return nil, err - } + err := validateKnownKeys(sc) + if err != nil { + return nil, err } - err := validateAllowlistHostsValue(sc) + err = validateAllowlistHostsValue(sc) if err != nil { return nil, err } @@ -337,8 +335,13 @@ func newFromSmartConfig(sc *smartconfig.Config) (*Config, error) { // being silently ignored, and rejects keys that are explicitly set to // null: a null is a SET value, never an omission, so it must not // silently take the default. The env section is permitted because -// smartconfig consumes it for environment variable injection. +// smartconfig consumes it for environment variable injection. A nil sc +// means no config file, which has no keys to check. func validateKnownKeys(sc *smartconfig.Config) error { + if sc == nil { + return nil + } + var unknown, nullKeys []string for key, value := range sc.Data() {