Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] luacheck: fixed warning in tarantoolctl.in
@ 2020-10-14 12:14 Artem Starshov
  2020-10-14 13:11 ` Leonid Vasiliev
  2020-10-14 23:04 ` Alexander Turenko
  0 siblings, 2 replies; 3+ messages in thread
From: Artem Starshov @ 2020-10-14 12:14 UTC (permalink / raw)
  To: Alexander Turenko; +Cc: tarantool-patches

Changed passing global variable arg to function
find_instance_name(arg) instead of passing arg[0] and arg[2] separately.
And removed exception in .luacheckrc for file /extra/dist/tarantoolctl.in.

This change only solves linter warning, nothing else.

Brach: https://github.com/tarantool/tarantool/tree/artemreyt/gh-4929-luacheck-warning-tarantoolctl
Issue: https://github.com/tarantool/tarantool/issues/4929

Fixed #4929.
---
 .luacheckrc                |  6 ------
 extra/dist/tarantoolctl.in | 16 ++++++++--------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 994d29956..2a652cd06 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -37,12 +37,6 @@ exclude_files = {
     ".git/**/*.lua",
 }
 
-files["extra/dist/tarantoolctl.in"] = {
-    ignore = {
-        -- https://github.com/tarantool/tarantool/issues/4929
-        "122",
-    },
-}
 files["src/lua/help.lua"] = {
     -- Globals defined for interactive mode.
     globals = {"help", "tutorial"},
diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
index 90caf58ad..0726e7f46 100755
--- a/extra/dist/tarantoolctl.in
+++ b/extra/dist/tarantoolctl.in
@@ -202,19 +202,19 @@ end
 -- In case there is no explicit instance name, check whether arg[0] is a
 -- symlink. In that case, the name of the symlink is the instance name.
 --
-local function find_instance_name(arg0, arg2)
-    if arg2 ~= nil then
-        return fio.basename(arg2, '.lua')
+local function find_instance_name(arg)
+    if arg[2] ~= nil then
+        return fio.basename(arg[2], '.lua')
     end
-    local istat = fio.lstat(arg0)
+    local istat = fio.lstat(arg[0])
     if istat == nil then
-        log.error("Can't stat %s: %s", arg0, errno.strerror())
+        log.error("Can't stat %s: %s", arg[0], errno.strerror())
         os.exit(1)
     end
     if not istat:is_link() then usage(command_name) end
-    arg[2] = arg0
+    arg[2] = arg[0]
     linkmode = true
-    return fio.basename(arg0, '.lua')
+    return fio.basename(arg[0], '.lua')
 end
 
 local function mkdir(dirname)
@@ -971,7 +971,7 @@ local function process_remote(cmd_function)
 end
 
 local function process_local(cmd_function)
-    instance_name = find_instance_name(arg[0], arg[2])
+    instance_name = find_instance_name(arg)
 
     default_file = find_default_file()
     load_default_file(default_file)
-- 
2.28.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH] luacheck: fixed warning in tarantoolctl.in
  2020-10-14 12:14 [Tarantool-patches] [PATCH] luacheck: fixed warning in tarantoolctl.in Artem Starshov
@ 2020-10-14 13:11 ` Leonid Vasiliev
  2020-10-14 23:04 ` Alexander Turenko
  1 sibling, 0 replies; 3+ messages in thread
From: Leonid Vasiliev @ 2020-10-14 13:11 UTC (permalink / raw)
  To: Artem Starshov, Alexander Turenko; +Cc: tarantool-patches

LGTM.

On 14.10.2020 15:14, Artem Starshov wrote:
> Changed passing global variable arg to function
> find_instance_name(arg) instead of passing arg[0] and arg[2] separately.
> And removed exception in .luacheckrc for file /extra/dist/tarantoolctl.in.
> 
> This change only solves linter warning, nothing else.
>  > Brach: 
https://github.com/tarantool/tarantool/tree/artemreyt/gh-4929-luacheck-warning-tarantoolctl
> Issue: https://github.com/tarantool/tarantool/issues/4929

Branch and Issue are not a part of the commit message, add it after
"---". (Don't resend this patch. This comment is for future patches)

> 
> Fixed #4929.
> ---

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Tarantool-patches] [PATCH] luacheck: fixed warning in tarantoolctl.in
  2020-10-14 12:14 [Tarantool-patches] [PATCH] luacheck: fixed warning in tarantoolctl.in Artem Starshov
  2020-10-14 13:11 ` Leonid Vasiliev
@ 2020-10-14 23:04 ` Alexander Turenko
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Turenko @ 2020-10-14 23:04 UTC (permalink / raw)
  To: Artem Starshov; +Cc: tarantool-patches

LGTM.

Pushed to master and 2.5.

WBR, Alexander Turenko.

On Wed, Oct 14, 2020 at 03:14:08PM +0300, Artem Starshov wrote:
> luacheck: fixed warning in tarantoolctl.in

Nit: Use imperative mood in a commit header, 'fix' instead of 'fixed'.

> Changed passing global variable arg to function
> find_instance_name(arg) instead of passing arg[0] and arg[2] separately.
> And removed exception in .luacheckrc for file /extra/dist/tarantoolctl.in.

Nit: Fit the commit message body to 72 symbols (at least for a prose
text, but not necessary for listings and so).

> 
> This change only solves linter warning, nothing else.
> 
> Fixed #4929.

The commit message on the branch is the previous one. Next time, please,
keep a branch in sync with patches you send to the mailing list.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-14 23:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 12:14 [Tarantool-patches] [PATCH] luacheck: fixed warning in tarantoolctl.in Artem Starshov
2020-10-14 13:11 ` Leonid Vasiliev
2020-10-14 23:04 ` Alexander Turenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox