From ddf1af79da38a65dcd1965552469560156505536 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Thu, 12 Mar 2026 20:46:36 -0400 Subject: [PATCH] fix(views): pluralize unknown queue sort key warning Problem: multiple unknown sort keys each triggered a separate warning. Solution: collect unknown keys and emit a single warning with the correct singular/plural label, joined by `, `. --- lua/pending/views.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/pending/views.lua b/lua/pending/views.lua index f7dce4a..12cbbc0 100644 --- a/lua/pending/views.lua +++ b/lua/pending/views.lua @@ -161,14 +161,19 @@ local function build_queue_comparator() local log = require('pending.log') local keys = config.get().view.queue.sort or { 'status', 'priority', 'due', 'order', 'id' } local comparators = {} + local unknown = {} for _, key in ipairs(keys) do local cmp = sort_key_comparators[key] if cmp then table.insert(comparators, cmp) else - log.warn('unknown queue sort key: ' .. key) + table.insert(unknown, key) end end + if #unknown > 0 then + local label = #unknown == 1 and 'unknown queue sort key: ' or 'unknown queue sort keys: ' + log.warn(label .. table.concat(unknown, ', ')) + end return function(a, b) for _, cmp in ipairs(comparators) do local result = cmp(a, b)