Skip to content

Commit

Permalink
refactor(luacheck): manually remove errors undetected
Browse files Browse the repository at this point in the history
  • Loading branch information
pysan3 authored and vhyrro committed Nov 15, 2023
1 parent ecf9b3a commit 59b6f8b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lua/neorg/core/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local lib = require("neorg.core.lib")

local function neovim_version()
local data = {}
local parsed_output = vim.api.nvim_exec("version", true)
local parsed_output = vim.api.nvim_exec("version", true) ---@diagnostic disable-line -- TODO: type error workaround <pysan3>

for _, line in ipairs(vim.split(parsed_output, "\n")) do
local key, value = line:match("^%s*(.+[^%s]):%s+(.+)$")
Expand Down
2 changes: 1 addition & 1 deletion lua/neorg/core/log.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ log.get_default_config = function()
return default_config
end

local unpack = unpack or table.unpack
local unpack = unpack or table.unpack ---@diagnostic disable-line -- TODO: type error workaround <pysan3>

log.new = function(config, standalone)
config = vim.tbl_deep_extend("force", default_config, config)
Expand Down
6 changes: 3 additions & 3 deletions lua/neorg/modules/core/highlights/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ module.public = {
local is_link = highlight:sub(1, 1) == "+"

local full_highlight_name = "@neorg" .. prefix .. (hl_name:len() > 0 and ("." .. hl_name) or "")
local does_hl_exist = lib.inline_pcall(vim.api.nvim_exec, "highlight " .. full_highlight_name, true)
local does_hl_exist = lib.inline_pcall(vim.api.nvim_exec, "highlight " .. full_highlight_name, true) ---@diagnostic disable-line -- TODO: type error workaround <pysan3>

-- If we are dealing with a link then link the highlights together (excluding the + symbol)
if is_link then
Expand Down Expand Up @@ -514,7 +514,7 @@ module.public = {
end

local full_highlight_name = "@neorg" .. prefix .. (hl_name:len() > 0 and ("." .. hl_name) or "")
local does_hl_exist = lib.inline_pcall(vim.api.nvim_exec, "highlight " .. full_highlight_name, true)
local does_hl_exist = lib.inline_pcall(vim.api.nvim_exec, "highlight " .. full_highlight_name, true) ---@diagnostic disable-line -- TODO: type error workaround <pysan3>

-- If the highlight already exists then assume the user doesn't want it to be
-- overwritten
Expand Down Expand Up @@ -577,7 +577,7 @@ module.public = {
-- <3
get_attribute = function(name, attribute)
-- Attempt to get the highlight
local success, hl = pcall(vim.api.nvim_get_hl_by_name, name, true)
local success, hl = pcall(vim.api.nvim_get_hl_by_name, name, true) ---@diagnostic disable-line -- TODO: type error workaround <pysan3>

-- If we were successful and if the attribute exists then return it
if success and hl[attribute] then
Expand Down
4 changes: 2 additions & 2 deletions lua/neorg/modules/core/neorgcmd/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.examples = {
-- In your module.setup(), make sure to require core.neorgcmd (requires = { "core.neorgcmd" })
-- Afterwards in a function of your choice that gets called *after* core.neorgcmd gets intialized e.g. load():

module.load = function()
module.load = function() ---@diagnostic disable-line -- TODO: type error workaround <pysan3> Duplicate field `load` (L94)
module.required["core.neorgcmd"].add_commands_from_table({
-- The name of our command
my_command = {
Expand Down Expand Up @@ -91,7 +91,7 @@ module.examples = {
end,
}

module.load = function()
module.load = function() ---@diagnostic disable-line -- TODO: type error workaround <pysan3> Duplicate field `load` (L26)
-- Define the :Neorg command with autocompletion taking any number of arguments (-nargs=*)
-- If the user passes no arguments or too few, we'll query them for the remainder using select_next_cmd_arg.
vim.api.nvim_create_user_command("Neorg", module.private.command_callback, {
Expand Down
4 changes: 2 additions & 2 deletions lua/neorg/modules/core/syntax/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ module.public = {
-- make sure that group has things when needed
local regex = group .. "%s+cluster=(.+)"
local _, found_cluster =
pcall(vim.api.nvim_exec, string.format("syntax list @%s", group), true)
pcall(vim.api.nvim_exec, string.format("syntax list @%s", group), true) ---@diagnostic disable-line -- TODO: type error workaround <pysan3>: `nvim_exec` not found
local actual_cluster
for match in found_cluster:gmatch(regex) do
actual_cluster = match
Expand Down Expand Up @@ -319,7 +319,7 @@ module.public = {
end

has_syntax = string.format("syntax list %s", snip)
_, result = pcall(vim.api.nvim_exec, has_syntax, true)
_, result = pcall(vim.api.nvim_exec, has_syntax, true) ---@diagnostic disable-line -- TODO: type error workaround <pysan3>: `nvim_exec` not found
count = select(2, result:gsub("\n", "\n")) -- get length of result from syn list

--[[
Expand Down
2 changes: 1 addition & 1 deletion lua/neorg/modules/core/ui/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ module.public = {

local bufname = "neorg://" .. name

if vim.fn.bufexists(bufname) == 1 then
if vim.fn.bufexists(bufname) == 1 then ---@diagnostic disable-line -- TODO: type error workaround <pysan3>: cannot assign `string` to parameter `integer`
log.error("Buffer '" .. name .. "' already exists")
return
end
Expand Down

0 comments on commit 59b6f8b

Please sign in to comment.