From 65651e5a7842529186a8f03b8ed8cabffc07638d Mon Sep 17 00:00:00 2001 From: NatureFreshMilk Date: Fri, 29 Mar 2019 10:42:15 +0100 Subject: [PATCH] luacheck in main build --- Makefile | 7 +++++++ docker_builder/Dockerfile | 6 ++++++ mapserver_mod/mapserver/.luacheckrc | 24 ++++++++++++++++++++++++ mapserver_mod/mapserver/border.lua | 4 ---- mapserver_mod/mapserver/bridge.lua | 2 +- mapserver_mod/mapserver/label.lua | 4 ---- mapserver_mod/mapserver/poi.lua | 4 ---- mapserver_mod/mapserver/train.lua | 5 ----- 8 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 mapserver_mod/mapserver/.luacheckrc diff --git a/Makefile b/Makefile index 9ad9a56..df7ff0f 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,13 @@ $(OUT_DIR): mkdir $@ $(MOD_ZIP): $(OUT_DIR) + # lint with luacheck + sudo docker run --rm -it\ + -v $(shell pwd)/mapserver_mod/mapserver:/app\ + -w /app\ + mapserver-builder\ + luacheck . + # zip mod zip -r $(OUT_DIR)/mapserver-mod.zip mapserver_mod clean: diff --git a/docker_builder/Dockerfile b/docker_builder/Dockerfile index 09c02f0..739a3fb 100644 --- a/docker_builder/Dockerfile +++ b/docker_builder/Dockerfile @@ -1,9 +1,15 @@ FROM ubuntu:bionic +# cross compile stuff RUN apt-get update &&\ apt-get install -y gcc-mingw-w64 gcc-5-arm-linux-gnueabihf gcc-i686-linux-gnu &&\ apt-get install -y software-properties-common git +# go stuff RUN add-apt-repository ppa:longsleep/golang-backports &&\ apt-get update &&\ apt-get install -y golang-go + +# luacheck +RUN apt-get install -y luarocks liblua5.1-dev +RUN luarocks install luacheck diff --git a/mapserver_mod/mapserver/.luacheckrc b/mapserver_mod/mapserver/.luacheckrc new file mode 100644 index 0000000..01c0c6a --- /dev/null +++ b/mapserver_mod/mapserver/.luacheckrc @@ -0,0 +1,24 @@ +unused_args = false +allow_defined_top = true + +globals = { + "mapserver", + "advtrains" +} + +read_globals = { + -- Stdlib + string = {fields = {"split"}}, + table = {fields = {"copy", "getn"}}, + + -- Minetest + "minetest", + "vector", "ItemStack", + "dump", + + -- Deps + "unified_inventory", "default", + + -- optional mods + "xban" +} diff --git a/mapserver_mod/mapserver/border.lua b/mapserver_mod/mapserver/border.lua index e8ce3de..da84567 100644 --- a/mapserver_mod/mapserver/border.lua +++ b/mapserver_mod/mapserver/border.lua @@ -3,8 +3,6 @@ local last_index = 0 local last_name = "" local update_formspec = function(meta) - local inv = meta:get_inventory() - local name = meta:get_string("name") local index = meta:get_string("index") @@ -68,8 +66,6 @@ minetest.register_node("mapserver:border", { meta:set_int("index", index) end end - else - -- non-owner end diff --git a/mapserver_mod/mapserver/bridge.lua b/mapserver_mod/mapserver/bridge.lua index d2fad4c..104f632 100644 --- a/mapserver_mod/mapserver/bridge.lua +++ b/mapserver_mod/mapserver/bridge.lua @@ -12,7 +12,7 @@ local function explode(sep, input) end local function get_max_lag() local arrayoutput = explode(", ",minetest.get_server_status()) - local arrayoutput = explode("=",arrayoutput[4]) + arrayoutput = explode("=",arrayoutput[4]) return arrayoutput[1] end diff --git a/mapserver_mod/mapserver/label.lua b/mapserver_mod/mapserver/label.lua index 03ae95a..c835317 100644 --- a/mapserver_mod/mapserver/label.lua +++ b/mapserver_mod/mapserver/label.lua @@ -1,7 +1,5 @@ local update_formspec = function(meta) - local inv = meta:get_inventory() - local text = meta:get_string("text") local size = meta:get_string("size") local direction = meta:get_string("direction") @@ -64,8 +62,6 @@ minetest.register_node("mapserver:label", { meta:set_string("direction", fields.direction) meta:set_string("size", fields.size) end - else - -- non-owner end diff --git a/mapserver_mod/mapserver/poi.lua b/mapserver_mod/mapserver/poi.lua index 28da29f..d8d4a45 100644 --- a/mapserver_mod/mapserver/poi.lua +++ b/mapserver_mod/mapserver/poi.lua @@ -1,7 +1,5 @@ local update_formspec = function(meta) - local inv = meta:get_inventory() - local name = meta:get_string("name") local category = meta:get_string("category") local url = meta:get_string("url") or "" @@ -64,8 +62,6 @@ minetest.register_node("mapserver:poi", { meta:set_string("url", fields.url) meta:set_string("category", fields.category) end - else - -- non-owner end diff --git a/mapserver_mod/mapserver/train.lua b/mapserver_mod/mapserver/train.lua index a906dbd..98b528e 100644 --- a/mapserver_mod/mapserver/train.lua +++ b/mapserver_mod/mapserver/train.lua @@ -3,8 +3,6 @@ local last_index = 0 local last_line = "" local update_formspec = function(meta) - local inv = meta:get_inventory() - local line = meta:get_string("line") local station = meta:get_string("station") local index = meta:get_string("index") @@ -72,9 +70,6 @@ minetest.register_node("mapserver:train", { meta:set_int("index", index) end end - - else - -- non-owner end