Add Continuous Integration and LuaCheck (#71)

All warnings have been fixed as well.
This commit is contained in:
David Leal 2022-06-16 05:06:35 -05:00 committed by GitHub
parent 03d424fea7
commit b769824d24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 6 deletions

11
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,11 @@
on: [push, pull_request]
name: build
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: lint
uses: Roang-zero1/factorio-mod-luacheck@master
with:
luacheckrc_url: ""

13
.luacheckrc Normal file
View File

@ -0,0 +1,13 @@
unused_args = false
allow_defined_top = true
max_line_length = 999
globals = {
"minetest", "unified_inventory", "core",
"player_api", "clothing", "armor", "sfinv",
}
read_globals = {
string = {fields = {"split", "trim"}},
table = {fields = {"copy", "getn"}},
}

View File

@ -57,7 +57,7 @@ function skins.get_skin_selection_formspec(player, context, perplayer_formspec)
local yspc = 2
local skinwidth = 1
local skinheight = 2
local xscale = 1
local xscale = 1 -- luacheck: ignore
local btn_y = 8.15
local drop_y = 8
local btn_width = 1
@ -104,7 +104,7 @@ function skins.get_skin_selection_formspec(player, context, perplayer_formspec)
local page = context.skins_page
local formspec = ""
for i = (page-1)*maxdisp+1, page*maxdisp do
local skin = context.skins_list[i]
if not skin then

View File

@ -221,6 +221,6 @@ end
function skin_class:is_applicable_for_player(playername)
local assigned_player = self:get_meta("playername")
return assigned_player == nil or assigned_player == true or
playername and (minetest.check_player_privs(playername, {server=true}) or
assigned_player:lower() == playername:lower())
playername and (minetest.check_player_privs(playername, {server=true}) or
assigned_player:lower() == playername:lower())
end

View File

@ -1,7 +1,7 @@
local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures")
for _, fn in pairs(skins_dir_list) do
local name, sort_id, assignment, is_preview, playername
local name, sort_id, is_preview, playername
local nameparts = string.gsub(fn, "[.]", "_"):split("_")
-- check allowed prefix and file extension

View File

@ -115,7 +115,7 @@ internal.get_pages_count = function(callback, ...)
callback(math.ceil(list.pages / 20), unpack(vars))
end)
end
-- Function to fetch a range of pages
internal.fetch_function = function(pages_total, start_page, len)
start_page = math.max(start_page, 1)