From: sergeyb@tarantool.org
To: tarantool-patches@dev.tarantool.org, imun@tarantool.org,
v.shpilevoy@tarantool.org
Cc: o.piskunov@tarantool.org
Subject: [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in
Date: Tue, 21 Apr 2020 17:00:20 +0300 [thread overview]
Message-ID: <d1aab1e43230fc2493c6f03047dfc57d4200c9e2.1587476678.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1587476678.git.sergeyb@tarantool.org>
From: Sergey Bronnikov <sergeyb@tarantool.org>
Closes #4681
Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Reviewed-by: Igor Munkin <imun@tarantool.org>
Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Co-authored-by: Igor Munkin <imun@tarantool.org>
---
.luacheckrc | 2 ++
| 29 +++++++++++++----------------
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/.luacheckrc b/.luacheckrc
index 2683c8c26..0b7dc2dfe 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -24,3 +24,5 @@ exclude_files = {
".rocks/**/*.lua",
".git/**/*.lua",
}
+
+files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
--git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
index f5a912ccd..1c980fedc 100755
--- a/extra/dist/tarantoolctl.in
+++ b/extra/dist/tarantoolctl.in
@@ -46,7 +46,6 @@ local instance_dir
local default_cfg
local positional_arguments
local keyword_arguments
-local lua_arguments = arg
local language
-- function for printing usage reference
@@ -64,13 +63,12 @@ end
local function check_user_level()
local uid = os.getenv('UID')
- local udir = nil
if uid == 0 or os.getenv("NOTIFY_SOCKET") then
return nil
end
-- local dir configuration
local pwd = os.getenv('PWD')
- udir = pwd and pwd .. '/.tarantoolctl'
+ local udir = pwd and pwd .. '/.tarantoolctl'
udir = udir and fio.stat(udir) and udir or nil
-- or home dir configuration
local homedir = os.getenv('HOME')
@@ -127,15 +125,15 @@ end
local function load_default_file(default_file)
if default_file then
local env = setmetatable({}, { __index = _G })
- local ufunc, msg = loadfile(default_file)
+ local ufunc, loaderr = loadfile(default_file)
-- if load fails - show the last 10 lines of the log file
if not ufunc then
- log.error("Failed to load defaults file: %s", msg)
+ log.error("Failed to load defaults file: %s", loaderr)
end
debug.setfenv(ufunc, env)
- local state, msg = pcall(ufunc)
+ local state, err = pcall(ufunc)
if not state then
- log.error('Failed to execute defaults file: %s', msg)
+ log.error('Failed to execute defaults file: %s', err)
end
default_cfg = env.default_cfg
instance_dir = env.instance_dir
@@ -790,7 +788,7 @@ end
local function eval()
local console_sock_path = uri.parse(console_sock).service
local filename = arg[3]
- local code = nil
+ local code
if filename == nil then
if stdin_isatty() then
log.error("Usage:")
@@ -848,7 +846,6 @@ end
-- xlog / snap file, so even when it stops on LSN >= @a opts.to on
-- a current file a next file will be processed.
local function filter_xlog(gen, param, state, opts, cb)
- local spaces = opts.spaces
local from, to, spaces = opts.from, opts.to, opts.space
local show_system, replicas = opts['show-system'], opts.replica
@@ -862,7 +859,7 @@ local function filter_xlog(gen, param, state, opts, cb)
elseif (lsn < from) or (lsn >= to) or
(not spaces and sid and sid < 512 and not show_system) or
(spaces and (sid == nil or not find_in_list(sid, spaces))) or
- (replicas and not find_in_list(rid, replicas)) then
+ (replicas and not find_in_list(rid, replicas)) then -- luacheck: ignore
-- pass this tuple
else
cb(record)
@@ -875,7 +872,7 @@ local function cat()
local cat_format = opts.format
local format_cb = cat_formats[cat_format]
local is_printed = false
- for id, file in ipairs(positional_arguments) do
+ for _, file in ipairs(positional_arguments) do
log.error("Processing file '%s'", file)
local gen, param, state = xlog.pairs(file)
filter_xlog(gen, param, state, opts, function(record)
@@ -901,7 +898,7 @@ local function play()
if not remote:wait_connected() then
error(("Error while connecting to host '%s'"):format(uri))
end
- for id, file in ipairs(positional_arguments) do
+ for _, file in ipairs(positional_arguments) do
log.info(("Processing file '%s'"):format(file))
local gen, param, state = xlog.pairs(file)
filter_xlog(gen, param, state, opts, function(record)
@@ -923,7 +920,7 @@ local function play()
end
local function find_arg(name_arg)
- for i, key in ipairs(arg) do
+ for _, key in ipairs(arg) do
if key:find(name_arg) ~= nil then
return key
end
@@ -937,7 +934,7 @@ local function rocks()
local util = require("luarocks.util")
local command_line = require("luarocks.cmd")
local options = keyword_arguments
- local key = nil
+ local key
if options["only-server"] ~= nil then
key = find_arg("only%-server")
else
@@ -954,7 +951,7 @@ local function rocks()
end
-- Tweak help messages
- util.see_help = function(command, program)
+ util.see_help = function()
-- TODO: print extended help message here
return "See Tarantool documentation for help."
end
@@ -1321,7 +1318,7 @@ local function usage_command(name, cmd)
if type(header) == 'string' then
header = { header }
end
- for no, line in ipairs(header) do
+ for _, line in ipairs(header) do
log.error(" " .. line, name)
end
end
--
2.23.0
next prev parent reply other threads:[~2020-04-21 14:02 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 1/10] Add initial luacheck config sergeyb
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 2/10] gitlab-ci: enable static analysis with luacheck sergeyb
2020-04-21 20:04 ` Alexander Tikhonov
2020-04-22 8:09 ` Sergey Bronnikov
2020-04-22 8:11 ` Kirill Yukhin
2020-04-21 14:00 ` sergeyb [this message]
2020-04-23 11:40 ` [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in Igor Munkin
2020-04-24 8:02 ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 4/10] Fix luacheck warnings in src/lua/ sergeyb
2020-04-23 14:13 ` Igor Munkin
2020-04-24 9:12 ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/ sergeyb
2020-04-23 22:54 ` Igor Munkin
2020-05-07 10:32 ` Sergey Bronnikov
2020-05-07 14:34 ` Sergey Bronnikov
2020-05-07 10:52 ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 6/10] Fix luacheck warnings in test/ sergeyb
2020-04-27 14:38 ` Igor Munkin
2020-05-06 16:16 ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 7/10] schema: fix index promotion to functional index sergeyb
2020-04-23 23:24 ` Igor Munkin
2020-04-23 23:29 ` Igor Munkin
2020-04-28 23:19 ` Vladislav Shpilevoy
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G sergeyb
2020-04-21 14:13 ` Oleg Babin
2020-04-21 14:45 ` Sergey Bronnikov
2020-04-21 19:52 ` Igor Munkin
2020-04-23 23:27 ` Igor Munkin
2020-04-28 23:19 ` Vladislav Shpilevoy
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 9/10] Disabled test/luajit-tap in luacheckrc sergeyb
2020-04-24 10:16 ` Igor Munkin
2020-04-29 14:25 ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck sergeyb
2020-04-21 19:33 ` Igor Munkin
2020-04-22 10:14 ` Sergey Bronnikov
2020-04-23 6:24 ` Sergey Bronnikov
2020-04-23 10:03 ` Igor Munkin
2020-04-23 10:30 ` Sergey Bronnikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d1aab1e43230fc2493c6f03047dfc57d4200c9e2.1587476678.git.sergeyb@tarantool.org \
--to=sergeyb@tarantool.org \
--cc=imun@tarantool.org \
--cc=o.piskunov@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox