luacheck tutorial

Discussion of Lua and LuaWML support, development, and ideas.

Moderator: Forum Moderators

Post Reply
vghetto
Posts: 755
Joined: November 2nd, 2019, 5:12 pm

luacheck tutorial

Post by vghetto »

Hi,

Is there a tutorial on how to use luacheck with wesnoth?

This is how I'm using it now.

Code: Select all

luacheck /home/amnesia/local/games/wesnoth/1.14/share/wesnoth/data .
Where . is the addon I'm checking.

My ~/.luacheckrc was copied from wesnoth master repo, and modified to reflect my installation paths.

Code: Select all

-- ignore line length warnings
max_line_length=false
max_code_line_length=false
max_string_line_length=false
max_comment_line_length=false
-- show the warning/error codes as well
codes=true
-- don't show files with no issues
quiet=1
-- don't show undefined variable usage
-- there are thousands of warnings here because luacheck is unaware of Wesnoth's lua environment and has no way to check which have been loaded
global=false
-- don't show unused variables
unused=false
-- excluded files due to using lua 5.4 syntax that currently gets flagged as a syntax error
-- clear out once a newer Ubuntu LTS base is used for our docker images, which would then also have a newer luacheck available
exclude_files={
"/home/amnesia/local/games/wesnoth/1.14/share/wesnoth/data/lua/core/wml.lua",
"/home/amnesia/local/games/wesnoth/1.14/share/wesnoth/data/lua/wml-flow.lua",
"/home/amnesia/local/games/wesnoth/1.14/share/wesnoth/data/lua/wml/find_path.lua",
"/home/amnesia/local/games/wesnoth/1.14/share/wesnoth/data/lua/wml/harm_unit.lua",
"/home/amnesia/local/games/wesnoth/1.14/share/wesnoth/data/lua/wml/modify_unit.lua",
"/home/amnesia/local/games/wesnoth/1.14/share/wesnoth/data/lua/wml/random_placement.lua",
"/home/amnesia/local/games/wesnoth/1.14/share/wesnoth/data/lua/functional.lua"}
Is that correct, or am I doing it wrong?
User avatar
Pentarctagon
Project Manager
Posts: 5526
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: luacheck tutorial

Post by Pentarctagon »

For Wesnoth's CI, it runs just luacheck .
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Post Reply