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:
parent
edd16f6ecf
commit
b00a4f01d4
3 changed files with 12 additions and 19 deletions
|
|
@ -7,7 +7,7 @@ local store = require('todo.store')
|
|||
local M = {}
|
||||
|
||||
---@type todo.Task[]?
|
||||
local undo_state = nil
|
||||
local _undo_state = nil
|
||||
|
||||
---@return integer bufnr
|
||||
function M.open()
|
||||
|
|
@ -46,7 +46,7 @@ end
|
|||
---@param bufnr integer
|
||||
function M._on_write(bufnr)
|
||||
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
|
||||
undo_state = store.active_tasks()
|
||||
_undo_state = store.active_tasks()
|
||||
diff.apply(lines)
|
||||
buffer.render(bufnr)
|
||||
end
|
||||
|
|
@ -113,8 +113,7 @@ function M.prompt_date()
|
|||
end
|
||||
local due = input ~= '' and input or nil
|
||||
if due then
|
||||
local y, m, d = due:match('^(%d%d%d%d)-(%d%d)-(%d%d)$')
|
||||
if not y then
|
||||
if not due:match('^%d%d%d%d%-%d%d%-%d%d$') then
|
||||
vim.notify('Invalid date format. Use YYYY-MM-DD.', vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue