chore: remove diagnostic suppressions after tidying nits

This commit is contained in:
Alexander Courtis 2023-01-01 13:27:05 +11:00
parent 9d27c9ebea
commit e322fbb80b
8 changed files with 24 additions and 40 deletions

View File

@ -4,15 +4,6 @@
"diagnostics": { "diagnostics": {
"globals": [ "globals": [
"vim" "vim"
],
"disable": [
"cast-local-type",
"lowercase-global",
"missing-parameter",
"missing-return",
"missing-return-value",
"need-check-nil",
"param-type-mismatch"
] ]
} }
} }

View File

@ -30,8 +30,8 @@ function M.reload_node_status(parent_node, projects)
end end
local event_running = false local event_running = false
---@param _ table unused node passed by action ---@param _ table|nil unused node passed by action
---@param unloaded_bufnr number optional bufnr recently unloaded via BufUnload event ---@param unloaded_bufnr number|nil optional bufnr recently unloaded via BufUnload event
function M.reload_explorer(_, unloaded_bufnr) function M.reload_explorer(_, unloaded_bufnr)
if event_running or not core.get_explorer() or vim.v.exiting ~= vim.NIL then if event_running or not core.get_explorer() or vim.v.exiting ~= vim.NIL then
return return

View File

@ -91,8 +91,8 @@ local function custom(path)
end end
---Prepare arguments for should_filter. This is done prior to should_filter for efficiency reasons. ---Prepare arguments for should_filter. This is done prior to should_filter for efficiency reasons.
---@param git_status table results of git.load_project_status(...) ---@param git_status table|nil optional results of git.load_project_status(...)
---@param unloaded_bufnr number optional bufnr recently unloaded via BufUnload event ---@param unloaded_bufnr number|nil optional bufnr recently unloaded via BufUnload event
---@return table ---@return table
--- git_status: reference --- git_status: reference
--- unloaded_bufnr: copy --- unloaded_bufnr: copy

View File

@ -45,7 +45,7 @@ function Runner:_handle_incoming_data(prev_output, incoming)
self._parse_status_output(line) self._parse_status_output(line)
end end
return nil return ""
end end
function Runner:_getopts(stdout_handle, stderr_handle) function Runner:_getopts(stdout_handle, stderr_handle)

View File

@ -14,16 +14,16 @@ local function refactored(opts)
end end
-- 2022/06/20 -- 2022/06/20
utils.move_missing_val(opts, "update_focused_file", "update_cwd", opts, "update_focused_file", "update_root") utils.move_missing_val(opts, "update_focused_file", "update_cwd", opts, "update_focused_file", "update_root", true)
utils.move_missing_val(opts, "", "update_cwd", opts, "", "sync_root_with_cwd") utils.move_missing_val(opts, "", "update_cwd", opts, "", "sync_root_with_cwd", true)
-- 2022/11/07 -- 2022/11/07
utils.move_missing_val(opts, "", "open_on_tab", opts, "tab.sync", "open", false) utils.move_missing_val(opts, "", "open_on_tab", opts, "tab.sync", "open", false)
utils.move_missing_val(opts, "", "open_on_tab", opts, "tab.sync", "close") utils.move_missing_val(opts, "", "open_on_tab", opts, "tab.sync", "close", true)
utils.move_missing_val(opts, "", "ignore_buf_on_tab_change", opts, "tab.sync", "ignore") utils.move_missing_val(opts, "", "ignore_buf_on_tab_change", opts, "tab.sync", "ignore", true)
-- 2022/11/22 -- 2022/11/22
utils.move_missing_val(opts, "renderer", "root_folder_modifier", opts, "renderer", "root_folder_label") utils.move_missing_val(opts, "renderer", "root_folder_modifier", opts, "renderer", "root_folder_label", true)
end end
local function removed(opts) local function removed(opts)

View File

@ -14,9 +14,11 @@ function M.raw(typ, fmt, ...)
local line = string.format(fmt, ...) local line = string.format(fmt, ...)
local file = io.open(M.path, "a") local file = io.open(M.path, "a")
io.output(file) if file then
io.write(line) io.output(file)
io.close(file) io.write(line)
io.close(file)
end
end end
--- Write to log file via M.line --- Write to log file via M.line
@ -24,7 +26,7 @@ end
--- @return number nanos to pass to profile_end --- @return number nanos to pass to profile_end
function M.profile_start(fmt, ...) function M.profile_start(fmt, ...)
if not M.path or not M.config.types.profile and not M.config.types.all then if not M.path or not M.config.types.profile and not M.config.types.all then
return return 0
end end
M.line("profile", "START " .. (fmt or "???"), ...) M.line("profile", "START " .. (fmt or "???"), ...)
return vim.loop.hrtime() return vim.loop.hrtime()

View File

@ -197,12 +197,8 @@ end
-- Create empty sub-tables if not present -- Create empty sub-tables if not present
-- @param tbl to create empty inside of -- @param tbl to create empty inside of
-- @param path dot separated string of sub-tables -- @param path dot separated string of sub-tables
-- @return deepest sub-table -- @return table deepest sub-table
function M.table_create_missing(tbl, path) function M.table_create_missing(tbl, path)
if tbl == nil then
return nil
end
local t = tbl local t = tbl
for s in string.gmatch(path, "([^%.]+)%.*") do for s in string.gmatch(path, "([^%.]+)%.*") do
if t[s] == nil then if t[s] == nil then
@ -222,12 +218,8 @@ end
--- @param dst table to copy to --- @param dst table to copy to
--- @param dst_path string dot separated string of sub-tables, created when missing --- @param dst_path string dot separated string of sub-tables, created when missing
--- @param dst_pos string value pos --- @param dst_pos string value pos
--- @param remove boolean default true --- @param remove boolean
function M.move_missing_val(src, src_path, src_pos, dst, dst_path, dst_pos, remove) function M.move_missing_val(src, src_path, src_pos, dst, dst_path, dst_pos, remove)
if remove == nil then
remove = true
end
local ok, err = pcall(vim.validate, { local ok, err = pcall(vim.validate, {
src = { src, "table" }, src = { src, "table" },
src_path = { src_path, "string" }, src_path = { src_path, "string" },
@ -246,11 +238,10 @@ function M.move_missing_val(src, src_path, src_pos, dst, dst_path, dst_pos, remo
if src[pos] and type(src[pos]) == "table" then if src[pos] and type(src[pos]) == "table" then
src = src[pos] src = src[pos]
else else
src = nil return
break
end end
end end
local src_val = src and src[src_pos] local src_val = src[src_pos]
if src_val == nil then if src_val == nil then
return return
end end

View File

@ -389,8 +389,8 @@ function M.restore_tab_state()
end end
--- Returns the window number for nvim-tree within the tabpage specified --- Returns the window number for nvim-tree within the tabpage specified
---@param tabpage number: (optional) the number of the chosen tabpage. Defaults to current tabpage. ---@param tabpage number|nil (optional) the number of the chosen tabpage. Defaults to current tabpage.
---@return number ---@return number|nil
function M.get_winnr(tabpage) function M.get_winnr(tabpage)
tabpage = tabpage or vim.api.nvim_get_current_tabpage() tabpage = tabpage or vim.api.nvim_get_current_tabpage()
local tabinfo = M.View.tabpages[tabpage] local tabinfo = M.View.tabpages[tabpage]
@ -406,8 +406,8 @@ function M.get_bufnr()
end end
--- Checks if nvim-tree is displaying the help ui within the tabpage specified --- Checks if nvim-tree is displaying the help ui within the tabpage specified
---@param tabpage number: (optional) the number of the chosen tabpage. Defaults to current tabpage. ---@param tabpage number|nil (optional) the number of the chosen tabpage. Defaults to current tabpage.
---@return number ---@return number|nil
function M.is_help_ui(tabpage) function M.is_help_ui(tabpage)
tabpage = tabpage or vim.api.nvim_get_current_tabpage() tabpage = tabpage or vim.api.nvim_get_current_tabpage()
local tabinfo = M.View.tabpages[tabpage] local tabinfo = M.View.tabpages[tabpage]