Tarantool development patches archive
 help / color / mirror / Atom feed
From: sergeyb@tarantool.org
To: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org,
	imun@tarantool.org
Cc: alexander.turenko@tarantool.org
Subject: [Tarantool-patches] [PATCH 09/19] Fix luacheck warnings in test/replication
Date: Thu, 16 Jul 2020 17:11:36 +0300	[thread overview]
Message-ID: <7104af821facbeeb013e568c8735fccaa603add5.1594907318.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1594907318.git.sergeyb@tarantool.org>

From: Sergey Bronnikov <sergeyb@tarantool.org>

Part of #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                                 | 31 ++++++++++++++++++++-
 test/replication/lua/fast_replica.lua       |  9 +++---
 test/replication/lua/rlimit.lua             |  2 +-
 test/replication/master.lua                 |  2 +-
 test/replication/master_quorum.lua          |  4 +--
 test/replication/on_replace.lua             |  6 ++--
 test/replication/replica.lua                |  4 +--
 test/replication/replica_on_schema_init.lua |  4 +--
 8 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 84793362b..bcd2f3a2b 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -43,7 +43,7 @@ exclude_files = {
     "test/box/lua/test_init.lua",
     "test/engine/*.test.lua",
     "test/engine_long/*.test.lua",
-    "test/replication/**/*.lua",
+    "test/replication/*.test.lua",
     "test/replication-py/**/*.lua",
     "test/sql-tap/**/*.lua",
     "test/sql/**/*.lua",
@@ -174,3 +174,32 @@ files["test/long_run-py/suite.lua"] = {
         "delete_insert",
     }
 }
+files["test/replication/replica_quorum.lua"] = {
+    globals = {
+        "INSTANCE_URI",
+        "nonexistent_uri",
+    }
+}
+files["test/replication/replica_on_schema_init.lua"] = {
+    globals = {
+        "trig_local",
+        "trig_engine",
+    }
+}
+files["test/replication/lua/fast_replica.lua"] = {
+    globals = {
+        "call_all",
+        "delete",
+        "drop",
+        "drop_all",
+        "join",
+        "start",
+        "start_all",
+        "stop",
+        "stop_all",
+        "vclock_diff",
+        "unregister",
+        "wait",
+        "wait_all",
+    },
+}
diff --git a/test/replication/lua/fast_replica.lua b/test/replication/lua/fast_replica.lua
index 8c772c41f..7abfba6a0 100644
--- a/test/replication/lua/fast_replica.lua
+++ b/test/replication/lua/fast_replica.lua
@@ -7,7 +7,8 @@ function join(inspector, n)
         os.execute('cp '..path..'/test/replication/replica.lua ./tmp/replica'..rid..'.lua')
         os.execute('chmod +x ./tmp/replica'..rid..'.lua')
         local out_dir = box.cfg.wal_dir
-        inspector:cmd("create server replica"..rid.." with rpl_master=default, script='"..out_dir.."/../tmp/replica"..rid..".lua'")
+        inspector:cmd("create server replica"..rid.." with rpl_master=default, script='"
+			..out_dir.."/../tmp/replica"..rid..".lua'")
         inspector:cmd("start server replica"..rid)
     end
 end
@@ -23,7 +24,7 @@ function call_all(callback)
     end
 end
 
-function unregister(inspector, id)
+function unregister(inspector, id) -- luacheck: no unused args
     box.space._cluster:delete{id}
 end
 
@@ -67,10 +68,10 @@ end
 
 function vclock_diff(left, right)
     local diff = 0
-    for id, lsn in ipairs(left) do
+    for id, lsn in ipairs(left) do -- luacheck: no unused
         diff = diff + (right[id] or 0) - left[id]
     end
-    for id, lsn in ipairs(right) do
+    for id, lsn in ipairs(right) do -- luacheck: no unused
         if left[id] == nil then
             diff = diff + right[id]
         end
diff --git a/test/replication/lua/rlimit.lua b/test/replication/lua/rlimit.lua
index de9f86a35..1bd9e333f 100644
--- a/test/replication/lua/rlimit.lua
+++ b/test/replication/lua/rlimit.lua
@@ -1,5 +1,5 @@
 
-ffi = require('ffi')
+local ffi = require('ffi')
 pcall(ffi.cdef, [[
 typedef long rlim_t;
 struct rlimit {
diff --git a/test/replication/master.lua b/test/replication/master.lua
index e924b5495..b43bafd54 100644
--- a/test/replication/master.lua
+++ b/test/replication/master.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 box.cfg({
     listen              = os.getenv("LISTEN"),
     memtx_memory        = 107374182,
diff --git a/test/replication/master_quorum.lua b/test/replication/master_quorum.lua
index 20f161cc0..8b7ddc5eb 100644
--- a/test/replication/master_quorum.lua
+++ b/test/replication/master_quorum.lua
@@ -26,8 +26,8 @@ box.cfg({
     replication_timeout = TIMEOUT;
 })
 
-test_run = require('test_run').new()
-engine = test_run:get_cfg('engine')
+local test_run = require('test_run').new()
+local engine = test_run:get_cfg('engine')
 
 box.once("bootstrap", function()
     box.schema.user.grant("guest", 'replication')
diff --git a/test/replication/on_replace.lua b/test/replication/on_replace.lua
index 71e63d3f9..df65832c4 100644
--- a/test/replication/on_replace.lua
+++ b/test/replication/on_replace.lua
@@ -15,9 +15,9 @@ end
 
 -- start console first
 require('console').listen(os.getenv('ADMIN'))
-env = require('test_run')
-test_run = env.new()
-engine = test_run:get_cfg('engine')
+local env = require('test_run')
+local test_run = env.new()
+local engine = test_run:get_cfg('engine')
 
 box.cfg({
     listen = instance_uri(INSTANCE_ID);
diff --git a/test/replication/replica.lua b/test/replication/replica.lua
index f3a6dfe58..6bf8060e2 100644
--- a/test/replication/replica.lua
+++ b/test/replication/replica.lua
@@ -1,7 +1,7 @@
 #!/usr/bin/env tarantool
 
-repl_include_self = arg[1] and arg[1] == 'true' or false
-repl_list = nil
+local repl_include_self = arg[1] and arg[1] == 'true' or false
+local repl_list
 
 if repl_include_self then
     repl_list = {os.getenv("MASTER"), os.getenv("LISTEN")}
diff --git a/test/replication/replica_on_schema_init.lua b/test/replication/replica_on_schema_init.lua
index 8a221681b..bfedd5104 100644
--- a/test/replication/replica_on_schema_init.lua
+++ b/test/replication/replica_on_schema_init.lua
@@ -1,12 +1,12 @@
 #!/usr/bin/env tarantool
 
-function trig_local(old, new)
+function trig_local(old, new) -- luacheck: no unused args
     if new and new[3] == 'test_local' and new[6]['group_id'] ~= 1 then
         return new:update{{'=', 6, {group_id = 1}}}
     end
 end
 
-function trig_engine(old, new)
+function trig_engine(old, new) -- luacheck: no unused args
     if new and new[3] == 'test_engine' and new[4] ~= 'vinyl' then
         return new:update{{'=', 4, 'vinyl'}}
     end
-- 
2.26.2

  parent reply	other threads:[~2020-07-16 14:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 01/19] Fix luacheck warnings in test/app-tap sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 02/19] Fix luacheck warnings in test/app sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 03/19] Fix luacheck warnings in test/box sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 04/19] Fix luacheck warnings in test/box-py sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 05/19] Fix luacheck warnings in test/box-tap sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 06/19] Fix luacheck warnings in test/engine sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 07/19] Fix luacheck warnings in test/engine_long sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 08/19] Fix luacheck warnings in test/long_run-py sergeyb
2020-07-16 14:11 ` sergeyb [this message]
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 10/19] Fix luacheck warnings in test/replication-py sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 11/19] Fix luacheck warnings in test/sql sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 12/19] Fix luacheck warnings in test/sql-tap sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 13/19] Fix luacheck warnings in test/swim sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 14/19] Fix luacheck warnings in test/vinyl sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 15/19] Fix luacheck warnings in test/wal_off sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 16/19] Fix luacheck warnings in test/xlog sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 17/19] Fix luacheck warnings in test/xlog-py sergeyb
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 18/19] Add luacheck supression for luajit test sergeyb
2020-07-20 19:46   ` Igor Munkin
2020-07-21 11:52     ` Sergey Bronnikov
2020-07-21 12:38       ` Igor Munkin
2020-07-16 14:11 ` [Tarantool-patches] [PATCH 19/19] luajit: bump new version sergeyb
2020-07-16 14:18 ` [Tarantool-patches] [PATCH] test: fix warnings spotted by luacheck sergeyb
2020-07-20 18:26   ` Igor Munkin
2020-10-30 13:59   ` Kirill Yukhin
2020-07-17  8:09 ` [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck Sergey Bronnikov
2020-08-07  9:19 ` Igor Munkin

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=7104af821facbeeb013e568c8735fccaa603add5.1594907318.git.sergeyb@tarantool.org \
    --to=sergeyb@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 09/19] Fix luacheck warnings in test/replication' \
    /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