fix: resolve selene lint warnings and errors

Problem: unused variables (undo_state, sha_result, date match
captures) and duplicate if/else branches in gcal sync triggered
selene warnings and errors.

Solution: prefix unused state with underscore, simplify date
validation to a single pattern match, remove dead sha_result
call, and merge duplicate event deletion branches into a single
condition.
This commit is contained in:
Barrett Ruth 2026-02-24 15:20:06 -05:00
parent edd16f6ecf
commit b00a4f01d4
3 changed files with 12 additions and 19 deletions

View file

@ -199,7 +199,6 @@ function M.authorize()
end
local code_verifier = table.concat(verifier)
local sha_result = vim.system({ 'printf', '%s', code_verifier }, { text = true }):wait()
local sha_pipe = vim
.system({
'sh',
@ -401,7 +400,14 @@ function M.sync()
local extra = task._extra or {}
local event_id = extra._gcal_event_id
if (task.status == 'done' or task.status == 'deleted') and event_id then
local should_delete = event_id
and (
task.status == 'done'
or task.status == 'deleted'
or (task.status == 'pending' and not task.due)
)
if should_delete then
local del_err = delete_event(access_token, calendar_id, event_id)
if not del_err then
extra._gcal_event_id = nil
@ -430,18 +436,6 @@ function M.sync()
created = created + 1
end
end
elseif task.status == 'pending' and not task.due and event_id then
local del_err = delete_event(access_token, calendar_id, event_id)
if not del_err then
extra._gcal_event_id = nil
if next(extra) == nil then
task._extra = nil
else
task._extra = extra
end
task.modified = os.date('!%Y-%m-%dT%H:%M:%SZ')
deleted = deleted + 1
end
end
end