test: add luacheck
This commit is contained in:
parent
7ef47baadb
commit
1521ca9709
61
.luacheckrc
Normal file
61
.luacheckrc
Normal file
@ -0,0 +1,61 @@
|
||||
-- Luacheck config for CC:Tweaked (ComputerCraft) Lua sandbox.
|
||||
-- Runtime is Lua 5.1 inside the CC sandbox, not standard Lua, so we
|
||||
-- extend lua51 with the globals and os/table extensions CC provides.
|
||||
|
||||
stds.cc = {
|
||||
read_globals = {
|
||||
-- ComputerCraft APIs injected as globals by the sandbox.
|
||||
"fs",
|
||||
"peripheral",
|
||||
"parallel",
|
||||
"shell",
|
||||
"term",
|
||||
"textutils",
|
||||
"colors",
|
||||
"colours",
|
||||
"rednet",
|
||||
"gps",
|
||||
"http",
|
||||
"settings",
|
||||
"window",
|
||||
"paintutils",
|
||||
"keys",
|
||||
"vector",
|
||||
"commands",
|
||||
"disk",
|
||||
"periphemu", -- CraftOS-PC emulator only
|
||||
"read",
|
||||
"sleep",
|
||||
"write",
|
||||
-- CC extends the standard os/table tables with extra fields.
|
||||
os = {
|
||||
fields = {
|
||||
"getComputerID", "getComputerLabel", "setComputerLabel",
|
||||
"queueEvent", "pullEvent", "pullEventRaw",
|
||||
"startTimer", "cancelTimer", "sleep",
|
||||
"reboot", "shutdown", "version",
|
||||
"epoch", "day", "clock", "time",
|
||||
"loadAPI", "unloadAPI", "run",
|
||||
},
|
||||
},
|
||||
table = {
|
||||
fields = { "pack", "unpack" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
std = "lua51+cc"
|
||||
|
||||
-- _G.isRouterEnabled is a cross-module flag set/read at runtime; `_` is the
|
||||
-- throwaway global used in router.lua.
|
||||
globals = {
|
||||
"isRouterEnabled",
|
||||
"_",
|
||||
}
|
||||
|
||||
-- `_VERSION` is a per-module convention (see CLAUDE.md) and intentionally unused.
|
||||
ignore = {
|
||||
"211/_VERSION", -- unused local _VERSION
|
||||
}
|
||||
|
||||
max_line_length = false
|
||||
10
Justfile
Normal file
10
Justfile
Normal file
@ -0,0 +1,10 @@
|
||||
# Justfile for cc-libs
|
||||
# Run `just check` to lint all Lua code with luacheck.
|
||||
|
||||
# List available recipes.
|
||||
default:
|
||||
@just --list
|
||||
|
||||
# Lint all Lua source with luacheck.
|
||||
check:
|
||||
luacheck apis programs servers startup install.lua
|
||||
@ -239,9 +239,9 @@ local function deployCommand()
|
||||
local filePath = allFiles[i];
|
||||
local fileContent = readFile(filePath)
|
||||
|
||||
local ok, res = net.sendRequest(CUBE_CHANNEL, 'deploy-file', { path = filePath, content = fileContent }, machineId);
|
||||
local transferOk, res = net.sendRequest(CUBE_CHANNEL, 'deploy-file', { path = filePath, content = fileContent }, machineId);
|
||||
|
||||
if ok and res then
|
||||
if transferOk and res then
|
||||
fileTransfered = fileTransfered + 1;
|
||||
else
|
||||
print('Error transfering file \'' .. filePath .. '\'');
|
||||
|
||||
@ -7,11 +7,9 @@ if firstArg == '-version' or firstArg == '--version' then
|
||||
return;
|
||||
end
|
||||
|
||||
local verbose = true
|
||||
local printVerbose = print
|
||||
|
||||
if firstArg == '-silent' or firstArg == '--silent' then
|
||||
verbose = false
|
||||
printVerbose = function() end
|
||||
end
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ local function getServerFns(serverList)
|
||||
local servers = {};
|
||||
|
||||
for k, v in ipairs(serverList) do
|
||||
local serverName = serverList[k];
|
||||
local serverName = v;
|
||||
|
||||
servers[k] = function()
|
||||
if serverName then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user