Verified Commit a2d5e035 authored by Karel Koci's avatar Karel Koci 🤘

Use system wide luacheck instead of our own version

There is also new upstream version of luacheck that does more stuff.
Because of that there are some fixes in code.
parent 0200e14e
......@@ -8,7 +8,7 @@ RUN \
apt-get -y install --no-install-recommends \
busybox ca-certificates curl git \
make pkg-config gcc cmake \
check cppcheck valgrind \
check cppcheck lua-check valgrind \
libcurl4-openssl-dev libevent-dev \
lua5.1 liblua5.1-0-dev \
asciidoc lcov markdown libcommon-sense-perl \
......
......@@ -4,6 +4,3 @@
[submodule "tests/lunit-launch/lunit"]
path = tests/lunit-launch/lunit
url = http://repo.or.cz/lunit.git
[submodule "tests/luacheck"]
path = tests/luacheck
url = https://github.com/mpeterv/luacheck.git
......@@ -38,7 +38,7 @@ local WARN = WARN
module "requests"
-- luacheck: globals known_packages package_wrap known_repositories known_repositories_all repo_serial repository repository_get content_requests install uninstall script known_content_packages
-- luacheck: globals known_packages package_wrap known_repositories known_repositories_all repo_serial repository repository_get content_requests install uninstall script known_content_packages package
-- Verifications fields are same for script, repository and package. Lets define them here once and then just append.
local allowed_extras_verification = {
......@@ -150,8 +150,8 @@ local function extra_check_deps(what, field, deps)
error(utils.exception("bad value", "Invalid type " .. tostring(v) .. " (expecting dependency description) of extra option " .. field .. " for a " .. what))
end
if type(deps) == "table" then
if table.tp then
local tp = table.tp
if deps.tp then
local tp = deps.tp
if tp ~= "dep-and" and tp ~= "dep-or" and tp ~= "dep-not" and tp ~= "package" then
invalid(tp)
end
......
......@@ -50,7 +50,7 @@ module "sandbox"
-- luacheck: globals morpher state_vars level new run_sandboxed load_state_vars
-- This can be changed often (always when we add some new feature). So it is defined here at top and not buried in code.
-- This can be changed often (always when we add some new feature). So it is defined here at top and not buried in code.
local updater_features = utils.arr2set({
'priorities',
'provides',
......
......@@ -91,7 +91,7 @@ end
-- Returns sat variable for package group of given name. If it is not yet added, then we create new variable for it and also for all its dependencies and candidates.
-- Note that this have to work if the group is unknown (dependency on package we don't know)
function sat_pkg_group(state, name)
if state.pkg2sat[name] then
if state.pkg2sat[name] then
return state.pkg2sat[name] -- Already added package group, return its variable.
end
-- Create new variable for this package
......@@ -156,7 +156,7 @@ function sat_pkg_group(state, name)
return pkg_var
end
-- Returns sat variable for specified requirements on given package.
-- Returns sat variable for specified requirements on given package.
function sat_dep(state, pkg, version, repository)
local name = pkg.name or pkg
local group_var = sat_pkg_group(state, name) -- This also ensures that candidates are in sat
......@@ -424,7 +424,7 @@ local function build_plan(pkgs, requests, sat, satmap)
end
-- We plan packages with immediate replan first to ensure that such replan happens as soon as possible.
for name, pkg in pairs(pkgs) do
for name, pkg in pairs(pkgs) do
-- pkgs contains all packages so we have to check if package is in sat at all
if utils.multi_index(pkg, 'modifier', 'replan') == "immediate" and satmap.pkg2sat[name] and not (satmap.missing[pkg] or satmap.missing[name]) then -- we ignore missing packages, as they wouldn't be planned anyway and error or warning should be given by requests and other packages later on.
pkg_plan(name, false, false, 'Planned package with replan enabled'); -- we don't expect to see this parent_str because we are planning this first, but it theoretically can happen so this makes at least some what sense.
......@@ -636,7 +636,7 @@ abi_change_deep fields.
local function check_abi_change(requests, install)
local reqs = utils.map(requests, function(_, v) return v.name, v end)
-- Build inverted dependencies
local invdep -- initialized
local invdep -- initialized
local function abi_changed(name, abi_ch, causepkg)
-- Ignore package that we don't request. Also ignore if no abi change is
-- passed and package is not going to be installed.
......
.PHONY: check-clean test valgrind luacheck check test-locks valgrind-locks luac-autoload luacheck coverage $(O)/.coverage.info
.PHONY: test valgrind luacheck check test-locks valgrind-locks luac-autoload coverage $(O)/.coverage.info
BINARIES_NOTARGET += tests/locks
locks_MODULES += locks
locks_LOCAL_LIBS += updater
$(O)/tests/luacheck-compiled/bin/luacheck:
mkdir -p $(O)/tests/luacheck-compiled
cd $(S)/tests/luacheck && ./install.lua $(abspath $(O)/tests/luacheck-compiled)
clean: check-clean
check-clean:
rm -rf $(O)/tests/luacheck-compiled
C_TESTS := \
arguments \
events \
......@@ -134,8 +126,8 @@ valgrind-lua-%: $(S)/tests/%.lua $(O)/bin/lulaunch $(OPENSSL_LIBS) FORCE
luac-autoload-%: $(S)/src/lib/autoload/a_%.lua FORCE
luac -p $<
luacheck-%: $(S)/src/lib/autoload/a_%.lua $(O)/tests/luacheck-compiled/bin/luacheck $(S)/tests/luacheck.config FORCE
$(O)/tests/luacheck-compiled/bin/luacheck --config $(S)/tests/luacheck.config $<
luacheck-%: $(S)/src/lib/autoload/a_%.lua $(S)/tests/luacheck.config FORCE
luacheck --config $(S)/tests/luacheck.config $<
test-locks: $(O)/bin/locks
$(O)/bin/locks
......
Subproject commit 402c6ab89ffa4f5d9d6282c009f5b265e4d16228
......@@ -3,6 +3,9 @@ std = "lua51"
-- We are shadowing variables in code all the time. It is feature for us and shouldn't be reported as problem.
redefined = false
-- All over the code we have long lines so just ignore them for now (TODO get
-- around to format them better way).
max_line_length = false
globals = {
-- lua51 doesn't contains?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment