Use new linter (#294)

* Use new linter

* Luacheck and Sumneko Lua fixes

* Bump CI action versions

* Fix excludes for ldoc
This commit is contained in:
Cooldude2606
2024-05-29 15:39:37 +01:00
committed by GitHub
parent 4fa410e872
commit 8638504550
27 changed files with 96 additions and 92 deletions

View File

@@ -36,7 +36,7 @@ local Async = {}
local internal_run =
Token.register(function(params)
local func = Token.get(params.token)
return func(unpack(params.params))
return func(table.unpack(params.params))
end)
--[[-- Register a new async function, must called when the file is loaded

View File

@@ -692,7 +692,7 @@ nb: use error(error_message) within your callback to trigger do not trigger dire
@treturn boolean The opposite of success so true means to cancel execution, used internally
@usage-- Used in the command system to log handler errors
local success, err = pcall(command_data.callback, player, unpack(params))
local success, err = pcall(command_data.callback, player, table.unpack(params))
if Commands.internal_error(success, command_data.name, err) then
return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, err)
end
@@ -806,7 +806,7 @@ function Commands.run_command(command_event)
end
-- If its not a function throw and error
if not type(parse_callback) == 'function' then
if type(parse_callback) ~= 'function' then
Commands.internal_error(false, command_data.name, 'Invalid param parse '..tostring(param_data.parse))
command_log(player, command_data, 'Internal Error: Invalid Param Parse', params, raw_input, tostring(param_data.parse))
return
@@ -820,7 +820,7 @@ function Commands.run_command(command_event)
end
-- input: string, player: LuaPlayer, reject: function, ... extra args
local success, param_parsed = pcall(parse_callback, raw_params[index], player, reject, unpack(param_data.parse_args))
local success, param_parsed = pcall(parse_callback, raw_params[index], player, reject, table.unpack(param_data.parse_args))
if Commands.internal_error(success, command_data.name, param_parsed) then
return command_log(player, command_data, 'Internal Error: Param Parse Fail', params, raw_input, param_parsed)
end
@@ -837,7 +837,7 @@ function Commands.run_command(command_event)
elseif param_parsed == nil or param_parsed == Commands.defines.error or param_parsed == reject then
-- No value was returned or error was returned, if nil then give generic error
if not param_parsed == Commands.defines.error then
if param_parsed ~= Commands.defines.error then
command_log(player, command_data, 'Invalid Param Given', raw_params, raw_input, param_name)
Commands.error{'expcore-commands.command-error-param-format', param_name, 'please make sure it is the correct type'}
end
@@ -853,7 +853,7 @@ function Commands.run_command(command_event)
-- Run the command
-- player: LuaPlayer, ... command params, raw: string
params[command_data.max_param_count+1] = raw_input
local success, rtn = pcall(command_data.callback, player, unpack(params))
local success, rtn = pcall(command_data.callback, player, table.unpack(params))
if Commands.internal_error(success, command_data.name, rtn) then
return command_log(player, command_data, 'Internal Error: Command Callback Fail', raw_params, command_event.parameter, rtn)
end

View File

@@ -90,7 +90,7 @@ function Gui.inject_left_flow_order(provider)
Gui.get_left_flow_order = provider
local debug_info = debug.getinfo(2, "Sn")
local file_name = debug_info.source:match('^.+/currently%-playing/(.+)$'):sub(1, -5)
local func_name = debug_info.name or "<anonymous:"..debug_info.linedefined..">"
local func_name = debug_info.name or ("<anonymous:"..debug_info.linedefined..">")
Gui._left_flow_order_src = file_name..":"..func_name
end

View File

@@ -59,7 +59,7 @@ end
local function get_defined_at(level)
local debug_info = debug.getinfo(level, "Sn")
local file_name = debug_info.source:match('^.+/currently%-playing/(.+)$'):sub(1, -5)
local func_name = debug_info.name or "<anonymous:"..debug_info.linedefined..">"
local func_name = debug_info.name or ("<anonymous:"..debug_info.linedefined..">")
return file_name..":"..func_name
end

View File

@@ -40,6 +40,7 @@ Gui.toolbar_button_style(button, false)
]]
function Gui.toolbar_button_style(button, state, size)
---@cast button LuaGuiElement
if state then
button.style = Gui.top_flow_button_toggled_style
else
@@ -107,7 +108,7 @@ function Gui.inject_top_flow_order(provider)
Gui.get_top_flow_order = provider
local debug_info = debug.getinfo(2, "Sn")
local file_name = debug_info.source:match('^.+/currently%-playing/(.+)$'):sub(1, -5)
local func_name = debug_info.name or "<anonymous:"..debug_info.linedefined..">"
local func_name = debug_info.name or ("<anonymous:"..debug_info.linedefined..">")
Gui._top_flow_order_src = file_name..":"..func_name
end