Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linter to be stricter 5.1 #1924

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
std = "max"
std = "min"
include_files = {
"**/*.lua",
"sile.in",
Expand All @@ -21,6 +21,7 @@ files["**/*_spec.lua"] = {
std = "+busted"
}
globals = {
package = { fields = { "searchpath" } },
"SILE",
"SU",
"luautf8",
Expand Down
2 changes: 1 addition & 1 deletion core/cli.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ cli.parseArguments = function ()
-- http://lua-users.org/wiki/VarargTheSecondClassCitizen
local summary = function (...)
local contentloc = SILE.traceStack:locationHead()
local codeloc = table.unpack({...}, 1, select('#', ...))
local codeloc = pl.utils.unpack({...}, 1, select('#', ...))
return ("Processing at: %s\n\tUsing code at: %s"):format(contentloc, codeloc)
end
local unexpected = function ()
Expand Down
2 changes: 1 addition & 1 deletion core/deprecations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ SILE.fluent = setmetatable({}, {
__call = function (_, ...)
fluentglobal()
SILE.fluent = fluent
return fluent(table.unpack({...}, 1, select("#", ...)))
return fluent(pl.utils.unpack({...}, 1, select("#", ...)))
end,
__index = function (_, key)
fluentglobal()
Expand Down
1 change: 1 addition & 0 deletions core/packagemanager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ end

local function loadInSandbox(untrusted_code)
_deprecated()
-- luacheck: ignore _ENV
if _ENV then -- simple Lua 5.2 version check
local env = {}
local untrusted_function, message = load(untrusted_code, nil, 't', env)
Expand Down
1 change: 1 addition & 0 deletions core/sile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SILE.features = require("core.features")

-- Initialize Lua environment and global utilities
SILE.lua_version = _VERSION:sub(-3)
-- luacheck: ignore jit
SILE.lua_isjit = type(jit) == "table"
SILE.full_version = string.format("SILE %s (%s)", SILE.version, SILE.lua_isjit and jit.version or _VERSION)

Expand Down
4 changes: 2 additions & 2 deletions core/utilities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ end
utilities.debug = function (category, ...)
if SILE.quiet then return end
if utilities.debugging(category) then
local inputs = table.pack(...)
local inputs = pl.utils.pack(...)
for i, input in ipairs(inputs) do
if type(input) == "function" then
local status, output = pcall(input)
Expand Down Expand Up @@ -261,7 +261,7 @@ end

utilities.compress = function (items)
local rv = {}
local max = math.max(table.unpack(pl.tablex.keys(items)))
local max = math.max(pl.utils.unpack(pl.tablex.keys(items)))
for i = 1, max do if items[i] then rv[#rv+1] = items[i] end end
return rv
end
Expand Down
2 changes: 1 addition & 1 deletion outputters/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ end

function outputter:_writeline (...)
self:_ensureInit()
local args = table.pack(...)
local args = pl.utils.pack(...)
for i = 1, #args do
outfile:write(args[i])
if i < #args then outfile:write("\t") end
Expand Down
2 changes: 1 addition & 1 deletion outputters/text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ end

function outputter:_writeline (...)
self:_ensureInit()
local args = table.pack(...)
local args = pl.utils.pack(...)
for i=1, #args do
outfile:write(args[i])
end
Expand Down
4 changes: 2 additions & 2 deletions packages/base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function package:deprecatedExport (name, func, noclass, notable)
SU.deprecated(("class.%s"):format(name),
("class.packages.%s:%s"):format(self._name, name),
"0.14.0", "0.16.0", _deprecate_class_funcs)
return func(table.unpack(inputs, 1, select("#", ...) + 1))
return func(pl.utils.unpack(inputs, 1, select("#", ...) + 1))
end
end

Expand All @@ -94,7 +94,7 @@ function package:deprecatedExport (name, func, noclass, notable)
SU.deprecated(("require('packages.%s').exports.%s"):format(self._name, name),
("class.packages.%s:%s"):format(self._name, name),
"0.14.0", "0.16.0", _deprecate_exports_table)
return func(table.unpack(inputs, 1, select("#", ...) + 1))
return func(pl.utils.unpack(inputs, 1, select("#", ...) + 1))
end
end

Expand Down
1 change: 1 addition & 0 deletions packages/bibtex/bibliography.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-- luacheck: globals setfenv getfenv
-- luacheck: ignore _ENV

-- The following functions borrowed from Norman Ramsey's nbibtex,
-- with permission.
Expand Down
2 changes: 1 addition & 1 deletion packages/math/base-elements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ function elements.table:_init (children, options)
self.children = children
self.options = options
self.nrows = #self.children
self.ncols = math.max(table.unpack(mapList(function(_, row)
self.ncols = math.max(pl.utils.unpack(mapList(function(_, row)
return #row.children end, self.children)))
SU.debug("math", "self.ncols =", self.ncols)
self.rowspacing = self.options.rowspacing and SILE.length(self.options.rowspacing)
Expand Down
2 changes: 1 addition & 1 deletion packages/math/texlike.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ local mathGrammar = function (_ENV)
-- Remove the last mathlist if empty. This way,
-- `inner1 \\ inner2 \\` is the same as `inner1 \\ inner2`.
if not t[#t][1] or not t[#t][1][1] then table.remove(t) end
return table.unpack(t)
return pl.utils.unpack(t)
end

START "texlike_math"
Expand Down
Loading