Merge pull request #3 from fgaz/luacheck-asuna-0.17.0

Update .luacheckrc for asuna 0.17.0
This commit is contained in:
EmptyStar 2024-07-28 12:30:37 -04:00 committed by GitHub
commit ecf961fd14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,18 +45,28 @@ stds.minetest = {
-- Mods that are potentially supported but not included in Asuna. -- Mods that are potentially supported but not included in Asuna.
-- The relevant code must be gated by `if minetest.get_modpath("...")` or similar. -- The relevant code must be gated by `if minetest.get_modpath("...")` or similar.
-- Could be extracted from optional_depends, but in practice not all mods declare it. -- Could be extracted from optional_depends, but in practice not all mods declare it.
-- Could also be extracted from ifs like the one above.
-- In practice only a few of these are not covered by other rules, and often mod
-- names differ from global names they define, so this list was filled manually.
stds.supported_mods = { stds.supported_mods = {
read_globals = { read_globals = {
"abstract_dryplants", -- from dryplants
"armor", -- From 3d_armor "armor", -- From 3d_armor
"awards", "df_primordial_items",
"bonemeal", "df_trees",
"geodes_lib", "geodes_lib",
"hb", -- From hudbars
"hunger_ng", "hunger_ng",
"intllib",
"lucky_block", "lucky_block",
"mapgen_helper", -- From dfcaverns
"mcl_player", "mcl_player",
"mcl_sounds",
"mobs",
"moretrees",
"signs_bot",
"stairsplus", "stairsplus",
"techage", "techage",
"technic",
"technic_cnc", "technic_cnc",
"toolranks", "toolranks",
}, },
@ -64,25 +74,27 @@ stds.supported_mods = {
-- Mods included in Asuna. -- Mods included in Asuna.
-- List generated with: -- List generated with:
-- git grep -ho "^name =.*" | awk '{ sub("\r",""); print " \"" $3 "\"," }' | sort -- git grep --recurse-submodules -ho "^name =.*" | awk '{ sub("\r",""); print " \"" $3 "\"," }' | sort
local mod_names = { local mod_names = {
"abdecor", "abdecor",
"animalia", "animalia",
"asuna_awards",
"asuna_core", "asuna_core",
"asuna_textures", "asuna_textures",
"awards",
"badland", "badland",
"bakedclay", "bakedclay",
"bambooforest",
"beautiflowers", "beautiflowers",
"beds", "beds",
"better_farming",
"binoculars", "binoculars",
"biomes", "biomes",
"biomes_leafdecay",
"boats", "boats",
"bonemeal",
"bones", "bones",
"bottles", "bottles",
"bucket", "bucket",
"bushes", "builtin_item",
"butterflies", "butterflies",
"carts", "carts",
"caverealms", "caverealms",
@ -96,6 +108,8 @@ local mod_names = {
"dye", "dye",
"env_sounds", "env_sounds",
"ethereal", "ethereal",
"everness",
"farming",
"farming", "farming",
"ferns", "ferns",
"fire", "fire",
@ -107,10 +121,12 @@ local mod_names = {
"geodes", "geodes",
"give_initial_stuff", "give_initial_stuff",
"herbs", "herbs",
"item_drop",
"japaneseforest", "japaneseforest",
"keys", "keys",
"leafstride", "leafstride",
"livingjungle", "livingjungle",
"livingslimes",
"lootchests", "lootchests",
"lootchests_default", "lootchests_default",
"map", "map",
@ -119,31 +135,34 @@ local mod_names = {
"music_api", "music_api",
"naturalbiomes", "naturalbiomes",
"nightshade", "nightshade",
"plantlife_modpack",
"player_api", "player_api",
"player_monoids", "player_monoids",
"pl_seaweed", "pl_seaweed",
"pl_sunflowers",
"prairie", "prairie",
"screwdriver", "screwdriver",
"sethome", "sethome",
"sfinv", "sfinv",
"sfinv_buttons", "sfinv_buttons",
"show_wielded_item", "show_wielded_item",
"signs_lib",
"skinsdb",
"soup", "soup",
"spawn", "spawn",
"stairs", "stairs",
"stamina", "stamina",
"terracotta", "telemosaic",
"tnt", "tnt",
"too_many_stones", "too_many_stones",
"tt",
"tt_base",
"vessels", "vessels",
"walls", "walls",
"weather", "weather",
"wielded_light", "wielded_light",
"wool", "wool",
"worldgate",
"x_farming",
"xpanes", "xpanes",
"youngtrees",
} }
-- Globals defined by Asuna. -- Globals defined by Asuna.
@ -155,23 +174,50 @@ globals = {
"abstract_ferns", -- from ferns "abstract_ferns", -- from ferns
"abstract_youngtrees", -- from youngtrees "abstract_youngtrees", -- from youngtrees
"music", -- from music_api "music", -- from music_api
"skins", -- from skinsdb
table.unpack(mod_names) table.unpack(mod_names)
} }
exclude_files = {
-- Assets
"mods/livingjungle/schematics",
-- Legacy stuff
"mods/animalia/api/legacy_convert.lua",
"mods/minetest_game/default/legacy.lua",
}
-- Mod-specific configuration -- Mod-specific configuration
----------------------------- -----------------------------
-- Import existing .luacheckrc files -- Import existing .luacheckrc files
-- List generated with:
-- find mods -name .luacheckrc -exec dirname {} \; | xargs -L1 basename | awk '{ sub("\r",""); print " \"" $1 "\"," }' | sort
local mods_with_luacheckrc = { local mods_with_luacheckrc = {
"animalia",
"awards",
"creatura", "creatura",
"everness",
"flowerpot", "flowerpot",
"item_drop",
"plantlife_modpack",
"player_monoids", "player_monoids",
"signs_lib",
"skinsdb",
"stamina", "stamina",
"telemosaic",
"x_farming",
} }
for _,modname in ipairs(mods_with_luacheckrc) do for _,modname in ipairs(mods_with_luacheckrc) do
files["mods/"..modname] = {} local modpath = "mods/" .. modname
files[modpath] = {}
-- store globals defined in the mod's .luacheckrc in the corresponding files table -- store globals defined in the mod's .luacheckrc in the corresponding files table
assert(pcall(assert(loadfile("mods/"..modname.."/.luacheckrc", nil, files["mods/"..modname])))) assert(pcall(assert(loadfile(modpath.."/.luacheckrc", nil, files[modpath]))))
if files[modpath].exclude_files then
for i,path in ipairs(files[modpath].exclude_files) do
-- exclude_files only works in the global scope, not in files[]
table.insert(exclude_files, modpath.."/"..path)
end
end
end end
-- Used variable "_foo" with unused hint. -- Used variable "_foo" with unused hint.
@ -184,9 +230,3 @@ files["mods/asuna/asuna_core"] = { globals = { minetest = { fields = { "register
files["mods/minetest_game/creative"] = { globals = { minetest = { fields = { "creative" } } } } files["mods/minetest_game/creative"] = { globals = { minetest = { fields = { "creative" } } } }
files["mods/minetest_game/player_api"] = { globals = { minetest = { fields = { "calculate_knockback" } } } } files["mods/minetest_game/player_api"] = { globals = { minetest = { fields = { "calculate_knockback" } } } }
files["mods/ethereal/crystal.lua"] = { globals = { minetest = { fields = { "handle_node_drops" } } } } files["mods/ethereal/crystal.lua"] = { globals = { minetest = { fields = { "handle_node_drops" } } } }
exclude_files = {
-- Legacy stuff
"mods/animalia/api/legacy_convert.lua",
"mods/minetest_game/default/legacy.lua",
}