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 yspc = 2
local skinwidth = 1 local skinwidth = 1
local skinheight = 2 local skinheight = 2
local xscale = 1 local xscale = 1 -- luacheck: ignore
local btn_y = 8.15 local btn_y = 8.15
local drop_y = 8 local drop_y = 8
local btn_width = 1 local btn_width = 1

View File

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

View File

@ -1,7 +1,7 @@
local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures") local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures")
for _, fn in pairs(skins_dir_list) do 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("_") local nameparts = string.gsub(fn, "[.]", "_"):split("_")
-- check allowed prefix and file extension -- check allowed prefix and file extension