[Tarantool-patches] [PATCH v7 1/3] luacheck: fix warnings in test/app-tap

sergeyb at tarantool.org sergeyb at tarantool.org
Wed Dec 16 19:00:00 MSK 2020


From: Sergey Bronnikov <sergeyb at tarantool.org>

Part of #5453

Reviewed-by: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
Reviewed-by: Igor Munkin <imun at tarantool.org>

Co-authored-by: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
Co-authored-by: Igor Munkin <imun at tarantool.org>
---
 .luacheckrc                                   |  9 ++-
 test/app-tap/cfg.test.lua                     |  2 +-
 test/app-tap/clock.test.lua                   |  4 +-
 test/app-tap/console.test.lua                 | 10 ++--
 test/app-tap/csv.test.lua                     | 56 +++++++++----------
 test/app-tap/fail_main.test.lua               |  4 +-
 .../gh-4761-json-per-call-options.test.lua    |  4 +-
 test/app-tap/gh-5013-fiber-cancel.test.lua    |  2 +-
 .../gh-5130-panic-on-invalid-log.test.lua     |  4 +-
 test/app-tap/http_client.test.lua             | 25 +++------
 test/app-tap/iconv.test.lua                   |  4 +-
 test/app-tap/init_script.test.lua             | 16 +++---
 test/app-tap/inspector.test.lua               |  5 +-
 test/app-tap/json.test.lua                    |  1 -
 test/app-tap/logger.test.lua                  | 12 ++--
 test/app-tap/lua/serializer_test.lua          | 28 +++-------
 test/app-tap/module_api.test.lua              | 13 ++---
 test/app-tap/msgpackffi.test.lua              |  3 +-
 test/app-tap/pcall.test.lua                   |  2 +-
 test/app-tap/snapshot.test.lua                | 15 +++--
 test/app-tap/string.test.lua                  | 30 +++++-----
 test/app-tap/tap.test.lua                     |  4 +-
 test/app-tap/tarantoolctl.test.lua            | 46 ++++++---------
 test/app-tap/trigger.test.lua                 |  8 +--
 test/app-tap/yaml.test.lua                    | 14 ++---
 test/app-tap/yield-in-gc-finalizer.test.lua   |  3 +-
 26 files changed, 145 insertions(+), 179 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 29db9eeeb..ae96576ec 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -3,6 +3,8 @@ globals = {"box", "_TARANTOOL", "tonumber64"}
 ignore = {
     -- Accessing an undefined field of a global variable <debug>.
     "143/debug",
+    -- Accessing an undefined field of a global variable <os>.
+    "143/os",
     -- Accessing an undefined field of a global variable <string>.
     "143/string",
     -- Accessing an undefined field of a global variable <table>.
@@ -31,7 +33,6 @@ exclude_files = {
     -- Third-party source code.
     "test-run/**/*.lua",
     "test/app/**/*.lua",
-    "test/app-tap/**/*.lua",
     "test/box/**/*.lua",
     "test/box-py/**/*.lua",
     "test/box-tap/**/*.lua",
@@ -102,3 +103,9 @@ files["src/box/lua/console.lua"] = {
         "212",
     }
 }
+files["test/app-tap/lua/require_mod.lua"] = {
+    globals = {"exports"}
+}
+files["test/app-tap/string.test.lua"] = {
+    globals = {"utf8"}
+}
diff --git a/test/app-tap/cfg.test.lua b/test/app-tap/cfg.test.lua
index ba6b735ab..7a94f16a3 100755
--- a/test/app-tap/cfg.test.lua
+++ b/test/app-tap/cfg.test.lua
@@ -12,7 +12,7 @@ test:plan(11)
 local nil_uuid = '00000000-0000-0000-0000-000000000000'
 local ok = pcall(box.cfg, {instance_uuid = nil_uuid})
 test:ok(not ok, 'nil instance UUID is not allowed')
-ok, err = pcall(box.cfg, {replicaset_uuid = nil_uuid})
+ok = pcall(box.cfg, {replicaset_uuid = nil_uuid})
 test:ok(not ok, 'nil replicaset UUID is not allowed')
 
 test:is(type(box.ctl), "table", "box.ctl is available before box.cfg")
diff --git a/test/app-tap/clock.test.lua b/test/app-tap/clock.test.lua
index fd1c4f272..d1ea4f0a8 100755
--- a/test/app-tap/clock.test.lua
+++ b/test/app-tap/clock.test.lua
@@ -1,7 +1,7 @@
 #!/usr/bin/env tarantool
 
-clock = require("clock")
-test = require("tap").test("csv")
+local clock = require("clock")
+local test = require("tap").test("csv")
 test:plan(10)
 test:ok(clock.realtime() > 0, "realtime")
 test:ok(clock.thread() > 0, "thread")
diff --git a/test/app-tap/console.test.lua b/test/app-tap/console.test.lua
index d5452aa17..d397d4a37 100755
--- a/test/app-tap/console.test.lua
+++ b/test/app-tap/console.test.lua
@@ -5,9 +5,9 @@ local console = require('console')
 local socket = require('socket')
 local yaml = require('yaml')
 local fiber = require('fiber')
-local ffi = require('ffi')
 local log = require('log')
 local fio = require('fio')
 
 -- Suppress console log messages
 log.level(4)
@@ -19,7 +19,7 @@ os.remove(IPROTO_SOCKET)
 --
 local EOL = "\n...\n"
 
-test = tap.test("console")
+local test = tap.test("console")
 
 test:plan(78)
 
@@ -60,6 +60,7 @@ client:write('\\set output lua\n')
 client:read(";")
 
- long_func_f = nil
+ local long_func_f = nil
+-- luacheck: globals long_func (is called via client socket)
 function long_func()
     long_func_f = fiber.self()
     box.session.push('push')
@@ -87,12 +88,9 @@ test:is(#client:read(EOL) > 0, true, "_G")
 client:write("require('fiber').id()\n")
 local fid1 = yaml.decode(client:read(EOL))[1]
 local state = fiber.find(fid1).storage.console
-local server_info = state.client:peer()
 local client_info = state.client:name()
 test:is(client_info.host, client_info.host, "state.socker:peer().host")
 test:is(client_info.port, client_info.port, "state.socker:peer().port")
-server_info = nil
-client_info = nil
 
 -- Check console.delimiter()
 client:write("require('console').delimiter(';')\n")
@@ -225,7 +223,7 @@ box.cfg{listen = ''}
 os.remove(IPROTO_SOCKET)
 
 local s = console.listen('127.0.0.1:0')
-addr = s:name()
+local addr = s:name()
 test:is(addr.family, 'AF_INET', 'console.listen uri support')
 test:is(addr.host, '127.0.0.1', 'console.listen uri support')
 test:isnt(addr.port, 0, 'console.listen uri support')
diff --git a/test/app-tap/csv.test.lua b/test/app-tap/csv.test.lua
index a7f17b1ea..eb180f95d 100755
--- a/test/app-tap/csv.test.lua
+++ b/test/app-tap/csv.test.lua
@@ -2,9 +2,9 @@
 
 local function table2str(t)
     local res = ""
-    for k, line in pairs(t) do
+    for _, line in pairs(t) do
         local s = ""
-        for k2, field in pairs(line) do
+        for _, field in pairs(line) do
             s = s .. '|' .. field .. '|\t'
         end
         res = res .. s .. '\n'
@@ -12,9 +12,9 @@ local function table2str(t)
     return res
 end
 
-local function myread(self, bytes) 
+local function myread(self, bytes)
     self.i = self.i + bytes
-    return self.v:sub(self.i - bytes + 1, self.i) 
+    return self.v:sub(self.i - bytes + 1, self.i)
 end
 local csv = require('csv')
 local fio = require('fio')
@@ -27,18 +27,18 @@ local test4_ans = '|123|\t|5|\t|92|\t|0|\t|0|\t\n|1|\t|12  34|\t|56|\t' ..
 local test5_ans = "|1|\t\n|23|\t|456|\t|abcac|\t|'multiword field 4'|\t\n" ..
                   "|none|\t|none|\t|0|\t\n||\t||\t||\t\n|aba|\t|adda|\t|f" ..
                   "3|\t|0|\t\n|local res = internal.pwrite(self.fh|\t|dat" ..
-                  "a|\t|len|\t|offset)|\t\n|iflag = bit.bor(iflag|\t|fio." .. 
+                  "a|\t|len|\t|offset)|\t\n|iflag = bit.bor(iflag|\t|fio." ..
                   "c.flag[ flag ])|\t\n||\t||\t||\t\n"
 local test6_ans = "|23|\t|456|\t|abcac|\t|'multiword field 4'|\t\n|none|" ..
-                  "\t|none|\t|0|\t\n||\t||\t||\t\n|aba|\t|adda|\t|f3|\t|" .. 
+                  "\t|none|\t|0|\t\n||\t||\t||\t\n|aba|\t|adda|\t|f3|\t|" ..
                   "0|\t\n|local res = internal.pwrite(self.fh|\t|data|\t" ..
                   "|len|\t|offset)|\t\n|iflag = bit.bor(iflag|\t|fio.c.f" ..
                   "lag[ flag ])|\t\n||\t||\t||\t\n"
 
-test = tap.test("csv")
+local test = tap.test("csv")
 test:plan(12)
 
-readable = {}
+local readable = {}
 readable.read = myread
 readable.v = "a,b\n1,\"ha\n\"\"ha\"\"\nha\"\n3,4\n"
 readable.i = 0
@@ -52,17 +52,17 @@ readable.v = ", \r\nkp\"\"v"
 readable.i = 0
 test:is(table2str(csv.load(readable, {chunk_size = 3})), test3_ans, "obj test3")
 
-tmpdir = fio.tempdir()
-file1 = fio.pathjoin(tmpdir, 'file.1')
-file2 = fio.pathjoin(tmpdir, 'file.2')
-file3 = fio.pathjoin(tmpdir, 'file.3')
-file4 = fio.pathjoin(tmpdir, 'file.4')
+local tmpdir = fio.tempdir()
+local file1 = fio.pathjoin(tmpdir, 'file.1')
+local file2 = fio.pathjoin(tmpdir, 'file.2')
+local file3 = fio.pathjoin(tmpdir, 'file.3')
+local file4 = fio.pathjoin(tmpdir, 'file.4')
 
 local f = fio.open(file1, { 'O_WRONLY', 'O_TRUNC', 'O_CREAT' }, tonumber('0777', 8))
 f:write("123 , 5  ,       92    , 0, 0\n" ..
         "1, 12  34, 56, \"quote , \", 66\nok")
 f:close()
-f = fio.open(file1, {'O_RDONLY'}) 
+f = fio.open(file1, {'O_RDONLY'})
 test:is(table2str(csv.load(f, {chunk_size = 10})), test4_ans, "fio test1")
 f:close()
 
@@ -77,31 +77,31 @@ f:write("1\n23,456,abcac,\'multiword field 4\'\n" ..
         ",,"
 )
 f:close()
-f = fio.open(file2, {'O_RDONLY'}) 
+f = fio.open(file2, {'O_RDONLY'})
 --symbol by symbol reading
-test:is(table2str(csv.load(f, {chunk_size = 1})), test5_ans, "fio test2") 
+test:is(table2str(csv.load(f, {chunk_size = 1})), test5_ans, "fio test2")
 f:close()
 
-f = fio.open(file2, {'O_RDONLY'}) 
-opts = {chunk_size = 7, skip_head_lines = 1}
+f = fio.open(file2, {'O_RDONLY'})
+local opts = {chunk_size = 7, skip_head_lines = 1}
 --7 symbols per chunk
-test:is(table2str(csv.load(f, opts)), test6_ans, "fio test3") 
+test:is(table2str(csv.load(f, opts)), test6_ans, "fio test3")
 f:close()
 
-t = {
-    {'quote" d', ',and, comma', 'both " of " t,h,e,m'}, 
-    {'"""', ',","'}, 
-    {'mul\nti\nli\r\nne\n\n', 'field'},
-    {""},
-    {'"'},
-    {"\n"}
+local t = {
+          {'quote" d', ',and, comma', 'both " of " t,h,e,m'},
+          {'"""', ',","'},
+          {'mul\nti\nli\r\nne\n\n', 'field'},
+          {""},
+          {'"'},
+          {"\n"}
 }
 
 f = require("fio").open(file3, { "O_WRONLY", "O_TRUNC" , "O_CREAT"}, 0x1FF)
 csv.dump(t, {}, f)
 f:close()
-f = fio.open(file3, {'O_RDONLY'}) 
-t2 = csv.load(f, {chunk_size = 5})
+f = fio.open(file3, {'O_RDONLY'})
+local t2 = csv.load(f, {chunk_size = 5})
 f:close()
 
 test:is(table2str(t), table2str(t2), "test roundtrip")
diff --git a/test/app-tap/fail_main.test.lua b/test/app-tap/fail_main.test.lua
index f8c45bf6f..cf6b1d8ed 100755
--- a/test/app-tap/fail_main.test.lua
+++ b/test/app-tap/fail_main.test.lua
@@ -7,7 +7,7 @@ local tarantool_bin = arg[-1]
 
 test:plan(1)
 
-function run_script(code)
+local function run_script(code)
     local dir = fio.tempdir()
     local script_path = fio.pathjoin(dir, 'script.lua')
     local script = fio.open(script_path, {'O_CREAT', 'O_WRONLY', 'O_APPEND'},
@@ -30,7 +30,7 @@ end
 -- gh-4382: an error in main script should be handled gracefully,
 -- with proper logging.
 --
-local code, output = run_script("error('Error in the main script')")
+local _, output = run_script("error('Error in the main script')")
 
 test:ok(output:match("fatal error, exiting the event loop"),
         "main script error is handled gracefully")
diff --git a/test/app-tap/gh-4761-json-per-call-options.test.lua b/test/app-tap/gh-4761-json-per-call-options.test.lua
index 1fb24744e..c6b31ba61 100755
--- a/test/app-tap/gh-4761-json-per-call-options.test.lua
+++ b/test/app-tap/gh-4761-json-per-call-options.test.lua
@@ -13,7 +13,7 @@ local res = tap.test('gh-4761-json-per-call-options', function(test)
     test:plan(2)
 
     -- Preparation code: call :decode() with a custom option.
-    local ok, err = pcall(json.decode, '{"foo": {"bar": 1}}',
+    local ok = pcall(json.decode, '{"foo": {"bar": 1}}',
                           {decode_max_depth = 1})
     assert(not ok, 'expect "too many nested data structures" error')
 
@@ -25,7 +25,7 @@ local res = tap.test('gh-4761-json-per-call-options', function(test)
 
     -- Same check for json.encode.
     local nan = 1/0
-    local ok, err = pcall(json.encode, {a = nan},
+    local ok = pcall(json.encode, {a = nan},
                           {encode_invalid_numbers = false})
     assert(not ok, 'expected "number must not be NaN or Inf" error')
     local exp_res = '{"a":inf}'
diff --git a/test/app-tap/gh-5013-fiber-cancel.test.lua b/test/app-tap/gh-5013-fiber-cancel.test.lua
index 91c6775dc..7efb6ab5d 100755
--- a/test/app-tap/gh-5013-fiber-cancel.test.lua
+++ b/test/app-tap/gh-5013-fiber-cancel.test.lua
@@ -8,7 +8,7 @@ test:plan(2)
 
 local result = {}
 
-function test_f()
+local function test_f()
     local cond = fiber.cond()
     local res, err = pcall(cond.wait, cond)
     result.res = res
diff --git a/test/app-tap/gh-5130-panic-on-invalid-log.test.lua b/test/app-tap/gh-5130-panic-on-invalid-log.test.lua
index 24af8139c..7ebff1425 100755
--- a/test/app-tap/gh-5130-panic-on-invalid-log.test.lua
+++ b/test/app-tap/gh-5130-panic-on-invalid-log.test.lua
@@ -9,11 +9,11 @@ test:plan(3)
 --
 
 -- Invalid log. No panic, just error
-_, err = pcall(log.cfg, {log=' :invalid'})
+local _, err = pcall(log.cfg, {log=' :invalid'})
 test:like(err, "expecting a file name or a prefix")
 
 -- Empty string - default log (to be compatible with box.cfg)
-ok = pcall(log.cfg, {log=''})
+local ok = pcall(log.cfg, {log=''})
 test:ok(ok)
 
 -- Dynamic reconfiguration - error, no info about invalid logger type
diff --git a/test/app-tap/http_client.test.lua b/test/app-tap/http_client.test.lua
index b85b605cf..093af8fe4 100755
--- a/test/app-tap/http_client.test.lua
+++ b/test/app-tap/http_client.test.lua
@@ -42,7 +42,7 @@ local function start_server(test, sock_family, sock_addr)
     test:is(server:read("*l"), "heartbeat", "server started")
     test:diag("trying to connect to %s", url)
     local r
-    for i=1,10 do
+    for _=1,10 do
         r = client.get(url, merge(opts, {timeout = 0.01}))
         if r.status == 200 then
             break
@@ -164,7 +164,7 @@ local function test_cancel_and_errinj(test, url, opts)
     local errinj = box.error.injection
     errinj.set('ERRINJ_HTTP_RESPONSE_ADD_WAIT', true)
     local topts = merge(opts, {timeout = 1200})
-    f = fiber.create(func, topts)
+    fiber.create(func, topts)
     r = ch:get()
     test:is(r.status, 200, "No hangs in errinj")
     errinj.set('ERRINJ_HTTP_RESPONSE_ADD_WAIT', false)
@@ -180,7 +180,6 @@ local function test_post_and_get(test, url, opts)
     local my_body = { key = "value" }
     local json_body = json.encode(my_body)
     local responses = {}
-    local data = {a = 'b'}
     headers['Content-Type'] = 'application/json'
     local fibers = 7
     local ch = fiber.channel(fibers)
@@ -213,7 +212,7 @@ local function test_post_and_get(test, url, opts)
         responses.absent_get = http:get(url .. 'absent', opts)
         ch:put(1)
     end)
-    for i=1,fibers do
+    for _=1,fibers do
         ch:get()
     end
     local r = responses.good_get
@@ -270,7 +269,6 @@ local function test_errors(test)
     test:ok(not status and string.find(json.encode(err),
                         "Unsupported protocol"),
                         "POST: exception on bad protocol")
-    local r = http:get("http://do_not_exist_8ffad33e0cb01e6a01a03d00089e71e5b2b7e9930dfcba.ru")
 end
 
 -- gh-3679 Check that opts.headers values can be strings only.
@@ -355,7 +353,7 @@ local function test_request_headers(test, url, opts)
     local http = client:new()
 
     for _, case in ipairs(cases) do
-        local opts = merge(table.copy(opts), case.opts)
+        opts = merge(table.copy(opts), case.opts)
         local ok, err = pcall(http.get, http, url, opts)
         if case.postrequest_check ~= nil then
             case.postrequest_check(opts)
@@ -425,7 +423,6 @@ local function test_special_methods(test, url, opts)
     local responses = {}
     local fibers = 7
     local ch = fiber.channel(fibers)
-    local _
     fiber.create(function()
         responses.patch_data = http:patch(url, "{\"key\":\"val\"}", opts)
         ch:put(1)
@@ -454,7 +451,7 @@ local function test_special_methods(test, url, opts)
         responses.custom_data = http:request("CUSTOM", url, nil, opts)
         ch:put(1)
     end)
-    for i = 1, fibers do
+    for _ = 1, fibers do
         ch:get()
     end
 
@@ -483,10 +480,6 @@ end
 
 local function test_concurrent(test, url, opts)
     test:plan(3)
-    local http = client.new()
-    local headers = { my_header = "1", my_header2 = "2" }
-    local my_body = { key = "value" }
-    local json_body = json.encode(my_body)
     local num_test = 10
     local num_load = 10
     local curls   = { }
@@ -497,7 +490,7 @@ local function test_concurrent(test, url, opts)
         headers["My-header" .. i] = "my-value"
     end
 
-    for i = 1, num_test do
+    for _ = 1, num_test do
         table.insert(curls, {
             url = url,
             http = client.new(),
@@ -515,7 +508,7 @@ local function test_concurrent(test, url, opts)
     -- Creating concurrent clients
     for i=1,num_test do
         local obj = curls[i]
-        for j=1,num_load do
+        for _=1,num_load do
             fiber.create(function()
                 local r = obj.http:post(obj.url, obj.body, merge(opts, {
                     headers = obj.headers,
@@ -540,13 +533,11 @@ local function test_concurrent(test, url, opts)
     end
     local ok_sockets_added = true
     local ok_active = true
-    local ok_timeout = true
     local ok_req = true
 
     -- Join test
     local rest = num_test
     while true do
-        local ticks = 0
         for i = 1, num_load do
             local obj = curls[i]
             -- checking that stats in concurrent are ok
@@ -582,7 +573,7 @@ local function test_concurrent(test, url, opts)
     test:ok(ok_active, "no active requests")
 end
 
-function run_tests(test, sock_family, sock_addr)
+local function run_tests(test, sock_family, sock_addr)
     test:plan(11)
     local server, url, opts = start_server(test, sock_family, sock_addr)
     test:test("http.client", test_http_client, url, opts)
diff --git a/test/app-tap/iconv.test.lua b/test/app-tap/iconv.test.lua
index 6f6a04b14..eeadd6673 100755
--- a/test/app-tap/iconv.test.lua
+++ b/test/app-tap/iconv.test.lua
@@ -3,7 +3,7 @@
 local tap   = require('tap')
 local iconv = require('iconv')
 
-test = tap.test("iconv")
+local test = tap.test("iconv")
 test:plan(11)
 
 local simple_str  = 'ascii string'
@@ -34,7 +34,7 @@ test:is(c8_1251(c1251_16(c16_16be(c16be_8(cyrillic_str)))), cyrillic_str,
         'complex multi-format conversion')
 
 -- test huge string
-huge_str = string.rep(cyrillic_str, 50)
+local huge_str = string.rep(cyrillic_str, 50)
 
 test:is(c16be_8(c8_16be(huge_str)), huge_str, "huge string")
 
diff --git a/test/app-tap/init_script.test.lua b/test/app-tap/init_script.test.lua
index e6f298f93..56de6d44e 100755
--- a/test/app-tap/init_script.test.lua
+++ b/test/app-tap/init_script.test.lua
@@ -9,14 +9,14 @@ box.cfg{
     log="tarantool.log"
 }
 
-yaml = require('yaml')
-fiber = require('fiber')
+local yaml = require('yaml')
+local fiber = require('fiber')
 
 if box.space.tweedledum ~= nil then
     box.space.space1:drop()
 end
 
-space = box.schema.space.create('tweedledum')
+local space = box.schema.space.create('tweedledum')
 space:create_index('primary', { type = 'hash' })
 
 print[[
@@ -24,7 +24,7 @@ print[[
 -- Access to box.cfg from init script
 --
 ]]
-t = {}
+local t = {}
 
 for k,v in pairs(box.cfg) do
     if k == 'listen' then
@@ -36,7 +36,7 @@ for k,v in pairs(box.cfg) do
 end
 table.sort(t)
 print('box.cfg')
-for k,v in pairs(t) do print(v) end
+for _,v in pairs(t) do print(v) end
 --
 -- Insert tests
 --
@@ -44,7 +44,7 @@ local function do_insert()
     space:insert{1, 2, 4, 8}
 end
 
-fiber1 = fiber.create(do_insert)
+fiber.create(do_insert)
 
 print[[
 --
@@ -71,12 +71,12 @@ print[[
 -- Check that require function(math.floor) reachable in the init script
 --
 ]]
-floor = require("math").floor
+local floor = require("math").floor
 print(floor(0.5))
 print(floor(0.9))
 print(floor(1.1))
 
-mod = require('require_mod')
+local mod = require('require_mod')
 print(mod.test(10, 15))
 --
 -- A test case for https://github.com/tarantool/tarantool/issues/53
diff --git a/test/app-tap/inspector.test.lua b/test/app-tap/inspector.test.lua
index ed10020a2..cda3eda2c 100755
--- a/test/app-tap/inspector.test.lua
+++ b/test/app-tap/inspector.test.lua
@@ -1,9 +1,6 @@
 #!/usr/bin/env tarantool
 
-local socket = require('socket')
-
-test_run = require('test_run')
-inspector = test_run.new()
+local inspector = require('test_run').new()
 
 print('create instance')
 print(inspector:cmd("create server replica with rpl_master=default, script='box/box.lua'\n"))
diff --git a/test/app-tap/json.test.lua b/test/app-tap/json.test.lua
index 70e9f6cf7..be60e45c9 100755
--- a/test/app-tap/json.test.lua
+++ b/test/app-tap/json.test.lua
@@ -2,7 +2,6 @@
 
 package.path = "lua/?.lua;"..package.path
 
-local ffi = require('ffi')
 local tap = require('tap')
 local common = require('serializer_test')
 
diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua
index a448ba87a..890d3f5c3 100755
--- a/test/app-tap/logger.test.lua
+++ b/test/app-tap/logger.test.lua
@@ -7,7 +7,7 @@ test:plan(64)
 -- gh-5121: Allow to use 'json' output before box.cfg()
 --
 local log = require('log')
-_, err = pcall(log.log_format, 'json')
+local _, err = pcall(log.log_format, 'json')
 test:ok(err == nil)
 
 -- We're not allowed to use json with syslog though.
@@ -141,7 +141,7 @@ end
 log.info(message)
 local line = file:read()
 test:is(line:sub(-message:len()), message, "message")
-s, err = pcall(json.decode, line)
+local s = pcall(json.decode, line)
 test:ok(not s, "plain")
 --
 -- gh-700: Crash on calling log.info() with formatting characters
@@ -160,7 +160,7 @@ test:is(file:read():match('I>%s+(.*)'), '{"key":"value"}', "table is handled as
 log.info({message="value"})
 test:is(file:read():match('I>%s+(.*)'), '{"message":"value"}', "table is handled as json")
 
-function help() log.info("gh-2340: %s %s", 'help') end
+local function help() log.info("gh-2340: %s %s", 'help') end
 
 xpcall(help, function(err)
     test:ok(err:match("bad argument #3"), "found error string")
@@ -171,14 +171,14 @@ file:close()
 
 test:ok(log.pid() >= 0, "pid()")
 
--- logger uses 'debug', try to set it to nil
+-- luacheck: ignore (logger uses 'debug', try to set it to nil)
 debug = nil
 log.info("debug is nil")
 debug = require('debug')
 
 test:ok(log.info(true) == nil, 'check tarantool crash (gh-2516)')
 
-s, err = pcall(box.cfg, {log_format='json', log="syslog:identity:tarantool"})
+s = pcall(box.cfg, {log_format='json', log="syslog:identity:tarantool"})
 test:ok(not s, "check json not in syslog")
 
 box.cfg{log=filename,
@@ -235,7 +235,7 @@ file = fio.open(filename)
 while file == nil do file = fio.open(filename) fiber.sleep(0.0001) end
 line = file:read()
 while line == nil or line == ""  do line = file:read() fiber.sleep(0.0001) end
-index = line:find('\n')
+local index = line:find('\n')
 line = line:sub(1, index)
 message = json.decode(line)
 test:is(message.message, "log file has been reopened", "check message after log.rotate()")
diff --git a/test/app-tap/lua/serializer_test.lua b/test/app-tap/lua/serializer_test.lua
index 2a668f898..cea78f7ed 100644
--- a/test/app-tap/lua/serializer_test.lua
+++ b/test/app-tap/lua/serializer_test.lua
@@ -2,7 +2,7 @@ local ffi = require('ffi')
 
 local function rt(test, s, x, t)
     local buf1 = s.encode(x)
-    local x1, offset1 = s.decode(buf1)
+    local x1 = s.decode(buf1)
     local xstr
     if type(x) == "table" then
         xstr = "table"
@@ -189,8 +189,6 @@ local function test_double(test, s)
     ss.cfg{decode_invalid_numbers = true}
     rt(test, s, nan)
     rt(test, s, inf)
-
-    ss = nil
 end
 
 local function test_decimal(test, s)
@@ -258,14 +256,14 @@ local function test_table(test, s, is_array, is_map)
     test:ok(is_map(s.encode({k1 = 'v1', k2 = 'v2', k3 = 'v3'})), "map is map")
 
     -- utf-8 pairs
-    rt(test, s, {Метапеременная = { 'Метазначение' }})
+    rt(test, s, {['Метапеременная'] = { 'Метазначение' }})
     rt(test, s, {test = { 'Результат' }})
 
     local arr = setmetatable({1, 2, 3, k1 = 'v1', k2 = 'v2', 4, 5},
         { __serialize = 'seq'})
     local map = setmetatable({1, 2, 3, 4, 5}, { __serialize = 'map'})
     local obj = setmetatable({}, {
-        __serialize = function(x) return 'serialize' end
+        __serialize = function() return 'serialize' end
     })
 
     -- __serialize on encode
@@ -306,8 +304,6 @@ local function test_table(test, s, is_array, is_map)
     -- string (from __serialize hook)
     test:is(ss.decode(ss.encode(obj)), "serialize", "object load __serialize")
 
-    ss = nil
-
     --
     -- decode_save_metatables
     --
@@ -325,14 +321,12 @@ local function test_table(test, s, is_array, is_map)
         "array save __serialize")
     test:is(getmetatable(ss.decode(ss.encode(map))).__serialize, "map",
         "map save __serialize")
-    ss = nil
-
 
     --
     -- encode_sparse_convert / encode_sparse_ratio / encode_sparse_safe
     --
 
-    local ss = s.new()
+    ss = s.new()
 
     ss.cfg{encode_sparse_ratio = 2, encode_sparse_safe = 10}
 
@@ -359,8 +353,6 @@ local function test_table(test, s, is_array, is_map)
     -- array
     test:ok(is_array(ss.encode({1, 2, 3, 4, 5, [100] = 100})),
         "sparse safe 2")
-
-    ss = nil
 end
 
 local function test_ucdata(test, s)
@@ -374,9 +366,9 @@ local function test_ucdata(test, s)
     local ctype = ffi.typeof('struct serializer_cdata_test')
     ffi.metatype(ctype, {
         __index = {
-            __serialize = function(obj) return 'unpack' end,
+            __serialize = function() return 'unpack' end,
         },
-        __tostring = function(obj) return 'tostring' end
+        __tostring = function() return 'tostring' end
     });
 
     local cdata = ffi.new(ctype)
@@ -409,8 +401,6 @@ local function test_ucdata(test, s)
     test:istable(ss.decode(ss.encode(udata)), 'udata  hook priority')
     -- gh-1226: luaL_convertfield should ignore __serialize hook for ctypes
     test:like(ss.decode(ss.encode(ctype)), 'ctype<struct', 'ctype __serialize')
-
-    ss = nil
 end
 
 local function test_depth(test, s)
@@ -433,12 +423,12 @@ local function test_depth(test, s)
     s.cfg({encode_deep_as_nil = false})
 
     local t = nil
-    for i = 1, max_depth + 1 do t = {t} end
-    local ok, err = pcall(s.encode, t)
+    for _ = 1, max_depth + 1 do t = {t} end
+    local ok = pcall(s.encode, t)
     test:ok(not ok, "too deep encode depth")
 
     s.cfg({encode_max_depth = max_depth + 1})
-    ok, err = pcall(s.encode, t)
+    ok = pcall(s.encode, t)
     test:ok(ok, "no throw in a corner case")
 
     s.cfg({encode_deep_as_nil = deep_as_nil, encode_max_depth = max_depth})
diff --git a/test/app-tap/module_api.test.lua b/test/app-tap/module_api.test.lua
index 6a7ce3040..c43d8eacd 100755
--- a/test/app-tap/module_api.test.lua
+++ b/test/app-tap/module_api.test.lua
@@ -5,7 +5,7 @@ local fio = require('fio')
 box.cfg{log = "tarantool.log"}
 -- Use BUILDDIR passed from test-run or cwd when run w/o
 -- test-run to find test/app-tap/module_api.{so,dylib}.
-build_path = os.getenv("BUILDDIR") or '.'
+local build_path = os.getenv("BUILDDIR") or '.'
 package.cpath = fio.pathjoin(build_path, 'test/app-tap/?.so'   ) .. ';' ..
                 fio.pathjoin(build_path, 'test/app-tap/?.dylib') .. ';' ..
                 package.cpath
@@ -17,10 +17,10 @@ local function test_pushcdata(test, module)
     local gc_counter = 0;
     local ct = ffi.typeof('struct module_api_test')
     ffi.metatype(ct, {
-        __tostring = function(obj)
+        __tostring = function()
             return 'ok'
         end;
-        __gc = function(obj)
+        __gc = function()
             gc_counter = gc_counter + 1;
         end
     })
@@ -33,14 +33,13 @@ local function test_pushcdata(test, module)
     test:is(ctid, ctid2, 'checkcdata type')
     test:is(ptr, ptr2, 'checkcdata value')
     test:is(gc_counter, 0, 'pushcdata gc')
-    obj = nil
+    obj = nil -- luacheck: no unused
     collectgarbage('collect')
     test:is(gc_counter, 1, 'pushcdata gc')
 end
 
 local function test_buffers(test, module)
     test:plan(9)
-    local ffi = require('ffi')
     local buffer = require('buffer')
 
     local bufalloc = buffer.static_alloc("char", 128)
@@ -222,7 +221,7 @@ local function test_iscdata(test, module)
     end
 end
 
-local test = require('tap').test("module_api", function(test)
+require('tap').test("module_api", function(test)
     test:plan(38)
     local status, module = pcall(require, 'module_api')
     test:is(status, true, "module")
@@ -244,7 +243,7 @@ local test = require('tap').test("module_api", function(test)
         end
     end
 
-    local status, msg = pcall(module.check_error)
+    local _, msg = pcall(module.check_error)
     test:like(msg, 'luaT_error', 'luaT_error')
 
     test:test("pushcdata", test_pushcdata, module)
diff --git a/test/app-tap/msgpackffi.test.lua b/test/app-tap/msgpackffi.test.lua
index 0ee5f5edc..058b74f3d 100755
--- a/test/app-tap/msgpackffi.test.lua
+++ b/test/app-tap/msgpackffi.test.lua
@@ -4,7 +4,6 @@ package.path = "lua/?.lua;"..package.path
 
 local tap = require('tap')
 local common = require('serializer_test')
-local ffi = require('ffi')
 
 local function is_map(s)
     local b = string.byte(string.sub(s, 1, 1))
@@ -76,7 +75,7 @@ local function test_other(test, s)
     --
     local function check_depth(depth_to_try)
         local t = nil
-        for i = 1, depth_to_try do t = {t} end
+        for _ = 1, depth_to_try do t = {t} end
         t = s.decode_unchecked(s.encode(t))
         local level = 0
         while t ~= nil do level = level + 1 t = t[1] end
diff --git a/test/app-tap/pcall.test.lua b/test/app-tap/pcall.test.lua
index 30163a41a..d144e075c 100755
--- a/test/app-tap/pcall.test.lua
+++ b/test/app-tap/pcall.test.lua
@@ -12,7 +12,7 @@ box.cfg{
     log="tarantool.log",
     memtx_memory=107374182,
 }
-function pcalltest()
+local function pcalltest()
     local ERRMSG = "module 'some_invalid_module' not found"
     local status, msg = pcall(require, 'some_invalid_module')
     if status == false and msg ~= nil and msg:match(ERRMSG) ~= nil then
diff --git a/test/app-tap/snapshot.test.lua b/test/app-tap/snapshot.test.lua
index 587f8279b..2475ee4b9 100755
--- a/test/app-tap/snapshot.test.lua
+++ b/test/app-tap/snapshot.test.lua
@@ -3,7 +3,6 @@
 local math = require('math')
 local fiber = require('fiber')
 local tap = require('tap')
-local ffi = require('ffi')
 local fio = require('fio')
 
 box.cfg{ log="tarantool.log", memtx_memory=107374182}
@@ -75,14 +74,14 @@ snap_chan:get()
 test:ok(true, 'gh-695: avoid overwriting tuple data necessary for smfree()')
 
 -------------------------------------------------------------------------------
--- gh-1185: Crash in matras_touch in snapshot_daemon.test 
+-- gh-1185: Crash in matras_touch in snapshot_daemon.test
 -------------------------------------------------------------------------------
 
 local s1 = box.schema.create_space('test1', { engine = 'memtx'})
-local i1 = s1:create_index('test', { type = 'tree', parts = {1, 'unsigned'} })
+s1:create_index('test', { type = 'tree', parts = {1, 'unsigned'} })
 
 local s2 = box.schema.create_space('test2', { engine = 'memtx'})
-local i2 = s2:create_index('test', { type = 'tree', parts = {1, 'unsigned'} })
+s2:create_index('test', { type = 'tree', parts = {1, 'unsigned'} })
 
 for i = 1,1000 do s1:insert{i, i, i} end
 
@@ -126,11 +125,11 @@ local function gh1094()
             break
         end
     end
-    local sf, mf = pcall(box.snapshot)
-    for i, f in pairs(files) do
+    local sf = pcall(box.snapshot)
+    for _, f in pairs(files) do
         f:close()
     end
-    local ss, ms = pcall(box.snapshot)
+    local ss = pcall(box.snapshot)
     test:ok(not sf and ss, msg)
 end
 gh1094()
@@ -141,7 +140,7 @@ box.snapshot()
 box.snapshot()
 box.snapshot()
 test:ok(true, 'No crash for second snapshot w/o any changes')
-files = fio.glob(box.cfg.memtx_dir .. '/*.snap')
+local files = fio.glob(box.cfg.memtx_dir .. '/*.snap')
 table.sort(files)
 fio.unlink(files[#files])
 box.snapshot()
diff --git a/test/app-tap/string.test.lua b/test/app-tap/string.test.lua
index 02a1a84d7..08bc54cf0 100755
--- a/test/app-tap/string.test.lua
+++ b/test/app-tap/string.test.lua
@@ -216,10 +216,10 @@ test:test("unicode", function(test)
     test:is(s, lower_res, 'default locale lower')
     test:is(utf8.upper(''), '', 'empty string upper')
     test:is(utf8.lower(''), '', 'empty string lower')
-    local err
-    s, err = pcall(utf8.upper, true)
+    local _, err
+    _, err = pcall(utf8.upper, true)
     test:isnt(err:find('Usage'), nil, 'upper usage is checked')
-    s, err = pcall(utf8.lower, true)
+    _, err = pcall(utf8.lower, true)
     test:isnt(err:find('Usage'), nil, 'lower usage is checked')
 
     test:is(utf8.isupper('a'), false, 'isupper("a")')
@@ -247,9 +247,9 @@ test:test("unicode", function(test)
     test:isnil(c, 'middle of symbol offset is error')
     test:is(err, 4, 'error on 4 byte')
     test:is(utf8.len(s, 5), 4, 'start 5')
-    c, err = utf8.len(s, 6)
+    _, err = utf8.len(s, 6)
     test:is(err, 6, 'error on 6 byte')
-    c, err = utf8.len(s, 0)
+    _, err = utf8.len(s, 0)
     test:is(err, 'position is out of string', 'range is out of string')
     test:is(utf8.len(s, #s), 1, 'start from the end')
     test:is(utf8.len(s, #s + 1), 0, 'position is out of string')
@@ -262,14 +262,14 @@ test:test("unicode", function(test)
     test:is(utf8.len(s, 1, -7), 4, 'end -7')
     test:is(utf8.len(s, 2, -7), 3, '[2, -7]')
     test:is(utf8.len(s, 3, -7), 2, '[3, -7]')
-    c, err = utf8.len(s, 4, -7)
+    _, err = utf8.len(s, 4, -7)
     test:is(err, 4, '[4, -7] is error - start from the middle of symbol')
     test:is(utf8.len(s, 10, -100), 0, 'it is ok to be out of str by end pos')
     test:is(utf8.len(s, 10, -10), 0, 'it is ok to swap end and start pos')
     test:is(utf8.len(''), 0, 'empty len')
     test:is(utf8.len(s, -6, -1), 3, 'pass both negative offsets')
     test:is(utf8.len(s, 3, 3), 1, "end in the middle on the same symbol as start")
-    c, err = utf8.len('a\xF4')
+    _, err = utf8.len('a\xF4')
     test:is(err, 2, "invalid unicode in the middle of the string")
 
     local chars = {}
@@ -279,11 +279,11 @@ test:test("unicode", function(test)
         table.insert(codes, code)
     end
     test:is(table.concat(chars), s, "next and char works")
-    c, err = pcall(utf8.char, 'kek')
+    _, err = pcall(utf8.char, 'kek')
     test:isnt(err:find('bad argument'), nil, 'char usage is checked')
-    c, err = pcall(utf8.next, true)
+    _, err = pcall(utf8.next, true)
     test:isnt(err:find('Usage'), nil, 'next usage is checked')
-    c, err = pcall(utf8.next, '1234', true)
+    _, err = pcall(utf8.next, '1234', true)
     test:isnt(err:find('bad argument'), nil, 'next usage is checked')
     local offset
     offset, c = utf8.next('')
@@ -338,15 +338,15 @@ test:test("unicode", function(test)
     test:is(utf8.sub(s, -2, 2), '', 'sub [-2:2]')
     test:is(utf8.sub(s, -1, 8), '8', 'sub [-1:8]')
 
-    c, err = pcall(utf8.sub)
+    _, err = pcall(utf8.sub)
     test:isnt(err:find('Usage'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, true)
+    _, err = pcall(utf8.sub, true)
     test:isnt(err:find('Usage'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, '123')
+    _, err = pcall(utf8.sub, '123')
     test:isnt(err:find('Usage'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, '123', true)
+    _, err = pcall(utf8.sub, '123', true)
     test:isnt(err:find('bad argument'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, '123', 1, true)
+    _, err = pcall(utf8.sub, '123', 1, true)
     test:isnt(err:find('bad argument'), nil, 'usage is checked')
 
     local s1 = '☢'
diff --git a/test/app-tap/tap.test.lua b/test/app-tap/tap.test.lua
index e2a78f630..0e184782a 100755
--- a/test/app-tap/tap.test.lua
+++ b/test/app-tap/tap.test.lua
@@ -11,7 +11,7 @@ local tap = require "tap"
 --
 -- Create a root test
 --
-test = tap.test("root test")
+local test = tap.test("root test")
 -- Disable stack traces for this test because Tarantool test system also
 -- checks test output.
 test.trace = false
@@ -88,7 +88,7 @@ end)
 --
 -- Subtest without callbacks.
 --
-sub2 = test:test("subtest 2")
+local sub2 = test:test("subtest 2")
     sub2:plan(1)
     sub2:ok(true, 'true in subtest')
     sub2:diag('hello from subtest')
diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
index 9f1464617..44357484b 100755
--- a/test/app-tap/tarantoolctl.test.lua
+++ b/test/app-tap/tarantoolctl.test.lua
@@ -4,7 +4,6 @@ local ffi      = require('ffi')
 local fio      = require('fio')
 local tap      = require('tap')
 local uuid     = require('uuid')
-local yaml     = require('yaml')
 local errno    = require('errno')
 local fiber    = require('fiber')
 local ok, test_run = pcall(require, 'test_run')
@@ -33,7 +32,7 @@ local function recursive_rmdir(path)
         end
     end
     if fio.rmdir(path) == false then
-        print(string.format('!!! failed to rmdir path "%s"', file))
+        print(string.format('!!! failed to rmdir path "%s"', path))
         print(string.format('!!! [errno %s]: %s', errno(), errno.strerror()))
     end
 end
@@ -51,7 +50,7 @@ int execvp(const char *file, char *const argv[]);
 ]]
 
 -- background checks
-tctlcfg_code = [[default_cfg = {
+local tctlcfg_code = [[default_cfg = {
     pid_file  = '.', wal_dir = '.', memtx_dir   = '.' ,
     vinyl_dir = '.', log  = '.', background = true,
 }
@@ -97,23 +96,14 @@ local function tctl_wait_start(dir, name)
             fiber.sleep(0.01)
         end
         ::again::
-        while true do
-            local stat, nb = pcall(require('net.box').new, path, {
-                wait_connected = true, console = true
-            })
-            if stat == false then
-                fiber.sleep(0.01)
-                goto again
-            else
-                break
-            end
-            local stat, msg = pcall(nb.eval, nb, 'require("fiber").time()')
-            if stat == false then
-                fiber.sleep(0.01)
-            else
-                break
-            end
+        local stat, _ = pcall(require('net.box').new, path, {
+            wait_connected = true, console = true
+        })
+        if stat == false then
+            fiber.sleep(0.01)
+            goto again
         end
+        return
     end
 end
 
@@ -124,8 +114,7 @@ local function tctl_wait_stop(dir, name)
     end
 end
 
-local function tctl_command(dir, cmd, args, name)
-    local pid = nil
+local function tctl_command(dir, cmd, args)
     if not fio.stat(fio.pathjoin(dir, '.tarantoolctl')) then
         create_script(dir, '.tarantoolctl', tctlcfg_code)
     end
@@ -330,7 +319,7 @@ do
     local function test_help(test, dir, cmd, e_stderr)
         local desc = dir and 'with config' or 'without config'
         dir = dir or './'
-        local res, stdout, stderr = run_command(dir, cmd)
+        local _, _, stderr = run_command(dir, cmd)
         if e_stderr ~= nil then
             if not test:ok(stderr:find(e_stderr), ("check stderr of '%s' %s"):format(cmd, desc)) then
                 print(("Expected to find '%s' in '%s'"):format(e_stderr, stderr))
@@ -385,7 +374,7 @@ do
         local command_base = 'tarantoolctl cat filler/00000000000000000000.xlog'
         local desc = args and "cat + " .. args or "cat"
         args = args and " " .. args or ""
-        local res, stdout, stderr = run_command(dir, command_base .. args)
+        local res, stdout, _ = run_command(dir, command_base .. args)
         test:is(res, 0, desc .. " result")
         test:is(select(2, stdout:gsub(delim, delim)), lc, desc .. " line count")
     end
@@ -394,7 +383,7 @@ do
         local command_base = 'tarantoolctl cat filler/00000000000000000000.snap'
         local desc = args and "cat + " .. args or "cat"
         args = args and " " .. args or ""
-        local res, stdout, stderr = run_command(dir, command_base .. args)
+        local res, stdout, _ = run_command(dir, command_base .. args)
         test:is(res, 0, desc .. " result")
         test:is(select(2, stdout:gsub(delim, delim)), lc, desc .. " line count")
     end
@@ -413,7 +402,8 @@ do
             check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system", "\n", 3)
             check_ctlcat_xlog(test_i, dir, "--from=6 --to=3 --format=json --show-system", "\n", 0)
             check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system --replica 1", "\n", 3)
-            check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system --replica 1 --replica 2", "\n", 3)
+            check_ctlcat_xlog(test_i, dir,
+		"--from=3 --to=6 --format=json --show-system --replica 1 --replica 2", "\n", 3)
             check_ctlcat_xlog(test_i, dir, "--from=3 --to=6 --format=json --show-system --replica 2", "\n", 0)
             check_ctlcat_snap(test_i, dir, "--space=280", "---\n", 25)
             check_ctlcat_snap(test_i, dir, "--space=288", "---\n", 53)
@@ -475,10 +465,10 @@ else
             check_ok(test_i, dir, 'start', 'filler', 0)
             local lsn_before = test_run:get_lsn("remote", 1)
             test_i:is(lsn_before, 4, "check lsn before")
-            local res, stdout, stderr = run_command(dir, command_base)
+            local res, _, _ = run_command(dir, command_base)
             test_i:is(res, 0, "execution result")
             test_i:is(test_run:get_lsn("remote", 1), 10, "check lsn after")
-            local res, stdout, stderr = run_command(dir, command_base)
+            local res, _, _ = run_command(dir, command_base)
             test_i:is(res, 0, "execution result")
             test_i:is(test_run:get_lsn("remote", 1), 16, "check lsn after")
         end)
@@ -618,7 +608,7 @@ test:test('filter_xlog', function(test)
     local tarantoolctl = dofile(TARANTOOLCTL_PATH)
 
     -- Like xlog.pairs().
-    local function gen(param, lsn)
+    local function gen(param)
         local row = param.data[param.idx]
         if row == nil then
             return
diff --git a/test/app-tap/trigger.test.lua b/test/app-tap/trigger.test.lua
index a31d45e5f..6cf3fbe53 100755
--- a/test/app-tap/trigger.test.lua
+++ b/test/app-tap/trigger.test.lua
@@ -45,7 +45,7 @@ test:test("simple trigger test", function(test)
 
 
     -- Check that we've failed to delete trigger
-    local stat, err = pcall(getmetatable(trigger_list).__call, trigger_list,
+    local _, err = pcall(getmetatable(trigger_list).__call, trigger_list,
                             nil, trigger_cnt)
     test:ok(string.find(err, "is not found"), "check error")
 end)
@@ -69,18 +69,18 @@ test:test("errored trigger test", function(test)
     test:is(cnt, 1, "check simple trigger")
     -- Append errored trigger
     trigger_list(trigger_errored)
-    local status = pcall(function() trigger_list:run() end)
+    pcall(function() trigger_list:run() end)
     test:is(cnt, 2, "check simple+error trigger")
     -- Flush triggers
     table_clear(trigger_list)
     test:is(#trigger_list(), 0, "successfull flush")
     -- Append first trigger
     trigger_list(trigger_errored)
-    local status = pcall(function() trigger_list:run() end)
+    pcall(function() trigger_list:run() end)
     test:is(cnt, 2, "check error trigger")
     -- Append errored trigger
     trigger_list(trigger_cnt)
-    local status = pcall(function() trigger_list:run() end)
+    pcall(function() trigger_list:run() end)
     test:is(cnt, 2, "check error+simple trigger")
 end)
 
diff --git a/test/app-tap/yaml.test.lua b/test/app-tap/yaml.test.lua
index 4669b6102..8a5e4b233 100755
--- a/test/app-tap/yaml.test.lua
+++ b/test/app-tap/yaml.test.lua
@@ -37,8 +37,6 @@ local function test_compact(test, s)
         "---\n- {'k': 'v'}\n...\n", "flow map")
     test:is(getmetatable(ss.decode(ss.encode({k = 'v'}))).__serialize, "map",
         "decoded __serialize is map")
-
-    ss = nil
 end
 
 local function test_output(test, s)
@@ -83,11 +81,11 @@ local function test_tagged(test, s)
     -- Test encoding tags.
     --
     local prefix = 'tag:tarantool.io/push,2018'
-    local ok, err = pcall(s.encode, 200, {tag_handle = true, tag_prefix = 100})
+    local _, err = pcall(s.encode, 200, {tag_handle = true, tag_prefix = 100})
     test:isnt(err:find('Usage'), nil, "encode usage")
-    ok, err = pcall(s.encode, 100, {tag_handle = 'handle'})
+    _, err = pcall(s.encode, 100, {tag_handle = 'handle'})
     test:isnt(err:find('Usage'), nil, "encode usage, no prefix")
-    ok, err = pcall(s.encode, 100, {tag_prefix = 'prefix'})
+    _, err = pcall(s.encode, 100, {tag_prefix = 'prefix'})
     test:isnt(err:find('Usage'), nil, "encode usage, no handle")
     local ret
     ret, err = s.encode(300, {tag_handle = '!push', tag_prefix = prefix})
@@ -100,9 +98,9 @@ local function test_tagged(test, s)
     --
     -- Test decoding tags.
     --
-    ok, err = pcall(s.decode)
+    _, err = pcall(s.decode)
     test:isnt(err:find('Usage'), nil, "decode usage")
-    ok, err = pcall(s.decode, false)
+    _, err = pcall(s.decode, false)
     test:isnt(err:find('Usage'), nil, "decode usage")
     local handle, prefix = s.decode(ret, {tag_only = true})
     test:is(handle, "!print!", "handle is decoded ok")
@@ -114,7 +112,7 @@ local function test_tagged(test, s)
 - 100
 ...
 ]]
-    ok, err = s.decode(several_tags, {tag_only = true})
+    local ok, err = s.decode(several_tags, {tag_only = true})
     test:is(ok, nil, "can not decode multiple tags")
     test:is(err, "can not decode multiple tags", "same")
     local no_tags = s.encode(100)
diff --git a/test/app-tap/yield-in-gc-finalizer.test.lua b/test/app-tap/yield-in-gc-finalizer.test.lua
index a7e173721..a434339df 100755
--- a/test/app-tap/yield-in-gc-finalizer.test.lua
+++ b/test/app-tap/yield-in-gc-finalizer.test.lua
@@ -29,8 +29,7 @@ local test = ffi.metatype('struct test', {
   __gc = function() fiber.yield() end,
 })
 
-local t = test(9)
-t = nil
+test(9)
 
 -- This call leads to the platform panic.
 collectgarbage('collect')
-- 
2.25.1



More information about the Tarantool-patches mailing list