diff options
| author | Carl Smedstad <carl.smedstad@protonmail.com> | 2021-03-16 03:23:38 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-15 23:23:38 -0300 |
| commit | e55ff19c961b799774303d1c38a581693af289a2 (patch) | |
| tree | eb4d4d7533a42056a4787abd6478ae89c99baf46 /src | |
| parent | 930acb2baa1a34dbf71c1b3f79492a2e598ecf61 (diff) | |
| download | luarocks-e55ff19c961b799774303d1c38a581693af289a2.tar.gz luarocks-e55ff19c961b799774303d1c38a581693af289a2.tar.bz2 luarocks-e55ff19c961b799774303d1c38a581693af289a2.zip | |
Run Luacheck in CI & fix reported errors (#1285)
Tried to do this as non-intrusively as possible, mostly by ignoring the
issues in-line.
Set the option unused_secondaries to false as suggested by @hishamhm.
This makes named but ununsed return values, that serves a documenting
purpose, allowed.
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/build.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/build/builtin.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/cmd.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/cmd/build.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/cmd/doc.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/cmd/install.lua | 3 | ||||
| -rw-r--r-- | src/luarocks/cmd/make.lua | 7 | ||||
| -rw-r--r-- | src/luarocks/cmd/pack.lua | 1 | ||||
| -rw-r--r-- | src/luarocks/cmd/purge.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/cmd/remove.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/cmd/which.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/core/cfg.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/download.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/fs.lua | 2 | ||||
| -rw-r--r-- | src/luarocks/fs/lua.lua | 8 | ||||
| -rw-r--r-- | src/luarocks/fs/win32.lua | 5 | ||||
| -rw-r--r-- | src/luarocks/fs/win32/tools.lua | 6 | ||||
| -rw-r--r-- | src/luarocks/loader.lua | 6 | ||||
| -rw-r--r-- | src/luarocks/manif/writer.lua | 4 | ||||
| -rw-r--r-- | src/luarocks/repos.lua | 5 | ||||
| -rw-r--r-- | src/luarocks/tools/zip.lua | 2 |
21 files changed, 40 insertions, 33 deletions
diff --git a/src/luarocks/build.lua b/src/luarocks/build.lua index 0e8e7f58..ae529856 100644 --- a/src/luarocks/build.lua +++ b/src/luarocks/build.lua | |||
| @@ -94,7 +94,7 @@ local function check_macosx_deployment_target(rockspec) | |||
| 94 | local version = util.popen_read("sw_vers -productVersion") | 94 | local version = util.popen_read("sw_vers -productVersion") |
| 95 | if version:match("^%d+%.%d+%.%d+$") or version:match("^%d+%.%d+$") then | 95 | if version:match("^%d+%.%d+%.%d+$") or version:match("^%d+%.%d+$") then |
| 96 | if vers.compare_versions(target, version) then | 96 | if vers.compare_versions(target, version) then |
| 97 | return nil, ("This rock requires Mac OSX %s, and you are running %s."):format(targetversion, version) | 97 | return nil, ("This rock requires Mac OSX %s, and you are running %s."):format(target, version) |
| 98 | end | 98 | end |
| 99 | end | 99 | end |
| 100 | patch_variable("CC") | 100 | patch_variable("CC") |
diff --git a/src/luarocks/build/builtin.lua b/src/luarocks/build/builtin.lua index 70651ce8..6241c718 100644 --- a/src/luarocks/build/builtin.lua +++ b/src/luarocks/build/builtin.lua | |||
| @@ -252,7 +252,7 @@ function builtin.run(rockspec, no_install) | |||
| 252 | end | 252 | end |
| 253 | return execute(variables.LD.." "..variables.LIBFLAG, "-o", library, unpack(extras)) | 253 | return execute(variables.LD.." "..variables.LIBFLAG, "-o", library, unpack(extras)) |
| 254 | end | 254 | end |
| 255 | compile_static_library = function(library, objects, libraries, libdirs, name) | 255 | compile_static_library = function(library, objects, libraries, libdirs, name) -- luacheck: ignore 211 |
| 256 | local ok = execute(variables.AR, "rc", library, unpack(objects)) | 256 | local ok = execute(variables.AR, "rc", library, unpack(objects)) |
| 257 | if ok then | 257 | if ok then |
| 258 | ok = execute(variables.RANLIB, library) | 258 | ok = execute(variables.RANLIB, library) |
diff --git a/src/luarocks/cmd.lua b/src/luarocks/cmd.lua index c8bcb552..21f35e20 100644 --- a/src/luarocks/cmd.lua +++ b/src/luarocks/cmd.lua | |||
| @@ -337,7 +337,7 @@ local function use_to_fix_location(key) | |||
| 337 | return buf | 337 | return buf |
| 338 | end | 338 | end |
| 339 | 339 | ||
| 340 | local function get_config_text(cfg) | 340 | local function get_config_text(cfg) -- luacheck: ignore 431 |
| 341 | local deps = require("luarocks.deps") | 341 | local deps = require("luarocks.deps") |
| 342 | 342 | ||
| 343 | local libdir_ok = deps.check_lua_libdir(cfg.variables) | 343 | local libdir_ok = deps.check_lua_libdir(cfg.variables) |
diff --git a/src/luarocks/cmd/build.lua b/src/luarocks/cmd/build.lua index 31622f35..d1fccfdd 100644 --- a/src/luarocks/cmd/build.lua +++ b/src/luarocks/cmd/build.lua | |||
| @@ -18,7 +18,7 @@ local make = require("luarocks.cmd.make") | |||
| 18 | local cmd = require("luarocks.cmd") | 18 | local cmd = require("luarocks.cmd") |
| 19 | 19 | ||
| 20 | function cmd_build.add_to_parser(parser) | 20 | function cmd_build.add_to_parser(parser) |
| 21 | local cmd = parser:command("build", "Build and install a rock, compiling its C parts if any.\n".. | 21 | local cmd = parser:command("build", "Build and install a rock, compiling its C parts if any.\n".. -- luacheck: ignore 431 |
| 22 | "If the sources contain a luarocks.lock file, uses it as an authoritative source for ".. | 22 | "If the sources contain a luarocks.lock file, uses it as an authoritative source for ".. |
| 23 | "exact version of dependencies.\n".. | 23 | "exact version of dependencies.\n".. |
| 24 | "If no arguments are given, behaves as luarocks make.", util.see_also()) | 24 | "If no arguments are given, behaves as luarocks make.", util.see_also()) |
diff --git a/src/luarocks/cmd/doc.lua b/src/luarocks/cmd/doc.lua index 6345063d..2ab7e43c 100644 --- a/src/luarocks/cmd/doc.lua +++ b/src/luarocks/cmd/doc.lua | |||
| @@ -66,7 +66,7 @@ function doc.command(args) | |||
| 66 | util.printout(rock.." is not installed. Looking for it in the rocks servers...") | 66 | util.printout(rock.." is not installed. Looking for it in the rocks servers...") |
| 67 | return try_to_open_homepage(args.rock, args.namespace, args.version) | 67 | return try_to_open_homepage(args.rock, args.namespace, args.version) |
| 68 | end | 68 | end |
| 69 | name, version = iname, iversion | 69 | local name, version = iname, iversion |
| 70 | 70 | ||
| 71 | local rockspec, err = fetch.load_local_rockspec(path.rockspec_file(name, version, repo)) | 71 | local rockspec, err = fetch.load_local_rockspec(path.rockspec_file(name, version, repo)) |
| 72 | if not rockspec then return nil,err end | 72 | if not rockspec then return nil,err end |
diff --git a/src/luarocks/cmd/install.lua b/src/luarocks/cmd/install.lua index 1fa15453..760649b0 100644 --- a/src/luarocks/cmd/install.lua +++ b/src/luarocks/cmd/install.lua | |||
| @@ -14,10 +14,9 @@ local search = require("luarocks.search") | |||
| 14 | local queries = require("luarocks.queries") | 14 | local queries = require("luarocks.queries") |
| 15 | local cfg = require("luarocks.core.cfg") | 15 | local cfg = require("luarocks.core.cfg") |
| 16 | local cmd = require("luarocks.cmd") | 16 | local cmd = require("luarocks.cmd") |
| 17 | local dir = require("luarocks.dir") | ||
| 18 | 17 | ||
| 19 | function install.add_to_parser(parser) | 18 | function install.add_to_parser(parser) |
| 20 | local cmd = parser:command("install", "Install a rock.", util.see_also()) | 19 | local cmd = parser:command("install", "Install a rock.", util.see_also()) -- luacheck: ignore 431 |
| 21 | 20 | ||
| 22 | cmd:argument("rock", "The name of a rock to be fetched from a repository ".. | 21 | cmd:argument("rock", "The name of a rock to be fetched from a repository ".. |
| 23 | "or a filename of a locally available rock.") | 22 | "or a filename of a locally available rock.") |
diff --git a/src/luarocks/cmd/make.lua b/src/luarocks/cmd/make.lua index 78647b63..a72e6817 100644 --- a/src/luarocks/cmd/make.lua +++ b/src/luarocks/cmd/make.lua | |||
| @@ -13,7 +13,6 @@ local fetch = require("luarocks.fetch") | |||
| 13 | local pack = require("luarocks.pack") | 13 | local pack = require("luarocks.pack") |
| 14 | local remove = require("luarocks.remove") | 14 | local remove = require("luarocks.remove") |
| 15 | local deps = require("luarocks.deps") | 15 | local deps = require("luarocks.deps") |
| 16 | local deplocks = require("luarocks.deplocks") | ||
| 17 | local writer = require("luarocks.manif.writer") | 16 | local writer = require("luarocks.manif.writer") |
| 18 | local cmd = require("luarocks.cmd") | 17 | local cmd = require("luarocks.cmd") |
| 19 | 18 | ||
| @@ -47,6 +46,7 @@ function make.cmd_options(parser) | |||
| 47 | end | 46 | end |
| 48 | 47 | ||
| 49 | function make.add_to_parser(parser) | 48 | function make.add_to_parser(parser) |
| 49 | -- luacheck: push ignore 431 | ||
| 50 | local cmd = parser:command("make", [[ | 50 | local cmd = parser:command("make", [[ |
| 51 | Builds sources in the current directory, but unlike "build", it does not fetch | 51 | Builds sources in the current directory, but unlike "build", it does not fetch |
| 52 | sources, etc., assuming everything is available in the current directory. If no | 52 | sources, etc., assuming everything is available in the current directory. If no |
| @@ -65,6 +65,7 @@ authoritative source for exact version of dependencies. The --pin flag | |||
| 65 | overrides and recreates this file scanning dependency based on ranges. | 65 | overrides and recreates this file scanning dependency based on ranges. |
| 66 | ]], util.see_also()) | 66 | ]], util.see_also()) |
| 67 | :summary("Compile package in current directory using a rockspec.") | 67 | :summary("Compile package in current directory using a rockspec.") |
| 68 | -- luacheck: pop | ||
| 68 | 69 | ||
| 69 | cmd:argument("rockspec", "Rockspec for the rock to build.") | 70 | cmd:argument("rockspec", "Rockspec for the rock to build.") |
| 70 | :args("?") | 71 | :args("?") |
| @@ -117,7 +118,7 @@ function make.command(args) | |||
| 117 | return build.build_rockspec(rockspec, opts) | 118 | return build.build_rockspec(rockspec, opts) |
| 118 | elseif args.pack_binary_rock then | 119 | elseif args.pack_binary_rock then |
| 119 | return pack.pack_binary_rock(name, namespace, rockspec.version, args.sign, function() | 120 | return pack.pack_binary_rock(name, namespace, rockspec.version, args.sign, function() |
| 120 | local name, version = build.build_rockspec(rockspec, opts) | 121 | local name, version = build.build_rockspec(rockspec, opts) -- luacheck: ignore 431 |
| 121 | if name and args.no_doc then | 122 | if name and args.no_doc then |
| 122 | util.remove_doc_dir(name, version) | 123 | util.remove_doc_dir(name, version) |
| 123 | end | 124 | end |
| @@ -128,7 +129,7 @@ function make.command(args) | |||
| 128 | if not ok then return nil, err, cmd.errorcodes.PERMISSIONDENIED end | 129 | if not ok then return nil, err, cmd.errorcodes.PERMISSIONDENIED end |
| 129 | ok, err = build.build_rockspec(rockspec, opts) | 130 | ok, err = build.build_rockspec(rockspec, opts) |
| 130 | if not ok then return nil, err end | 131 | if not ok then return nil, err end |
| 131 | local name, version = ok, err | 132 | local name, version = ok, err -- luacheck: ignore 421 |
| 132 | 133 | ||
| 133 | if opts.build_only_deps then | 134 | if opts.build_only_deps then |
| 134 | util.printout("Stopping after installing dependencies for " ..name.." "..version) | 135 | util.printout("Stopping after installing dependencies for " ..name.." "..version) |
diff --git a/src/luarocks/cmd/pack.lua b/src/luarocks/cmd/pack.lua index 9ceb2fa8..29a43e7b 100644 --- a/src/luarocks/cmd/pack.lua +++ b/src/luarocks/cmd/pack.lua | |||
| @@ -5,7 +5,6 @@ local cmd_pack = {} | |||
| 5 | 5 | ||
| 6 | local util = require("luarocks.util") | 6 | local util = require("luarocks.util") |
| 7 | local pack = require("luarocks.pack") | 7 | local pack = require("luarocks.pack") |
| 8 | local signing = require("luarocks.signing") | ||
| 9 | local queries = require("luarocks.queries") | 8 | local queries = require("luarocks.queries") |
| 10 | 9 | ||
| 11 | function cmd_pack.add_to_parser(parser) | 10 | function cmd_pack.add_to_parser(parser) |
diff --git a/src/luarocks/cmd/purge.lua b/src/luarocks/cmd/purge.lua index b71baa7c..fa4be4d7 100644 --- a/src/luarocks/cmd/purge.lua +++ b/src/luarocks/cmd/purge.lua | |||
| @@ -16,6 +16,7 @@ local queries = require("luarocks.queries") | |||
| 16 | local cmd = require("luarocks.cmd") | 16 | local cmd = require("luarocks.cmd") |
| 17 | 17 | ||
| 18 | function purge.add_to_parser(parser) | 18 | function purge.add_to_parser(parser) |
| 19 | -- luacheck: push ignore 431 | ||
| 19 | local cmd = parser:command("purge", [[ | 20 | local cmd = parser:command("purge", [[ |
| 20 | This command removes rocks en masse from a given tree. | 21 | This command removes rocks en masse from a given tree. |
| 21 | By default, it removes all rocks from a tree. | 22 | By default, it removes all rocks from a tree. |
| @@ -23,6 +24,7 @@ By default, it removes all rocks from a tree. | |||
| 23 | The --tree option is mandatory: luarocks purge does not assume a default tree.]], | 24 | The --tree option is mandatory: luarocks purge does not assume a default tree.]], |
| 24 | util.see_also()) | 25 | util.see_also()) |
| 25 | :summary("Remove all installed rocks from a tree.") | 26 | :summary("Remove all installed rocks from a tree.") |
| 27 | -- luacheck: pop | ||
| 26 | 28 | ||
| 27 | cmd:flag("--old-versions", "Keep the highest-numbered version of each ".. | 29 | cmd:flag("--old-versions", "Keep the highest-numbered version of each ".. |
| 28 | "rock and remove the other ones. By default it only removes old ".. | 30 | "rock and remove the other ones. By default it only removes old ".. |
diff --git a/src/luarocks/cmd/remove.lua b/src/luarocks/cmd/remove.lua index cede148d..46f3e4a6 100644 --- a/src/luarocks/cmd/remove.lua +++ b/src/luarocks/cmd/remove.lua | |||
| @@ -15,6 +15,7 @@ local queries = require("luarocks.queries") | |||
| 15 | local cmd = require("luarocks.cmd") | 15 | local cmd = require("luarocks.cmd") |
| 16 | 16 | ||
| 17 | function cmd_remove.add_to_parser(parser) | 17 | function cmd_remove.add_to_parser(parser) |
| 18 | -- luacheck: push ignore 431 | ||
| 18 | local cmd = parser:command("remove", [[ | 19 | local cmd = parser:command("remove", [[ |
| 19 | Uninstall a rock. | 20 | Uninstall a rock. |
| 20 | 21 | ||
| @@ -23,6 +24,7 @@ Will only perform the removal if it does not break dependencies. | |||
| 23 | To override this check and force the removal, use --force or --force-fast.]], | 24 | To override this check and force the removal, use --force or --force-fast.]], |
| 24 | util.see_also()) | 25 | util.see_also()) |
| 25 | :summary("Uninstall a rock.") | 26 | :summary("Uninstall a rock.") |
| 27 | -- luacheck: pop | ||
| 26 | 28 | ||
| 27 | cmd:argument("rock", "Name of the rock to be uninstalled.") | 29 | cmd:argument("rock", "Name of the rock to be uninstalled.") |
| 28 | :action(util.namespaced_name_action) | 30 | :action(util.namespaced_name_action) |
diff --git a/src/luarocks/cmd/which.lua b/src/luarocks/cmd/which.lua index 9a363e85..7503df00 100644 --- a/src/luarocks/cmd/which.lua +++ b/src/luarocks/cmd/which.lua | |||
| @@ -32,7 +32,7 @@ function which_cmd.command(args) | |||
| 32 | local modpath = args.modname:gsub("%.", "/") | 32 | local modpath = args.modname:gsub("%.", "/") |
| 33 | for _, v in ipairs({"path", "cpath"}) do | 33 | for _, v in ipairs({"path", "cpath"}) do |
| 34 | for p in package[v]:gmatch("([^;]+)") do | 34 | for p in package[v]:gmatch("([^;]+)") do |
| 35 | local pathname = p:gsub("%?", modpath) | 35 | local pathname = p:gsub("%?", modpath) -- luacheck: ignore 421 |
| 36 | if fs.exists(pathname) then | 36 | if fs.exists(pathname) then |
| 37 | util.printout(pathname) | 37 | util.printout(pathname) |
| 38 | util.printout("(found directly via package." .. v .. " -- not installed as a rock?)") | 38 | util.printout("(found directly via package." .. v .. " -- not installed as a rock?)") |
diff --git a/src/luarocks/core/cfg.lua b/src/luarocks/core/cfg.lua index 4ac5ee28..d65681c1 100644 --- a/src/luarocks/core/cfg.lua +++ b/src/luarocks/core/cfg.lua | |||
| @@ -10,8 +10,8 @@ | |||
| 10 | -- files. Run `luarocks` with no arguments to see the locations of | 10 | -- files. Run `luarocks` with no arguments to see the locations of |
| 11 | -- these files in your platform. | 11 | -- these files in your platform. |
| 12 | 12 | ||
| 13 | local next, table, pairs, require, os, pcall, ipairs, package, tonumber, type, assert = | 13 | local table, pairs, require, os, pcall, ipairs, package, type, assert = |
| 14 | next, table, pairs, require, os, pcall, ipairs, package, tonumber, type, assert | 14 | table, pairs, require, os, pcall, ipairs, package, type, assert |
| 15 | 15 | ||
| 16 | local util = require("luarocks.core.util") | 16 | local util = require("luarocks.core.util") |
| 17 | local persist = require("luarocks.core.persist") | 17 | local persist = require("luarocks.core.persist") |
diff --git a/src/luarocks/download.lua b/src/luarocks/download.lua index 70570344..1246e498 100644 --- a/src/luarocks/download.lua +++ b/src/luarocks/download.lua | |||
| @@ -32,8 +32,8 @@ function download.download(arch, name, namespace, version, all, check_lua_versio | |||
| 32 | local has_result = false | 32 | local has_result = false |
| 33 | local all_ok = true | 33 | local all_ok = true |
| 34 | local any_err = "" | 34 | local any_err = "" |
| 35 | for name, result in pairs(results) do | 35 | for name, result in pairs(results) do -- luacheck: ignore 422 |
| 36 | for version, items in pairs(result) do | 36 | for version, items in pairs(result) do -- luacheck: ignore 422 |
| 37 | for _, item in ipairs(items) do | 37 | for _, item in ipairs(items) do |
| 38 | -- Ignore provided rocks. | 38 | -- Ignore provided rocks. |
| 39 | if item.arch ~= "installed" then | 39 | if item.arch ~= "installed" then |
diff --git a/src/luarocks/fs.lua b/src/luarocks/fs.lua index bd1a96a2..ecfc5a28 100644 --- a/src/luarocks/fs.lua +++ b/src/luarocks/fs.lua | |||
| @@ -29,6 +29,7 @@ do | |||
| 29 | 29 | ||
| 30 | if old_popen or old_execute then return end | 30 | if old_popen or old_execute then return end |
| 31 | old_popen = io.popen | 31 | old_popen = io.popen |
| 32 | -- luacheck: push globals io os | ||
| 32 | io.popen = function(one, two) | 33 | io.popen = function(one, two) |
| 33 | if two == nil then | 34 | if two == nil then |
| 34 | print("\nio.popen: ", one) | 35 | print("\nio.popen: ", one) |
| @@ -49,6 +50,7 @@ do | |||
| 49 | end | 50 | end |
| 50 | return unpack(code, 1, code.n) | 51 | return unpack(code, 1, code.n) |
| 51 | end | 52 | end |
| 53 | -- luacheck: pop | ||
| 52 | end | 54 | end |
| 53 | end | 55 | end |
| 54 | 56 | ||
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index b9b36447..83ffbd47 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
| @@ -215,7 +215,7 @@ function fs_lua.modules(at) | |||
| 215 | 215 | ||
| 216 | local modules = {} | 216 | local modules = {} |
| 217 | local is_duplicate = {} | 217 | local is_duplicate = {} |
| 218 | for _, path in ipairs(paths) do | 218 | for _, path in ipairs(paths) do -- luacheck: ignore 421 |
| 219 | local files = fs.list_dir(path) | 219 | local files = fs.list_dir(path) |
| 220 | for _, filename in ipairs(files or {}) do | 220 | for _, filename in ipairs(files or {}) do |
| 221 | if filename:match("%.[lL][uU][aA]$") then | 221 | if filename:match("%.[lL][uU][aA]$") then |
| @@ -705,7 +705,7 @@ local redirect_protocols = { | |||
| 705 | https = luasec_ok and https, | 705 | https = luasec_ok and https, |
| 706 | } | 706 | } |
| 707 | 707 | ||
| 708 | local function request(url, method, http, loop_control) | 708 | local function request(url, method, http, loop_control) -- luacheck: ignore 431 |
| 709 | local result = {} | 709 | local result = {} |
| 710 | 710 | ||
| 711 | if cfg.verbose then | 711 | if cfg.verbose then |
| @@ -805,7 +805,7 @@ end | |||
| 805 | -- via the HTTP Last-Modified header if the full download is needed. | 805 | -- via the HTTP Last-Modified header if the full download is needed. |
| 806 | -- @return (boolean | (nil, string, string?)): True if successful, or | 806 | -- @return (boolean | (nil, string, string?)): True if successful, or |
| 807 | -- nil, error message and optionally HTTPS error in case of errors. | 807 | -- nil, error message and optionally HTTPS error in case of errors. |
| 808 | local function http_request(url, filename, http, cache) | 808 | local function http_request(url, filename, http, cache) -- luacheck: ignore 431 |
| 809 | if cache then | 809 | if cache then |
| 810 | local status = read_timestamp(filename..".status") | 810 | local status = read_timestamp(filename..".status") |
| 811 | local timestamp = read_timestamp(filename..".timestamp") | 811 | local timestamp = read_timestamp(filename..".timestamp") |
| @@ -824,7 +824,7 @@ local function http_request(url, filename, http, cache) | |||
| 824 | end | 824 | end |
| 825 | end | 825 | end |
| 826 | 826 | ||
| 827 | local result, status, headers, err = request(url, "HEAD", http) | 827 | local result, status, headers, err = request(url, "HEAD", http) -- luacheck: ignore 421 |
| 828 | if not result then | 828 | if not result then |
| 829 | return fail_with_status(filename, status, headers) | 829 | return fail_with_status(filename, status, headers) |
| 830 | end | 830 | end |
diff --git a/src/luarocks/fs/win32.lua b/src/luarocks/fs/win32.lua index 8ae62cf0..00dd0163 100644 --- a/src/luarocks/fs/win32.lua +++ b/src/luarocks/fs/win32.lua | |||
| @@ -15,8 +15,11 @@ local util = require("luarocks.util") | |||
| 15 | -- See http://lua-users.org/lists/lua-l/2013-11/msg00367.html | 15 | -- See http://lua-users.org/lists/lua-l/2013-11/msg00367.html |
| 16 | local _prefix = "type NUL && " | 16 | local _prefix = "type NUL && " |
| 17 | local _popen, _execute = io.popen, os.execute | 17 | local _popen, _execute = io.popen, os.execute |
| 18 | |||
| 19 | -- luacheck: push globals io os | ||
| 18 | io.popen = function(cmd, ...) return _popen(_prefix..cmd, ...) end | 20 | io.popen = function(cmd, ...) return _popen(_prefix..cmd, ...) end |
| 19 | os.execute = function(cmd, ...) return _execute(_prefix..cmd, ...) end | 21 | os.execute = function(cmd, ...) return _execute(_prefix..cmd, ...) end |
| 22 | -- luacheck: pop | ||
| 20 | 23 | ||
| 21 | --- Annotate command string for quiet execution. | 24 | --- Annotate command string for quiet execution. |
| 22 | -- @param cmd string: A command-line string. | 25 | -- @param cmd string: A command-line string. |
| @@ -38,7 +41,7 @@ end | |||
| 38 | local function split_root(pathname) | 41 | local function split_root(pathname) |
| 39 | local drive = "" | 42 | local drive = "" |
| 40 | local root = "" | 43 | local root = "" |
| 41 | local rest = "" | 44 | local rest |
| 42 | 45 | ||
| 43 | local unquoted = pathname:match("^['\"](.*)['\"]$") | 46 | local unquoted = pathname:match("^['\"](.*)['\"]$") |
| 44 | if unquoted then | 47 | if unquoted then |
diff --git a/src/luarocks/fs/win32/tools.lua b/src/luarocks/fs/win32/tools.lua index 57e8c80e..d6202ab9 100644 --- a/src/luarocks/fs/win32/tools.lua +++ b/src/luarocks/fs/win32/tools.lua | |||
| @@ -21,11 +21,11 @@ function tools.command_at(directory, cmd, exit_on_error) | |||
| 21 | if exit_on_error then | 21 | if exit_on_error then |
| 22 | op = " && " | 22 | op = " && " |
| 23 | end | 23 | end |
| 24 | local cmd = "cd " .. fs.Q(directory) .. op .. cmd | 24 | local cmd_prefixed = "cd " .. fs.Q(directory) .. op .. cmd |
| 25 | if drive then | 25 | if drive then |
| 26 | cmd = drive .. " & " .. cmd | 26 | cmd_prefixed = drive .. " & " .. cmd_prefixed |
| 27 | end | 27 | end |
| 28 | return cmd | 28 | return cmd_prefixed |
| 29 | end | 29 | end |
| 30 | 30 | ||
| 31 | --- Create a directory if it does not already exist. | 31 | --- Create a directory if it does not already exist. |
diff --git a/src/luarocks/loader.lua b/src/luarocks/loader.lua index 5aa84632..a3bd8f1b 100644 --- a/src/luarocks/loader.lua +++ b/src/luarocks/loader.lua | |||
| @@ -1,10 +1,12 @@ | |||
| 1 | |||
| 2 | --- A module which installs a Lua package loader that is LuaRocks-aware. | 1 | --- A module which installs a Lua package loader that is LuaRocks-aware. |
| 3 | -- This loader uses dependency information from the LuaRocks tree to load | 2 | -- This loader uses dependency information from the LuaRocks tree to load |
| 4 | -- correct versions of modules. It does this by constructing a "context" | 3 | -- correct versions of modules. It does this by constructing a "context" |
| 5 | -- table in the environment, which records which versions of packages were | 4 | -- table in the environment, which records which versions of packages were |
| 6 | -- used to load previous modules, so that the loader chooses versions | 5 | -- used to load previous modules, so that the loader chooses versions |
| 7 | -- that are declared to be compatible with the ones loaded earlier. | 6 | -- that are declared to be compatible with the ones loaded earlier. |
| 7 | |||
| 8 | -- luacheck: globals luarocks | ||
| 9 | |||
| 8 | local loaders = package.loaders or package.searchers | 10 | local loaders = package.loaders or package.searchers |
| 9 | local require, ipairs, table, type, next, tostring, error = | 11 | local require, ipairs, table, type, next, tostring, error = |
| 10 | require, ipairs, table, type, next, tostring, error | 12 | require, ipairs, table, type, next, tostring, error |
| @@ -24,7 +26,7 @@ end | |||
| 24 | local path = require("luarocks.core.path") | 26 | local path = require("luarocks.core.path") |
| 25 | local manif = require("luarocks.core.manif") | 27 | local manif = require("luarocks.core.manif") |
| 26 | local vers = require("luarocks.core.vers") | 28 | local vers = require("luarocks.core.vers") |
| 27 | local require = nil | 29 | local require = nil -- luacheck: ignore 411 |
| 28 | -------------------------------------------------------------------------------- | 30 | -------------------------------------------------------------------------------- |
| 29 | 31 | ||
| 30 | -- Workaround for wrappers produced by older versions of LuaRocks | 32 | -- Workaround for wrappers produced by older versions of LuaRocks |
diff --git a/src/luarocks/manif/writer.lua b/src/luarocks/manif/writer.lua index 8c6e4505..8e07702c 100644 --- a/src/luarocks/manif/writer.lua +++ b/src/luarocks/manif/writer.lua | |||
| @@ -30,7 +30,7 @@ local function store_package_items(storage, name, version, items) | |||
| 30 | 30 | ||
| 31 | local package_identifier = name.."/"..version | 31 | local package_identifier = name.."/"..version |
| 32 | 32 | ||
| 33 | for item_name, path in pairs(items) do | 33 | for item_name, path in pairs(items) do -- luacheck: ignore 431 |
| 34 | if not storage[item_name] then | 34 | if not storage[item_name] then |
| 35 | storage[item_name] = {} | 35 | storage[item_name] = {} |
| 36 | end | 36 | end |
| @@ -54,7 +54,7 @@ local function remove_package_items(storage, name, version, items) | |||
| 54 | 54 | ||
| 55 | local package_identifier = name.."/"..version | 55 | local package_identifier = name.."/"..version |
| 56 | 56 | ||
| 57 | for item_name, path in pairs(items) do | 57 | for item_name, path in pairs(items) do -- luacheck: ignore 431 |
| 58 | local all_identifiers = storage[item_name] | 58 | local all_identifiers = storage[item_name] |
| 59 | 59 | ||
| 60 | for i, identifier in ipairs(all_identifiers) do | 60 | for i, identifier in ipairs(all_identifiers) do |
diff --git a/src/luarocks/repos.lua b/src/luarocks/repos.lua index b2a7d81a..4a78dfb2 100644 --- a/src/luarocks/repos.lua +++ b/src/luarocks/repos.lua | |||
| @@ -9,9 +9,8 @@ local util = require("luarocks.util") | |||
| 9 | local dir = require("luarocks.dir") | 9 | local dir = require("luarocks.dir") |
| 10 | local manif = require("luarocks.manif") | 10 | local manif = require("luarocks.manif") |
| 11 | local vers = require("luarocks.core.vers") | 11 | local vers = require("luarocks.core.vers") |
| 12 | local E = {} | ||
| 13 | 12 | ||
| 14 | local unpack = unpack or table.unpack | 13 | local unpack = unpack or table.unpack -- luacheck: ignore 211 |
| 15 | 14 | ||
| 16 | --- Get type and name of an item (a module or a command) provided by a file. | 15 | --- Get type and name of an item (a module or a command) provided by a file. |
| 17 | -- @param deploy_type string: rock manifest subtree the file comes from ("bin", "lua", or "lib"). | 16 | -- @param deploy_type string: rock manifest subtree the file comes from ("bin", "lua", or "lib"). |
| @@ -77,7 +76,7 @@ function repos.recurse_rock_manifest_entry(entry, action) | |||
| 77 | 76 | ||
| 78 | for file, sub in pairs(tree) do | 77 | for file, sub in pairs(tree) do |
| 79 | local sub_path = (parent_path and (parent_path .. "/") or "") .. file | 78 | local sub_path = (parent_path and (parent_path .. "/") or "") .. file |
| 80 | local ok, err | 79 | local ok, err -- luacheck: ignore 231 |
| 81 | 80 | ||
| 82 | if type(sub) == "table" then | 81 | if type(sub) == "table" then |
| 83 | ok, err = do_recurse_rock_manifest_entry(sub, sub_path) | 82 | ok, err = do_recurse_rock_manifest_entry(sub, sub_path) |
diff --git a/src/luarocks/tools/zip.lua b/src/luarocks/tools/zip.lua index fb27456d..37091185 100644 --- a/src/luarocks/tools/zip.lua +++ b/src/luarocks/tools/zip.lua | |||
| @@ -10,8 +10,6 @@ local dir = require("luarocks.dir") | |||
| 10 | 10 | ||
| 11 | local pack = table.pack or function(...) return { n = select("#", ...), ... } end | 11 | local pack = table.pack or function(...) return { n = select("#", ...), ... } end |
| 12 | 12 | ||
| 13 | local stat_ok, stat = pcall(require, "posix.sys.stat") | ||
| 14 | |||
| 15 | local function shr(n, m) | 13 | local function shr(n, m) |
| 16 | return math.floor(n / 2^m) | 14 | return math.floor(n / 2^m) |
| 17 | end | 15 | end |
