[Tarantool-patches] [PATCH v2 4/6] Fix luacheck warnings in extra/dist/tarantoolctl.in

Alexander Tikhonov avtikhon at tarantool.org
Thu Apr 9 07:29:27 MSK 2020


Hi Sergey, thank you for the patch, LGTM.

  
>Среда, 8 апреля 2020, 18:43 +03:00 от Sergey Bronnikov <estetus at gmail.com>:
> 
>From: Sergey Bronnikov < sergeyb at tarantool.org >
>
>Closes #4681
>---
> extra/dist/tarantoolctl.in | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
>diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
>index f5a912ccd..3bcbe5b79 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,7 +63,7 @@ end
> 
> local function check_user_level()
>     local uid = os.getenv('UID')
>- local udir = nil
>+ local udir
>     if uid == 0 or os.getenv("NOTIFY_SOCKET") then
>         return nil
>     end
>@@ -420,7 +419,7 @@ local cat_formats = setmetatable({
>     json = cat_json_cb,
>     lua = cat_lua_cb,
> }, {
>- __index = function(self, cmd)
>+ __index = function(cmd)
>         error(("Unknown formatter '%s'"):format(cmd))
>     end
> })
>@@ -790,7 +789,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 +847,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
> 
>@@ -875,7 +873,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 +899,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 +921,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 +935,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 +952,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 +1319,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
>  
 
 
--
Alexander Tikhonov
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20200409/3afa244f/attachment.html>


More information about the Tarantool-patches mailing list