diff --git a/.github/workflows/fmtk.yml b/.github/workflows/fmtk.yml index 13fa984f..80ee4575 100644 --- a/.github/workflows/fmtk.yml +++ b/.github/workflows/fmtk.yml @@ -20,12 +20,12 @@ jobs: jq -s '.[0] * .[1].settings' temp.luarc.json ${{ github.workspace }}/factorio/config.json > check.luarc.json - name: Install LuaLS run: | - wget https://github.com/LuaLS/lua-language-server/releases/download/3.13.2/lua-language-server-3.13.2-linux-x64.tar.gz -q -O lusls.tar.gz + wget https://github.com/LuaLS/lua-language-server/releases/download/3.13.9/lua-language-server-3.13.9-linux-x64.tar.gz -q -O lusls.tar.gz mkdir luals && tar -xf lusls.tar.gz -C luals && rm lusls.tar.gz - name: Run Lint Report shell: bash run: | - ./luals/bin/lua-language-server --check=. --logpath=. --configpath=check.luarc.json --checklevel=Information + ./luals/bin/lua-language-server --check=. --logpath=. --configpath=check.luarc.json --checklevel=Information --check_out_path=check.json # Credit to https://github.com/Krealle/luals-check-action/blob/main/action.yml # Although some minor fixes were needed diff --git a/exp_groups/module/module_exports.lua b/exp_groups/module/module_exports.lua index 6f84f4da..56518bc8 100644 --- a/exp_groups/module/module_exports.lua +++ b/exp_groups/module/module_exports.lua @@ -216,9 +216,10 @@ end --- @param actions_names string[] An array of action names --- @return defines.input_action[] local function names_to_actions(actions_names) + --- @type defines.input_action[], number[], number local actions, invalid, invalid_i = {}, {}, 1 for i, action_name in ipairs(actions_names) do - local action = defines.input_action[action_name] + local action = defines.input_action[action_name] --[[ @as defines.input_action? ]] if action then actions[i] = action else diff --git a/exp_gui/module/data.lua b/exp_gui/module/data.lua index c792fcdb..bae2488b 100644 --- a/exp_gui/module/data.lua +++ b/exp_gui/module/data.lua @@ -87,7 +87,7 @@ function GuiData._metatable.__index(self, key) -- Check a given child table based on the object type assert(type(key) == "userdata", "Index type '" .. ExpUtil.get_class_name(key) .. "' given to GuiData. Must be of type userdata.") - local object_name = key.object_name + local object_name = key.object_name --- @diagnostic disable-line assign-type-mismatch if object_name == "LuaGuiElement" then local data = self._raw.element_data local player_elements = data and data[key.player_index] @@ -110,7 +110,7 @@ end --- @param value unknown function GuiData._metatable.__newindex(self, key, value) assert(type(key) == "userdata", "Index type '" .. ExpUtil.get_class_name(key) .. "' given to GuiData. Must be of type userdata.") - local object_name = key.object_name + local object_name = key.object_name --- @diagnostic disable-line assign-type-mismatch if object_name == "LuaGuiElement" then local data = self.element_data local player_elements = data[key.player_index] diff --git a/exp_gui/module/iter.lua b/exp_gui/module/iter.lua index 450a7a52..388bf8ef 100644 --- a/exp_gui/module/iter.lua +++ b/exp_gui/module/iter.lua @@ -37,6 +37,7 @@ local function nop() return nil, nil end local function next_valid_element(elements, prev_index) local element_index, element = next(elements, prev_index) while element and not element.valid do + --- @cast element_index -nil elements[element_index] = nil element_index, element = next(elements, element_index) end @@ -61,6 +62,7 @@ local function next_valid_player(scope_elements, players, prev_index, online) if index == nil then return nil, nil, nil end + --- @cast player -nil if online == nil or player.connected == online then local player_elements = scope_elements[player.index] diff --git a/exp_legacy/module/expcore/permission_groups.lua b/exp_legacy/module/expcore/permission_groups.lua index 9181e614..6df8f468 100644 --- a/exp_legacy/module/expcore/permission_groups.lua +++ b/exp_legacy/module/expcore/permission_groups.lua @@ -142,7 +142,7 @@ group:set_action('toggle_map_editor', false) ]] function PermissionsGroups._prototype:set_action(action, state) - local input_action = defines.input_action[action] + local input_action = defines.input_action[action] --[[ @as defines.input_action? ]] if input_action == nil then input_action = action end assert(type(input_action) == "number", tostring(action) .. " is not a valid input action") self.actions[input_action] = state diff --git a/exp_scenario/module/commands/connect.lua b/exp_scenario/module/commands/connect.lua index 5cb4b4f0..b935b45d 100644 --- a/exp_scenario/module/commands/connect.lua +++ b/exp_scenario/module/commands/connect.lua @@ -34,7 +34,7 @@ local function get_server_id(server) if server_count > 1 then return false, { "exp-commands_connect.too-many-matching", concat(server_names, ", ") } elseif server_count == 1 then - local server_id, server_details = next(servers) + local server_id, server_details = next(servers) --- @cast server_details -nil local status = External.get_server_status(server_id) if server_id == current_server.id then return false, { "exp-commands_connect.same-server", server_details.name } diff --git a/exp_util/module/module_exports.lua b/exp_util/module/module_exports.lua index e1deb308..e6394bae 100644 --- a/exp_util/module/module_exports.lua +++ b/exp_util/module/module_exports.lua @@ -42,7 +42,7 @@ local function check_type(value, type_name) if type_name == "userdata" then return false, value_type end - value_type = value.object_name + value_type = value.object_name --- @diagnostic disable-line assign-type-mismatch elseif value_type == "table" then if type_name == "table" then return false, value_type