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

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