Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck
@ 2020-07-16 14:11 sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 01/19] Fix luacheck warnings in test/app-tap sergeyb
                   ` (21 more replies)
  0 siblings, 22 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

From: Sergey Bronnikov <sergeyb@tarantool.org>

Note: patch series for test/ was already sent to list in a thread with
static analysis for src/ and extra/. Igor M. started to review it there, see
[1], and then in private discussion we decided to split changes for
test/ and {src/,extra/} for two different patch series. As changes for src/ and
extra/ has been merged to master [2] I have rebased existed changes for
test/, applied changes suggested by Igor in the initial review and
reverted changes for warnings supressed globally in .luacheckrc.

1. https://lists.tarantool.org/pipermail/tarantool-patches/2020-June/017301.html
2. https://lists.tarantool.org/pipermail/tarantool-patches/2020-July/018568.html

Changelog v2:

- reverted changes for diff-based tests
- reverted changes for suppressed warnings
- format .luacheckrc according to Lua style guide
- created GH issue for every ignored warning in a separated files
- make each commit atomic again - all changes in commits are related to
commit itself, not other commits

GH issue: https://github.com/tarantool/tarantool/issues/4681
GitHub branch: https://github.com/tarantool/tarantool/tree/ligurio/gh-4681-fix-luacheck-warnings-test
CI: https://gitlab.com/tarantool/tarantool/-/pipelines/167419608

Sergey Bronnikov (19):
  Fix luacheck warnings in test/app-tap
  Fix luacheck warnings in test/app
  Fix luacheck warnings in test/box
  Fix luacheck warnings in test/box-py
  Fix luacheck warnings in test/box-tap
  Fix luacheck warnings in test/engine
  Fix luacheck warnings in test/engine_long
  Fix luacheck warnings in test/long_run-py
  Fix luacheck warnings in test/replication
  Fix luacheck warnings in test/replication-py
  Fix luacheck warnings in test/sql
  Fix luacheck warnings in test/sql-tap
  Fix luacheck warnings in test/swim
  Fix luacheck warnings in test/vinyl
  Fix luacheck warnings in test/wal_off
  Fix luacheck warnings in test/xlog
  Fix luacheck warnings in test/xlog-py
  Add luacheck supression for luajit test
  luajit: bump new version

 .luacheckrc                                   | 195 ++++++-
 test/app-tap/cfg.test.lua                     |   2 +-
 test/app-tap/clock.test.lua                   |   4 +-
 test/app-tap/console.test.lua                 |  14 +-
 test/app-tap/console_lua.test.lua             |  18 +-
 test/app-tap/csv.test.lua                     |  56 +-
 test/app-tap/debug.test.lua                   |  10 +-
 test/app-tap/errno.test.lua                   |  24 +-
 test/app-tap/fail_main.test.lua               |   6 +-
 .../gh-4761-json-per-call-options.test.lua    |  11 +-
 test/app-tap/http_client.test.lua             | 297 +++++------
 test/app-tap/iconv.test.lua                   |   6 +-
 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                  |  23 +-
 test/app-tap/lua/serializer_test.lua          |  46 +-
 test/app-tap/minimal.test.lua                 |   4 +-
 test/app-tap/module_api.test.lua              |  12 +-
 test/app-tap/msgpackffi.test.lua              |   3 +-
 test/app-tap/pcall.test.lua                   |   6 +-
 test/app-tap/popen.test.lua                   |  35 +-
 test/app-tap/snapshot.test.lua                |  17 +-
 test/app-tap/string.test.lua                  | 502 +++++++++---------
 test/app-tap/tap.test.lua                     |  26 +-
 test/app-tap/tarantoolctl.test.lua            |  82 ++-
 test/app-tap/trigger.test.lua                 |  48 +-
 test/app-tap/yaml.test.lua                    |  16 +-
 test/box-py/box.lua                           |   2 +-
 test/box-tap/auth.test.lua                    |  20 +-
 test/box-tap/cfg.test.lua                     |  34 +-
 test/box-tap/cfgup.test.lua                   |   4 +-
 test/box-tap/extended_error.test.lua          |  11 +-
 test/box-tap/feedback_daemon.test.lua         |   4 +-
 test/box-tap/gc.test.lua                      |   4 +-
 test/box-tap/on_schema_init.test.lua          |   4 +-
 test/box-tap/schema_mt.test.lua               |  22 +-
 test/box-tap/session.storage.test.lua         |  10 +-
 test/box-tap/session.test.lua                 |  56 +-
 test/box-tap/trigger_atexit.test.lua          |  10 +-
 test/box-tap/trigger_yield.test.lua           |  10 +-
 test/box/box.lua                              |   7 +-
 test/box/lua/bitset.lua                       |   7 +-
 test/box/lua/cfg_bad_vinyl_dir.lua            |   2 +-
 test/box/lua/cfg_rtree.lua                    |   2 +-
 test/box/lua/cfg_test1.lua                    |   2 +-
 test/box/lua/cfg_test2.lua                    |   2 +-
 test/box/lua/cfg_test3.lua                    |   2 +-
 test/box/lua/cfg_test4.lua                    |   2 +-
 test/box/lua/cfg_test5.lua                    |   2 +-
 test/box/lua/cfg_test6.lua                    |   2 +-
 test/box/lua/fifo.lua                         |   2 +-
 test/box/lua/identifier.lua                   |   9 +-
 test/box/lua/index_random_test.lua            |   2 +-
 test/box/lua/utils.lua                        |  10 +-
 test/box/on_schema_init.lua                   |   8 +-
 test/box/proxy.lua                            |   2 +-
 test/box/tiny.lua                             |   2 +-
 test/engine/box.lua                           |   8 +-
 test/engine/conflict.lua                      |   6 +-
 test/engine_long/suite.lua                    |   5 +-
 test/long_run-py/lua/finalizers.lua           |   7 +-
 test/long_run-py/suite.lua                    |   7 +-
 test/replication-py/master.lua                |   2 +-
 test/replication-py/panic.lua                 |   2 +-
 test/replication-py/replica.lua               |   4 -
 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 +-
 test/sql-tap/alter.test.lua                   |   4 +-
 test/sql-tap/analyze5.test.lua                |   2 +-
 test/sql-tap/analyze9.test.lua                |  22 +-
 test/sql-tap/between.test.lua                 |   4 +-
 test/sql-tap/date.test.lua                    |   3 +-
 test/sql-tap/delete1.test.lua                 |   2 +-
 test/sql-tap/e_delete.test.lua                |   2 +-
 test/sql-tap/e_expr.test.lua                  |  11 +-
 test/sql-tap/func.test.lua                    |   2 +-
 test/sql-tap/func3.test.lua                   |   2 +-
 test/sql-tap/gh-2723-concurrency.test.lua     |   8 +-
 .../gh-3083-ephemeral-unref-tuples.test.lua   |   2 +-
 .../gh-3307-xfer-optimization-issue.test.lua  |   2 +-
 .../gh-3332-tuple-format-leak.test.lua        |   2 +-
 .../gh2127-indentifier-max-length.test.lua    |  10 +-
 test/sql-tap/identifier-characters.test.lua   |   2 +-
 test/sql-tap/index1.test.lua                  |   3 +-
 test/sql-tap/index7.test.lua                  |   2 +-
 test/sql-tap/join3.test.lua                   |   2 +-
 test/sql-tap/lua-tables.test.lua              |   2 +-
 test/sql-tap/lua/sqltester.lua                |  11 +-
 test/sql-tap/misc1.test.lua                   |  10 +-
 test/sql-tap/misc5.test.lua                   |   2 +-
 test/sql-tap/select1.test.lua                 |  10 +-
 test/sql-tap/select2.test.lua                 |   8 +-
 test/sql-tap/select4.test.lua                 |   1 -
 test/sql-tap/select5.test.lua                 |   1 -
 test/sql-tap/select9.test.lua                 |  12 +-
 test/sql-tap/selectA.test.lua                 |   8 +-
 test/sql-tap/selectB.test.lua                 |  14 +-
 test/sql-tap/selectG.test.lua                 |   1 -
 test/sql-tap/sort.test.lua                    |   2 +-
 test/sql-tap/sql-errors.test.lua              |   2 +-
 test/sql-tap/table.test.lua                   |   3 +-
 test/sql-tap/tkt-38cb5df375.test.lua          |   1 -
 test/sql-tap/tkt-91e2e8ba6f.test.lua          |   3 -
 test/sql-tap/tkt-9a8b09f8e6.test.lua          |   3 -
 test/sql-tap/tkt-bd484a090c.test.lua          |   3 +-
 test/sql-tap/tkt2192.test.lua                 |   3 +-
 test/sql-tap/tkt3493.test.lua                 |   3 -
 test/sql-tap/trigger2.test.lua                |   4 +-
 test/sql-tap/triggerA.test.lua                |   1 -
 test/sql-tap/where2.test.lua                  |   9 +-
 test/sql-tap/where3.test.lua                  |   2 +-
 test/sql-tap/where4.test.lua                  |   4 +-
 test/sql-tap/where5.test.lua                  |   2 +-
 test/sql-tap/where6.test.lua                  |   2 +-
 test/sql-tap/where7.test.lua                  |  16 +-
 test/sql-tap/whereA.test.lua                  |   2 +-
 test/sql-tap/whereB.test.lua                  |   2 +-
 test/sql-tap/whereC.test.lua                  |   5 +-
 test/sql-tap/whereD.test.lua                  |   4 +-
 test/sql-tap/whereF.test.lua                  |   4 +-
 test/sql-tap/whereG.test.lua                  |   4 +-
 test/sql-tap/whereI.test.lua                  |   4 +-
 test/sql-tap/whereK.test.lua                  |   4 +-
 test/sql-tap/with1.test.lua                   |  14 +-
 test/sql-tap/with2.test.lua                   |  18 +-
 test/sql/lua/sql_tokenizer.lua                |   2 +-
 test/swim/box.lua                             |   4 +-
 test/vinyl/large.lua                          |   3 +-
 test/vinyl/stress.lua                         |  22 +-
 test/vinyl/txn_proxy.lua                      |   6 +-
 test/vinyl/upgrade/fill.lua                   |   8 +-
 test/vinyl/vinyl.lua                          |  17 -
 test/xlog-py/box.lua                          |   2 +-
 test/xlog/panic.lua                           |   2 +-
 .../2.1.3/gh-4771-upgrade-sequence/fill.lua   |  12 +-
 test/xlog/xlog.lua                            |   2 +-
 third_party/luajit                            |   2 +-
 143 files changed, 1135 insertions(+), 1051 deletions(-)

-- 
2.26.2

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

* [Tarantool-patches] [PATCH 01/19] Fix luacheck warnings in test/app-tap
  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 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 02/19] Fix luacheck warnings in test/app sergeyb
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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                                   |  26 +-
 test/app-tap/cfg.test.lua                     |   2 +-
 test/app-tap/clock.test.lua                   |   4 +-
 test/app-tap/console.test.lua                 |  14 +-
 test/app-tap/console_lua.test.lua             |  18 +-
 test/app-tap/csv.test.lua                     |  56 +-
 test/app-tap/debug.test.lua                   |  10 +-
 test/app-tap/errno.test.lua                   |  24 +-
 test/app-tap/fail_main.test.lua               |   6 +-
 .../gh-4761-json-per-call-options.test.lua    |  11 +-
 test/app-tap/http_client.test.lua             | 297 +++++------
 test/app-tap/iconv.test.lua                   |   6 +-
 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                  |  23 +-
 test/app-tap/lua/serializer_test.lua          |  46 +-
 test/app-tap/minimal.test.lua                 |   4 +-
 test/app-tap/module_api.test.lua              |  12 +-
 test/app-tap/msgpackffi.test.lua              |   3 +-
 test/app-tap/pcall.test.lua                   |   6 +-
 test/app-tap/popen.test.lua                   |  35 +-
 test/app-tap/snapshot.test.lua                |  17 +-
 test/app-tap/string.test.lua                  | 502 +++++++++---------
 test/app-tap/tap.test.lua                     |  26 +-
 test/app-tap/tarantoolctl.test.lua            |  82 ++-
 test/app-tap/trigger.test.lua                 |  48 +-
 test/app-tap/yaml.test.lua                    |  16 +-
 28 files changed, 653 insertions(+), 663 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 994d29956..4055b0994 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,23 @@ exclude_files = {
     -- Third-party source code.
     "src/box/lua/serpent.lua",
     "test-run/**/*.lua",
-    "test/**/*.lua",
+    "test/app/**/*.lua",
+    "test/box/**/*.lua",
+    "test/box-py/**/*.lua",
+    "test/box-tap/**/*.lua",
+    "test/engine/**/*.lua",
+    "test/engine_long/*.lua",
+    "test/long_run-py/**/*.lua",
+    "test/replication/**/*.lua",
+    "test/replication-py/**/*.lua",
+    "test/sql-tap/**/*.lua",
+    "test/sql/**/*.lua",
+    "test/swim/**/*.lua",
+    "test/var/**/*.lua",
+    "test/vinyl/**/*.lua",
+    "test/wal_off/*.lua",
+    "test/xlog/**/*.lua",
+    "test/xlog-py/**/*.lua",
     "third_party/**/*.lua",
     ".rocks/**/*.lua",
     ".git/**/*.lua",
@@ -57,3 +75,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..14e040f9f 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..0d8cc917a 100755
--- a/test/app-tap/console.test.lua
+++ b/test/app-tap/console.test.lua
@@ -5,7 +5,6 @@ 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')
 
@@ -19,7 +18,8 @@ os.remove(IPROTO_SOCKET)
 --
 local EOL = "\n...\n"
 
-test = tap.test("console")
+local test = tap.test("console")
+local _
 
 test:plan(78)
 
@@ -59,7 +59,8 @@ test:is(client:read(";"), 'true;', "pushed message")
 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,14 +223,14 @@ 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')
 s:close()
 
 local s = console.listen('console://unix/:'..CONSOLE_SOCKET)
-addr = s:name()
+local addr = s:name()
 test:is(addr.family, 'AF_UNIX', 'console.listen uri support')
 test:is(addr.host, 'unix/', 'console.listen uri support')
 test:is(addr.port, CONSOLE_SOCKET, 'console.listen uri support')
diff --git a/test/app-tap/console_lua.test.lua b/test/app-tap/console_lua.test.lua
index dbfc3da11..b18cb7724 100755
--- a/test/app-tap/console_lua.test.lua
+++ b/test/app-tap/console_lua.test.lua
@@ -57,8 +57,8 @@ end
 
 --
 -- Execute a list of statements, show requests and responses.
-local function execute_statements(test, client, statements, name)
-    test:test(name, function(test)
+local function execute_statements(testcase, client, statements, name)
+    testcase:test(name, function(test)
         test:plan(2 * #statements)
 
         for _, stmt in ipairs(statements) do
@@ -75,8 +75,8 @@ end
 
 --
 -- Execute a statement and verify its response.
-local function execute_and_verify(test, client, input, exp_output, name)
-    test:test(name, function(test)
+local function execute_and_verify(testcase, client, input, exp_output, name)
+    testcase:test(name, function(test)
         test:plan(2)
 
         local res = client:write(input .. '\n')
@@ -149,15 +149,15 @@ test:plan(#cases)
 local server, client = start_console()
 
 for _, case in ipairs(cases) do
-    test:test(case.name, function(test)
-        test:plan(3)
+    test:test(case.name, function(testcase)
+        testcase:plan(3)
 
-        execute_statements(test, client, totable(case.prepare), 'prepare')
+        execute_statements(testcase, client, totable(case.prepare), 'prepare')
 
         set_lua_output(client, case.opts)
-        execute_and_verify(test, client, case.input, case.expected, 'run')
+        execute_and_verify(testcase, client, case.input, case.expected, 'run')
 
-        execute_statements(test, client, totable(case.cleanup), 'cleanup')
+        execute_statements(testcase, client, totable(case.cleanup), 'cleanup')
     end)
 end
 
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/debug.test.lua b/test/app-tap/debug.test.lua
index 0d199e55b..0f9b881f0 100755
--- a/test/app-tap/debug.test.lua
+++ b/test/app-tap/debug.test.lua
@@ -44,7 +44,7 @@ print(('debug.sourcefile() => %s; %s'):format(tostring(result), tostring(err)))
 assert(result == box.NULL, 'debug.sourcefile() returns box.NULL')
 assert(err == nil, 'debug.sourcefile() returns no error')
 
-local result, err = conn:call('debug.sourcedir')
+result, err = conn:call('debug.sourcedir')
 print(('debug.sourcedir() => %s; %s'):format(tostring(result), tostring(err)))
 assert(result == '.', 'debug.sourcedir() returns "."')
 assert(err == nil, 'debug.sourcedir() returns no error')
@@ -58,10 +58,10 @@ print('When running lua code from console')
 print('==================================')
 -- debug.sourcefile() returns cwd when running within console
 for _, test in ipairs(tests) do
-    local cmd = string.format('%s -e "%s; os.exit(0)"', TNTBIN, test)
-    print('Exec: '..cmd)
+    local cmdline = string.format('%s -e "%s; os.exit(0)"', TNTBIN, test)
+    print('Exec: '..cmdline)
     io.flush()
-    assert(os.execute(cmd) == 0, string.format('cmd: "%s" must execute successfully', cmd))
+    assert(os.execute(cmdline) == 0, string.format('cmd: "%s" must execute successfully', cmdline))
 end
 
 local fio = require('fio')
@@ -74,7 +74,7 @@ if not dirstat then
 end
 assert(dirstat:is_dir(), dirname..' must be a directory')
 
-local cmd = TNTBIN..' '..filename
+cmd = TNTBIN..' '..filename
 print('======================================')
 print('When running lua code from script file')
 print('======================================')
diff --git a/test/app-tap/errno.test.lua b/test/app-tap/errno.test.lua
index 5fd8eaca4..41f8c7d15 100755
--- a/test/app-tap/errno.test.lua
+++ b/test/app-tap/errno.test.lua
@@ -6,16 +6,16 @@ local errno = require('errno')
 local test = tap.test("errno")
 
 test:plan(1)
-test:test("primary", function(test)
-    test:plan(10)
-    test:is(type(errno), "table", "type of table")
-    test:ok(errno.EINVAL ~= nil, "errno.EINVAL is available")
-    test:ok(errno.EBADF ~= nil , "errno.EBADF is available" )
-    test:ok(errno(0) ~= nil, "errno set to 0")
-    test:is(errno(errno.EBADF), 0, "setting errno.EBADF")
-    test:is(errno(), errno.EBADF, "checking errno.EBADF")
-    test:is(errno(errno.EINVAL), errno.EBADF, "setting errno.EINVAL")
-    test:is(errno(), errno.EINVAL, "checking errno.EINVAL")
-    test:is(errno.strerror(), "Invalid argument", "checking strerror without argument")
-    test:is(errno.strerror(errno.EBADF), "Bad file descriptor", "checking strerror with argument")
+test:test("primary", function(testcase)
+    testcase:plan(10)
+    testcase:is(type(errno), "table", "type of table")
+    testcase:ok(errno.EINVAL ~= nil, "errno.EINVAL is available")
+    testcase:ok(errno.EBADF ~= nil , "errno.EBADF is available" )
+    testcase:ok(errno(0) ~= nil, "errno set to 0")
+    testcase:is(errno(errno.EBADF), 0, "setting errno.EBADF")
+    testcase:is(errno(), errno.EBADF, "checking errno.EBADF")
+    testcase:is(errno(errno.EINVAL), errno.EBADF, "setting errno.EINVAL")
+    testcase:is(errno(), errno.EINVAL, "checking errno.EINVAL")
+    testcase:is(errno.strerror(), "Invalid argument", "checking strerror without argument")
+    testcase:is(errno.strerror(errno.EBADF), "Bad file descriptor", "checking strerror with argument")
 end)
diff --git a/test/app-tap/fail_main.test.lua b/test/app-tap/fail_main.test.lua
index f8c45bf6f..3fe0971eb 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'},
@@ -16,7 +16,7 @@ function run_script(code)
     script:close()
     local output_file = fio.pathjoin(fio.cwd(), 'out.txt')
     local cmd = [[/bin/sh -c 'cd "%s" && "%s" ./script.lua 0> %s 2> %s']]
-    local code = os.execute(
+    code = os.execute(
         string.format(cmd, dir, tarantool_bin, output_file, output_file)
     )
     fio.rmtree(dir)
@@ -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..bd710b76f 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,23 +13,24 @@ 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')
 
     -- Verify that the instance option remains unchanged.
     local exp_res = {foo = {bar = 1}}
-    local ok, res = pcall(json.decode, '{"foo": {"bar": 1}}')
+    local res
+    ok, res = pcall(json.decode, '{"foo": {"bar": 1}}')
     test:is_deeply({ok, res}, {true, exp_res},
                    'json instance settings remain unchanged after :decode()')
 
     -- Same check for json.encode.
     local nan = 1/0
-    local ok, err = pcall(json.encode, {a = nan},
+    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}'
-    local ok, res = pcall(json.encode, {a = nan})
+    exp_res = '{"a":inf}'
+    ok, res = pcall(json.encode, {a = nan})
     test:is_deeply({ok, res}, {true, exp_res},
                    'json instance settings remain unchanged after :encode()')
 end)
diff --git a/test/app-tap/http_client.test.lua b/test/app-tap/http_client.test.lua
index b85b605cf..b44876b39 100755
--- a/test/app-tap/http_client.test.lua
+++ b/test/app-tap/http_client.test.lua
@@ -22,8 +22,8 @@ local function merge(...)
     return res
 end
 
-local function start_server(test, sock_family, sock_addr)
-    test:diag("starting HTTP server on %s...", sock_addr)
+local function start_server(testcase, sock_family, sock_addr)
+    testcase:diag("starting HTTP server on %s...", sock_addr)
     local arg, url, opts
     if sock_family == 'AF_INET' then
         arg = string.format("--inet %s", sock_addr)
@@ -39,51 +39,51 @@ local function start_server(test, sock_family, sock_addr)
     local cmd = string.format("%s/test/app-tap/httpd.py %s",
                               TARANTOOL_SRC_DIR, arg)
     local server = io.popen(cmd)
-    test:is(server:read("*l"), "heartbeat", "server started")
-    test:diag("trying to connect to %s", url)
+    testcase:is(server:read("*l"), "heartbeat", "server started")
+    testcase: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
         end
         fiber.sleep(0.01)
     end
-    test:is(r.status, 200, "connection is ok")
+    testcase:is(r.status, 200, "connection is ok")
     if r.status ~= 200 then
         os.exit(1)
     end
     return server, url, opts
 end
 
-local function stop_server(test, server)
-    test:diag("stopping HTTP server")
+local function stop_server(testcase, server)
+    testcase:diag("stopping HTTP server")
     server:close()
 end
 
-local function test_http_client(test, url, opts)
-    test:plan(11)
+local function test_http_client(testcase, url, opts)
+    testcase:plan(11)
 
     -- gh-4136: confusing httpc usage error message
     local ok, err = pcall(client.request, client)
     local usage_err = "request(method, url[, body, [options]])"
-    test:is_deeply({ok, err:split(': ')[2]}, {false, usage_err},
+    testcase:is_deeply({ok, err:split(': ')[2]}, {false, usage_err},
                    "test httpc usage error")
 
-    test:isnil(rawget(_G, 'http'), "global namespace is not polluted");
-    test:isnil(rawget(_G, 'http.client'), "global namespace is not polluted");
+    testcase:isnil(rawget(_G, 'http'), "global namespace is not polluted");
+    testcase:isnil(rawget(_G, 'http.client'), "global namespace is not polluted");
     local r = client.get(url, opts)
-    test:is(r.status, 200, 'simple 200')
-    test:is(r.reason, 'Ok', '200 - Ok')
-    test:is(r.proto[1], 1, 'proto major http 1.1')
-    test:is(r.proto[2], 1, 'proto major http 1.1')
-    test:ok(r.body:match("hello") ~= nil, "body")
-    test:ok(tonumber(r.headers["content-length"]) > 0,
+    testcase:is(r.status, 200, 'simple 200')
+    testcase:is(r.reason, 'Ok', '200 - Ok')
+    testcase:is(r.proto[1], 1, 'proto major http 1.1')
+    testcase:is(r.proto[2], 1, 'proto major http 1.1')
+    testcase:ok(r.body:match("hello") ~= nil, "body")
+    testcase:ok(tonumber(r.headers["content-length"]) > 0,
         "content-length > 0")
-    test:is(client.get("http://localhost:1/").status, 595, 'cannot connect')
+    testcase:is(client.get("http://localhost:1/").status, 595, 'cannot connect')
 
-    local r = client.request('GET', url, nil, opts)
-    test:is(r.status, 200, 'request')
+    r = client.request('GET', url, nil, opts)
+    testcase:is(r.status, 200, 'request')
 
     -- XXX: enable after resolving of gh-4180: httpc: redirects
     -- are broken with libcurl-7.30 and older
@@ -118,36 +118,36 @@ end
 -- gh-3955: Check that httpc module doesn't redefine http headers
 --          set explicitly by the caller.
 --
-local function test_http_client_headers_redefine(test, url, opts)
-    test:plan(9)
-    local opts = table.deepcopy(opts)
+local function test_http_client_headers_redefine(testcase, url, opts)
+    testcase:plan(9)
+    opts = table.deepcopy(opts)
     -- Test defaults
     opts.headers = {['Connection'] = nil, ['Accept'] = nil}
     local r = client.post(url, nil, opts)
-    test:is(r.status, 200, 'simple 200')
-    test:is(r.headers['connection'], 'close', 'Default Connection header')
-    test:is(r.headers['accept'], '*/*', 'Default Accept header for POST request')
+    testcase:is(r.status, 200, 'simple 200')
+    testcase:is(r.headers['connection'], 'close', 'Default Connection header')
+    testcase:is(r.headers['accept'], '*/*', 'Default Accept header for POST request')
     -- Test that in case of conflicting headers, user variant is
     -- prefered
     opts.headers={['Connection'] = 'close'}
     opts.keepalive_idle = 2
     opts.keepalive_interval = 1
-    local r = client.get(url, opts)
-    test:is(r.status, 200, 'simple 200')
-    test:is(r.headers['connection'], 'close', 'Redefined Connection header')
-    test:is(r.headers['keep_alive'], 'timeout=2',
+    r = client.get(url, opts)
+    testcase:is(r.status, 200, 'simple 200')
+    testcase:is(r.headers['connection'], 'close', 'Redefined Connection header')
+    testcase:is(r.headers['keep_alive'], 'timeout=2',
             'Automatically set Keep-Alive header')
     -- Test that user-defined Connection and Acept headers
     -- are used
     opts.headers={['Connection'] = 'Keep-Alive', ['Accept'] = 'text/html'}
-    local r = client.get(url, opts)
-    test:is(r.status, 200, 'simple 200')
-    test:is(r.headers['accept'], 'text/html', 'Redefined Accept header')
-    test:is(r.headers['connection'], 'Keep-Alive', 'Redefined Connection header')
+    r = client.get(url, opts)
+    testcase:is(r.status, 200, 'simple 200')
+    testcase:is(r.headers['accept'], 'text/html', 'Redefined Accept header')
+    testcase:is(r.headers['connection'], 'Keep-Alive', 'Redefined Connection header')
 end
 
-local function test_cancel_and_errinj(test, url, opts)
-    test:plan(3)
+local function test_cancel_and_errinj(testcase, url, opts)
+    testcase:plan(3)
     local ch = fiber.channel(1)
     local http = client:new()
     local func  = function(fopts)
@@ -156,31 +156,30 @@ local function test_cancel_and_errinj(test, url, opts)
     local f = fiber.create(func, opts)
     f:cancel()
     local r = ch:get()
-    test:ok(r.status == 408 and string.find(r.reason, "Timeout"),
+    testcase:ok(r.status == 408 and string.find(r.reason, "Timeout"),
                     "After cancel fiber timeout is returned")
     r = http:get(url, merge(opts, {timeout = 0.0001}))
-    test:ok(r.status == 408 and string.find(r.reason, "Timeout"),
+    testcase:ok(r.status == 408 and string.find(r.reason, "Timeout"),
                                                        "Timeout check")
     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")
+    testcase:is(r.status, 200, "No hangs in errinj")
     errinj.set('ERRINJ_HTTP_RESPONSE_ADD_WAIT', false)
 end
 
-local function test_post_and_get(test, url, opts)
-    test:plan(21)
+local function test_post_and_get(testcase, url, opts)
+    testcase:plan(21)
 
     local http = client.new()
-    test:ok(http ~= nil, "client is created")
+    testcase:ok(http ~= nil, "client is created")
 
     local headers = { header1 = "1", header2 = "2" }
     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,70 +212,69 @@ 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
-    test:is(r.status, 200, "GET: default http code page exists")
-    test:is(r.body, "hello world", "GET: default right body")
+    testcase:is(r.status, 200, "GET: default http code page exists")
+    testcase:is(r.body, "hello world", "GET: default right body")
 
     r = responses.get2
-    test:is(r.status, 200, "GET: http code page exists")
-    test:is(r.body, "abc", "GET: right body")
+    testcase:is(r.status, 200, "GET: http code page exists")
+    testcase:is(r.body, "abc", "GET: right body")
 
     r = responses.absent_get
-    test:is(r.status, 500, "GET: absent method http code page exists")
-    test:is(r.reason, 'Unknown', '500 - Unknown')
-    test:is(r.body, "No such method", "GET: absent method right body")
+    testcase:is(r.status, 500, "GET: absent method http code page exists")
+    testcase:is(r.reason, 'Unknown', '500 - Unknown')
+    testcase:is(r.body, "No such method", "GET: absent method right body")
 
     r = responses.empty_post
-    test:is(r.status, 200, "POST: good status")
-    test:ok(r.headers['header1'] == headers.header1 and
+    testcase:is(r.status, 200, "POST: good status")
+    testcase:ok(r.headers['header1'] == headers.header1 and
         r.headers['header2'] == headers.header2, "POST: good headers")
-    test:isnil(r.body, "POST: empty body")
+    testcase:isnil(r.body, "POST: empty body")
 
     r = responses.good_post
-    test:is(r.status, 200, "POST: good status")
-    test:ok(r.headers['header1'] == headers.header1 and
+    testcase:is(r.status, 200, "POST: good status")
+    testcase:ok(r.headers['header1'] == headers.header1 and
         r.headers['header2'] == headers.header2, "POST: good headers")
-    test:is(r.body, json_body, "POST: body")
+    testcase:is(r.body, json_body, "POST: body")
 
     r = responses.good_put
-    test:is(r.status, 200, "PUT: good status")
-    test:ok(r.headers['header'] == headers.header and
+    testcase:is(r.status, 200, "PUT: good status")
+    testcase:ok(r.headers['header'] == headers.header and
         r.headers['header2'] == headers.header2, "PUT: good headers")
 
     r = responses.bad_get
-    test:is(r.status, 404, "GET: http page not exists")
-    test:is(r.reason, 'Unknown', '404 - Unknown')
-    test:isnt(r.body:len(), 0, "GET: not empty body page not exists")
-    test:ok(string.find(r.body, "Not Found"),
+    testcase:is(r.status, 404, "GET: http page not exists")
+    testcase:is(r.reason, 'Unknown', '404 - Unknown')
+    testcase:isnt(r.body:len(), 0, "GET: not empty body page not exists")
+    testcase:ok(string.find(r.body, "Not Found"),
                 "GET: right body page not exists")
 
     local st = http:stat()
-    test:ok(st.sockets_added == st.sockets_deleted and
+    testcase:ok(st.sockets_added == st.sockets_deleted and
         st.active_requests == 0,
         "stats checking")
 end
 
-local function test_errors(test)
-    test:plan(2)
+local function test_errors(testcase)
+    testcase:plan(2)
     local http = client:new()
     local status, err = pcall(http.get, http, "htp://mail.ru")
-    test:ok(not status and string.find(json.encode(err),
+    testcase:ok(not status and string.find(json.encode(err),
                         "Unsupported protocol"),
                         "GET: exception on bad protocol")
     status, err = pcall(http.post, http, "htp://mail.ru", "")
-    test:ok(not status and string.find(json.encode(err),
+    testcase: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.
 -- gh-4281 Check that opts.headers can be a table and opts.headers
 -- keys can be strings only.
-local function test_request_headers(test, url, opts)
+local function test_request_headers(testcase, url, opts)
     local exp_err_bad_opts_headers = 'opts.headers should be a table'
     local exp_err_bad_key = 'opts.headers keys should be strings'
     local exp_err_bad_value = 'opts.headers values should be strings'
@@ -350,53 +348,53 @@ local function test_request_headers(test, url, opts)
             exp_err = exp_err_bad_value,
         },
     }
-    test:plan(#cases)
+    testcase:plan(#cases)
 
     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)
         end
         if case.exp_err == nil then
             -- expect success
-            test:ok(ok, case[1])
+            testcase:ok(ok, case[1])
         else
             -- expect fail
             assert(type(err) == 'string')
             err = err:gsub('^builtin/[a-z._]+.lua:[0-9]+: ', '')
-            test:is_deeply({ok, err}, {false, case.exp_err}, case[1])
+            testcase:is_deeply({ok, err}, {false, case.exp_err}, case[1])
         end
     end
 end
 
-local function test_headers(test, url, opts)
-    test:plan(21)
+local function test_headers(testcase, url, opts)
+    testcase:plan(21)
     local http = client:new()
     local r = http:get(url .. 'headers', opts)
-    test:is(type(r.headers["set-cookie"]), 'string', "set-cookie check")
-    test:ok(r.headers["set-cookie"]:match("likes=cheese"), "set-cookie check")
-    test:ok(r.headers["set-cookie"]:match("age = 17"), "set-cookie check")
-    test:is(r.headers["content-type"], "application/json", "content-type check")
-    test:is(r.headers["my_header"], "value1,value2", "other header check")
-    test:isnil(r.headers["11200ok"], "http status line not included in headers")
-    test:is(r.cookies["likes"][1], "cheese", "cookie value check")
-    test:ok(r.cookies["likes"][2][1]:match("Expires"), "cookie option check")
-    test:ok(r.cookies["likes"][2][3]:match("HttpOnly"), "cookie option check")
-    test:is(r.cookies["age"][1], "17", "cookie value check")
-    test:is(#r.cookies["age"][2], 1, "cookie option check")
-    test:is(r.cookies["age"][2][1], "Secure", "cookie option check")
-    test:ok(r.cookies["good_name"] ~= nil , "cookie name check")
-    test:ok(r.cookies["bad@name"] == nil , "cookie name check")
-    test:ok(r.cookies["badname"] == nil , "cookie name check")
-    test:ok(r.cookies["badcookie"] == nil , "cookie name check")
-    test:isnil(r.headers["very_very_very_long_headers_name1"], "no long header name")
-    test:is(r.headers["very_very_very_long_headers_name"], "true", "truncated name")
+    testcase:is(type(r.headers["set-cookie"]), 'string', "set-cookie check")
+    testcase:ok(r.headers["set-cookie"]:match("likes=cheese"), "set-cookie check")
+    testcase:ok(r.headers["set-cookie"]:match("age = 17"), "set-cookie check")
+    testcase:is(r.headers["content-type"], "application/json", "content-type check")
+    testcase:is(r.headers["my_header"], "value1,value2", "other header check")
+    testcase:isnil(r.headers["11200ok"], "http status line not included in headers")
+    testcase:is(r.cookies["likes"][1], "cheese", "cookie value check")
+    testcase:ok(r.cookies["likes"][2][1]:match("Expires"), "cookie option check")
+    testcase:ok(r.cookies["likes"][2][3]:match("HttpOnly"), "cookie option check")
+    testcase:is(r.cookies["age"][1], "17", "cookie value check")
+    testcase:is(#r.cookies["age"][2], 1, "cookie option check")
+    testcase:is(r.cookies["age"][2][1], "Secure", "cookie option check")
+    testcase:ok(r.cookies["good_name"] ~= nil , "cookie name check")
+    testcase:ok(r.cookies["bad@name"] == nil , "cookie name check")
+    testcase:ok(r.cookies["badname"] == nil , "cookie name check")
+    testcase:ok(r.cookies["badcookie"] == nil , "cookie name check")
+    testcase:isnil(r.headers["very_very_very_long_headers_name1"], "no long header name")
+    testcase:is(r.headers["very_very_very_long_headers_name"], "true", "truncated name")
     opts["max_header_name_length"] = 64
-    local r = http:get(url .. 'headers', opts)
-    test:is(r.headers["very_very_very_long_headers_name1"], "true", "truncated max_header_name_length")
+    r = http:get(url .. 'headers', opts)
+    testcase:is(r.headers["very_very_very_long_headers_name1"], "true", "truncated max_header_name_length")
     opts["max_header_name_length"] = nil
 
     -- Send large headers.
@@ -406,26 +404,25 @@ local function test_headers(test, url, opts)
     -- "${hname}: ${hvalue}" is 8192 bytes length
     local hvalue = string.rep('x', MAX_HEADER_NAME - hname:len() - 2)
     local headers = {[hname] = hvalue}
-    local r = http:post(url, nil, merge(opts, {headers = headers}))
-    test:is(r.headers[hname], hvalue, '8192 bytes header: success')
+    r = http:post(url, nil, merge(opts, {headers = headers}))
+    testcase:is(r.headers[hname], hvalue, '8192 bytes header: success')
 
     -- "${hname}: ${hvalue}" is 8193 bytes length
     local exp_err = 'header is too large'
-    local hvalue = string.rep('x', MAX_HEADER_NAME - hname:len() - 1)
-    local headers = {[hname] = hvalue}
+    hvalue = string.rep('x', MAX_HEADER_NAME - hname:len() - 1)
+    headers = {[hname] = hvalue}
     local ok, err = pcall(http.post, http, url, nil,
                           merge(opts, {headers = headers}))
-    test:is_deeply({ok, tostring(err)}, {false, exp_err},
+    testcase:is_deeply({ok, tostring(err)}, {false, exp_err},
                    '8193 KiB header: error')
 end
 
-local function test_special_methods(test, url, opts)
-    test:plan(14)
+local function test_special_methods(testcase, url, opts)
+    testcase:plan(14)
     local http = client.new()
     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,39 +451,35 @@ 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
 
-    test:is(responses.patch_data.status, 200, "HTTP:PATCH request")
-    test:ok(json.decode(responses.patch_data.body).key == "val",
+    testcase:is(responses.patch_data.status, 200, "HTTP:PATCH request")
+    testcase:ok(json.decode(responses.patch_data.body).key == "val",
         "HTTP:PATCH request content")
-    test:is(responses.delete_data.status, 200, "HTTP:DELETE request")
-    test:ok(responses.delete_data.headers.method == "DELETE",
+    testcase:is(responses.delete_data.status, 200, "HTTP:DELETE request")
+    testcase:ok(responses.delete_data.headers.method == "DELETE",
         "HTTP:DELETE request content")
-    test:is(responses.options_data.status, 200, "HTTP:OPTIONS request")
-    test:ok(responses.options_data.headers.method == "OPTIONS",
+    testcase:is(responses.options_data.status, 200, "HTTP:OPTIONS request")
+    testcase:ok(responses.options_data.headers.method == "OPTIONS",
         "HTTP:OPTIONS request content")
-    test:is(responses.head_data.status, 200, "HTTP:HEAD request code")
-    test:ok(responses.head_data.headers.method == "HEAD",
+    testcase:is(responses.head_data.status, 200, "HTTP:HEAD request code")
+    testcase:ok(responses.head_data.headers.method == "HEAD",
         "HTTP:HEAD request content")
-    test:is(responses.connect_data.status, 200, "HTTP:CONNECT request")
-    test:ok(responses.connect_data.headers.method == "CONNECT",
+    testcase:is(responses.connect_data.status, 200, "HTTP:CONNECT request")
+    testcase:ok(responses.connect_data.headers.method == "CONNECT",
         "HTTP:OPTIONS request content")
-    test:is(responses.trace_data.status, 200, "HTTP:TRACE request")
-    test:ok(responses.trace_data.headers.method == "TRACE",
+    testcase:is(responses.trace_data.status, 200, "HTTP:TRACE request")
+    testcase:ok(responses.trace_data.headers.method == "TRACE",
         "HTTP:TRACE request content")
-    test:is(responses.custom_data.status, 400, "HTTP:CUSTOM request")
-    test:ok(responses.custom_data.headers.method == "CUSTOM",
+    testcase:is(responses.custom_data.status, 400, "HTTP:CUSTOM request")
+    testcase:ok(responses.custom_data.headers.method == "CUSTOM",
         "HTTP:CUSTOM request content")
 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 function test_concurrent(testcase, url, opts)
+    testcase:plan(3)
     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
@@ -577,23 +568,23 @@ local function test_concurrent(test, url, opts)
             break
         end
     end
-    test:is(ok_req, true, "All requests are ok")
-    test:ok(ok_sockets_added, "free sockets")
-    test:ok(ok_active, "no active requests")
+    testcase:is(ok_req, true, "All requests are ok")
+    testcase:ok(ok_sockets_added, "free sockets")
+    testcase:ok(ok_active, "no active requests")
 end
 
-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)
-    test:test("http.client headers redefine", test_http_client_headers_redefine,
+local function run_tests(testcase, sock_family, sock_addr)
+    testcase:plan(11)
+    local server, url, opts = start_server(testcase, sock_family, sock_addr)
+    testcase:test("http.client", test_http_client, url, opts)
+    testcase:test("http.client headers redefine", test_http_client_headers_redefine,
               url, opts)
-    test:test("cancel and errinj", test_cancel_and_errinj, url .. 'long_query', opts)
-    test:test("basic http post/get", test_post_and_get, url, opts)
-    test:test("errors", test_errors)
-    test:test("request_headers", test_request_headers, url, opts)
-    test:test("headers", test_headers, url, opts)
-    test:test("special methods", test_special_methods, url, opts)
+    testcase:test("cancel and errinj", test_cancel_and_errinj, url .. 'long_query', opts)
+    testcase:test("basic http post/get", test_post_and_get, url, opts)
+    testcase:test("errors", test_errors)
+    testcase:test("request_headers", test_request_headers, url, opts)
+    testcase:test("headers", test_headers, url, opts)
+    testcase:test("special methods", test_special_methods, url, opts)
     if sock_family == 'AF_UNIX' and jit.os ~= "Linux" then
         --
         -- BSD-based operating systems (including OS X) will fail
@@ -604,25 +595,25 @@ function run_tests(test, sock_family, sock_addr)
         -- however, is fine - instead of returning ECONNEREFUSED
         -- it will suspend connect() until backlog is processed.
         --
-        test:skip("concurrent")
+        testcase:skip("concurrent")
     else
-        test:test("concurrent", test_concurrent, url, opts)
+        testcase:test("concurrent", test_concurrent, url, opts)
     end
-    stop_server(test, server)
+    stop_server(testcase, server)
 end
 
 test:plan(2)
 
-test:test("http over AF_INET", function(test)
+test:test("http over AF_INET", function(testcase)
     local s = socketlib('AF_INET', 'SOCK_STREAM', 0)
     s:bind('127.0.0.1', 0)
     local host = s:name().host
     local port = s:name().port
     s:close()
-    run_tests(test, 'AF_INET', string.format("%s:%d", host, port))
+    run_tests(testcase, 'AF_INET', string.format("%s:%d", host, port))
 end)
 
-test:test("http over AF_UNIX", function(test)
+test:test("http over AF_UNIX", function(testcase)
     local path = os.tmpname()
     os.remove(path)
     local status = pcall(client.get, 'http://localhost/', {unix_socket = path})
@@ -630,7 +621,7 @@ test:test("http over AF_UNIX", function(test)
         -- Unix domain sockets are not supported, skip the test.
         return
     end
-    run_tests(test, 'AF_UNIX', path)
+    run_tests(testcase, 'AF_UNIX', path)
     os.remove(path)
 end)
 
diff --git a/test/app-tap/iconv.test.lua b/test/app-tap/iconv.test.lua
index 6f6a04b14..b4e8e7339 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")
 
@@ -42,7 +42,7 @@ local stat, err = pcall(iconv.new, 'NOT EXISTS', 'UTF-8')
 test:is(stat, false, 'error was thrown on bad encoding')
 test:ok(err:match('Invalid') ~= nil, 'correct error')
 
-local stat, err = pcall(c_ascii_8, cyrillic_str)
+stat, err = pcall(c_ascii_8, cyrillic_str)
 test:is(stat, false, 'error was thrown on sequence')
 test:ok(err:match('Incomplete multibyte sequence') ~= nil, 'correct error')
 
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 fadfc74ec..186d6ad46 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..dd33ea63b 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,34 +171,34 @@ 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,
     memtx_memory=107374182,
     log_format = "json"}
 
-local file = io.open(filename)
+file = io.open(filename)
 while file:read() do
 end
 
 log.error("error")
 
-local line = file:read()
+line = file:read()
 message = json.decode(line)
 test:is(type(message), 'table', "json valid in log.error")
 test:is(message.level, "ERROR", "check type error")
 test:is(message.message, "error", "check error message")
 
 log.info({key="value", level=48})
-local line = file:read()
+line = file:read()
 message = json.decode(line)
 test:is(type(message), 'table', "json valid in log.info")
 test:is(message.level, "INFO", "check type info")
@@ -206,7 +206,7 @@ test:is(message.message, nil, "check message is nil")
 test:is(message.key, "value", "custom table encoded")
 
 log.info('this is "')
-local line = file:read()
+line = file:read()
 message = json.decode(line)
 test:is(message.message, "this is \"", "check message with escaped character")
 
@@ -216,13 +216,14 @@ line = file:read()
 test:ok(line:len() < 20000, "big line truncated")
 
 log.info("json")
-local line = file:read()
+line = file:read()
 message = json.decode(line)
 test:is(message.message, "json", "check message with internal key word")
 log.log_format("plain")
 log.info("hello")
 line = file:read()
 test:ok(not line:match("{"), "log change format")
+local e
 s, e = pcall(log.log_format, "non_format")
 test:ok(not s, "bad format")
 file:close()
@@ -235,7 +236,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..dbc1ddcab 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,14 +304,12 @@ 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
     --
 
-    local arr = {1, 2, 3}
-    local map = {k1 = 'v1', k2 = 'v2', k3 = 'v3'}
+    arr = {1, 2, 3}
+    map = {k1 = 'v1', k2 = 'v2', k3 = 'v3'}
 
     ss = s.new()
     ss.cfg{decode_save_metatables = false}
@@ -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})
@@ -483,21 +473,21 @@ local function test_decode_buffer(test, s)
     test:plan(#cases)
 
     for _, case in ipairs(cases) do
-        test:test(case[1], function(test)
-            test:plan(4)
+        test:test(case[1], function(testcase)
+            testcase:plan(4)
             local args_len = table.maxn(case.args)
             local res, res_buf = case.func(unpack(case.args, 1, args_len))
-            test:is_deeply(res, case.exp_res, 'verify result')
+            testcase:is_deeply(res, case.exp_res, 'verify result')
             local buf = case.args[1]
             local rewind = res_buf - buf
-            test:is(rewind, case.exp_rewind, 'verify resulting buffer')
-            -- test:iscdata() is not sufficient here, because it
+            testcase:is(rewind, case.exp_rewind, 'verify resulting buffer')
+            -- testcase:iscdata() is not sufficient here, because it
             -- ignores 'const' qualifier (because of using
             -- ffi.istype()).
-            test:is(type(res_buf), 'cdata', 'verify resulting buffer type')
+            testcase:is(type(res_buf), 'cdata', 'verify resulting buffer type')
             local buf_ctype = tostring(ffi.typeof(buf))
             local res_buf_ctype = tostring(ffi.typeof(res_buf))
-            test:is(res_buf_ctype, buf_ctype, 'verify resulting buffer ctype')
+            testcase:is(res_buf_ctype, buf_ctype, 'verify resulting buffer ctype')
         end)
     end
 end
diff --git a/test/app-tap/minimal.test.lua b/test/app-tap/minimal.test.lua
index e44a0f6a7..8b261a03e 100755
--- a/test/app-tap/minimal.test.lua
+++ b/test/app-tap/minimal.test.lua
@@ -24,13 +24,13 @@ os.execute("tarantool ./script-args.lua 1 2 3")
 --
 -- LUA_PATH and LUA_CPATH argument handling
 --
-local script = io.open('script-path.lua', 'w')
+script = io.open('script-path.lua', 'w')
 script:write([[
 print(package.path)
 os.exit(0)
 ]])
 script:close()
-local script = io.open('script-cpath.lua', 'w')
+script = io.open('script-cpath.lua', 'w')
 script:write([[
 print(package.cpath)
 os.exit(0)
diff --git a/test/app-tap/module_api.test.lua b/test/app-tap/module_api.test.lua
index a6658cc61..e161d2f29 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,7 +33,7 @@ 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
@@ -116,7 +116,7 @@ local function test_iscallable(test, module)
     end
 end
 
-local test = require('tap').test("module_api", function(test)
+require('tap').test("module_api", function(test)
     test:plan(24)
     local status, module = pcall(require, 'module_api')
     test:is(status, true, "module")
@@ -138,7 +138,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..3ae16c8aa 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
@@ -27,10 +27,10 @@ local status, msg = xpcall(pcalltest, function(msg)
 end)
 print('pcall inside xpcall:', status, msg)
 
-local status, msg = pcall(function() error('some message') end)
+status, msg = pcall(function() error('some message') end)
 print('pcall with Lua error():', status, msg:match('some message'))
 
-local status, msg = pcall(function()
+status, msg = pcall(function()
     box.error(box.error.ILLEGAL_PARAMS, 'some message')
 end)
 print('pcall with box.error():', status, msg)
diff --git a/test/app-tap/popen.test.lua b/test/app-tap/popen.test.lua
index 3b6d9469f..6615d6dae 100755
--- a/test/app-tap/popen.test.lua
+++ b/test/app-tap/popen.test.lua
@@ -90,12 +90,13 @@ local function test_trivial_echo_output(test)
     test:ok(is_dead, 'the process is killed after close()')
 
     -- Verify that :close() is idempotent.
-    local res, err = ph:close()
+    res, err = ph:close()
     test:is_deeply({res, err}, {true, nil}, 'close() is idempotent')
 
     -- Sending a signal using a closed handle gives an error.
     local exp_err = 'popen: attempt to operate on a closed handle'
-    local ok, err = pcall(ph.signal, ph, popen.signal.SIGTERM)
+    local ok
+    ok, err = pcall(ph.signal, ph, popen.signal.SIGTERM)
     test:is_deeply({ok, err.type, tostring(err)},
                    {false, 'IllegalParams', exp_err},
                    'signal() on closed handle gives an error')
@@ -195,28 +196,28 @@ local function test_read_write(test)
     test:is_deeply({res, err}, {true, nil}, 'write() succeeds')
     local ok = ph:shutdown({stdin = true})
     test:ok(ok, 'shutdown() succeeds')
-    local res, err = ph:read()
+    res, err = ph:read()
     test:is_deeply({res, err}, {payload, nil}, 'read() from stdout succeeds')
 
     ph:close()
 
     -- The script copies data from stdin to stderr.
-    local script = 'prompt=""; read -r prompt; printf "$prompt" 1>&2'
-    local ph = popen.shell(script, 'Rw')
+    script = 'prompt=""; read -r prompt; printf "$prompt" 1>&2'
+    ph = popen.shell(script, 'Rw')
 
     -- Write to stdin, read from stderr.
-    local res, err = ph:write(payload .. '\n')
+    res, err = ph:write(payload .. '\n')
     test:is_deeply({res, err}, {true, nil}, 'write() succeeds')
-    local ok = ph:shutdown({stdin = true})
+    ok = ph:shutdown({stdin = true})
     test:ok(ok, 'shutdown() succeeds')
-    local res, err = ph:read({stderr = true})
+    res, err = ph:read({stderr = true})
     test:is_deeply({res, err}, {payload, nil}, 'read() from stderr succeeds')
 
     ph:close()
 
     -- The same script: copy from stdin to stderr.
-    local script = 'prompt=""; read -r prompt; printf "$prompt" 1>&2'
-    local ph = popen.shell(script, 'Rw')
+    script = 'prompt=""; read -r prompt; printf "$prompt" 1>&2'
+    ph = popen.shell(script, 'Rw')
 
     -- Ensure that read waits for data and does not return
     -- prematurely.
@@ -226,7 +227,7 @@ local function test_read_write(test)
         res_w, err_w = ph:write(payload .. '\n')
         ph:shutdown({stdin = true})
     end)
-    local res, err = ph:read({stderr = true})
+    res, err = ph:read({stderr = true})
     test:is_deeply({res_w, err_w}, {true, nil}, 'write() succeeds')
     test:is_deeply({res, err}, {payload, nil}, 'read() from stderr succeeds')
 
@@ -251,10 +252,10 @@ local function test_read_timeout(test)
                    'timeout error')
 
     -- Write and read after the timeout error.
-    local res, err = ph:write(payload .. '\n')
+    res, err = ph:write(payload .. '\n')
     test:is_deeply({res, err}, {true, nil}, 'write data')
     ph:shutdown({stdin = true})
-    local res, err = ph:read()
+    res, err = ph:read()
     test:is_deeply({res, err}, {payload, nil}, 'read data')
 
     ph:close()
@@ -316,13 +317,13 @@ local function test_shutdown(test)
     test:plan(9)
 
     -- Verify std* status.
-    local function test_stream_status(test, ph, pstream, exp_pstream)
-        test:plan(6)
+    local function test_stream_status(testcase, ph, pstream, exp_pstream)
+        testcase:plan(6)
         local info = ph:info()
         for _, s in ipairs({'stdin', 'stdout', 'stderr'}) do
             local exp_status = s == pstream and exp_pstream or nil
-            test:is(ph[s], exp_status, ('%s open'):format(s))
-            test:is(info[s], exp_status, ('%s open'):format(s))
+            testcase:is(ph[s], exp_status, ('%s open'):format(s))
+            testcase:is(info[s], exp_status, ('%s open'):format(s))
         end
     end
 
diff --git a/test/app-tap/snapshot.test.lua b/test/app-tap/snapshot.test.lua
index 587f8279b..6cae662c6 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,18 +74,18 @@ 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
 
-local snap_chan = fiber.channel()
+snap_chan = fiber.channel()
 fiber.create(function () box.snapshot() snap_chan:put(true) end)
 
 fiber.sleep(0)
@@ -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..bd4db6e43 100755
--- a/test/app-tap/string.test.lua
+++ b/test/app-tap/string.test.lua
@@ -5,40 +5,40 @@ local test = tap.test("string extensions")
 
 test:plan(7)
 
-test:test("split", function(test)
-    test:plan(10)
+test:test("split", function(testcase)
+    testcase:plan(10)
 
     -- testing basic split (works over gsplit)
-    test:ok(not pcall(string.split, "", ""), "empty separator")
-    test:ok(not pcall(string.split, "a", ""), "empty separator")
-    test:is_deeply((""):split("z"), {""},  "empty split")
-    test:is_deeply(("a"):split("a"), {"", ""}, "split self")
-    test:is_deeply(
+    testcase:ok(not pcall(string.split, "", ""), "empty separator")
+    testcase:ok(not pcall(string.split, "a", ""), "empty separator")
+    testcase:is_deeply((""):split("z"), {""},  "empty split")
+    testcase:is_deeply(("a"):split("a"), {"", ""}, "split self")
+    testcase:is_deeply(
         (" 1 2  3  "):split(),
         {"1", "2", "3"},
         "complex split on empty separator"
     )
-    test:is_deeply(
+    testcase:is_deeply(
         (" 1 2  3  "):split(" "),
         {"", "1", "2", "", "3", "", ""},
         "complex split on space separator"
     )
-    test:is_deeply(
+    testcase:is_deeply(
         (" 1 2  \n\n\n\r\t\n3  "):split(),
         {"1", "2", "3"},
         "complex split on empty separator"
     )
-    test:is_deeply(
+    testcase:is_deeply(
         ("a*bb*c*ddd"):split("*"),
         {"a", "bb", "c", "ddd"},
         "another * separator"
     )
-    test:is_deeply(
+    testcase:is_deeply(
         ("dog:fred:bonzo:alice"):split(":", 2),
         {"dog", "fred", "bonzo:alice"},
         "testing max separator"
     )
-    test:is_deeply(
+    testcase:is_deeply(
         ("///"):split("/"),
         {"", "", "", ""},
         "testing splitting on one char"
@@ -46,231 +46,231 @@ test:test("split", function(test)
 end)
 
 -- gh-2214 - string.ljust()/string.rjust() Lua API
-test:test("ljust/rjust/center", function(test)
-    test:plan(18)
+test:test("ljust/rjust/center", function(testcase)
+    testcase:plan(18)
 
-    test:is(("help"):ljust(0),  "help", "ljust, length 0, do nothing")
-    test:is(("help"):rjust(0),  "help", "rjust, length 0, do nothing")
-    test:is(("help"):center(0), "help", "center, length 0, do nothing")
+    testcase:is(("help"):ljust(0),  "help", "ljust, length 0, do nothing")
+    testcase:is(("help"):rjust(0),  "help", "rjust, length 0, do nothing")
+    testcase:is(("help"):center(0), "help", "center, length 0, do nothing")
 
-    test:is(("help"):ljust(3),  "help", "ljust, length 3, do nothing")
-    test:is(("help"):rjust(3),  "help", "rjust, length 3, do nothing")
-    test:is(("help"):center(3), "help", "center, length 3, do nothing")
+    testcase:is(("help"):ljust(3),  "help", "ljust, length 3, do nothing")
+    testcase:is(("help"):rjust(3),  "help", "rjust, length 3, do nothing")
+    testcase:is(("help"):center(3), "help", "center, length 3, do nothing")
 
-    test:is(("help"):ljust(5),  "help ", "ljust, length 5, one extra charachter")
-    test:is(("help"):rjust(5),  " help", "rjust, length 5, one extra charachter")
-    test:is(("help"):center(5), "help ", "center, length 5, one extra charachter")
+    testcase:is(("help"):ljust(5),  "help ", "ljust, length 5, one extra charachter")
+    testcase:is(("help"):rjust(5),  " help", "rjust, length 5, one extra charachter")
+    testcase:is(("help"):center(5), "help ", "center, length 5, one extra charachter")
 
-    test:is(("help"):ljust(6),  "help  ", "ljust, length 6, two extra charachters")
-    test:is(("help"):rjust(6),  "  help", "rjust, length 6, two extra charachters")
-    test:is(("help"):center(6), " help ", "center, length 6, two extra charachters")
+    testcase:is(("help"):ljust(6),  "help  ", "ljust, length 6, two extra charachters")
+    testcase:is(("help"):rjust(6),  "  help", "rjust, length 6, two extra charachters")
+    testcase:is(("help"):center(6), " help ", "center, length 6, two extra charachters")
 
-    test:is(("help"):ljust(6, '.'),  "help..", "ljust, length 6, two extra charachters, custom fill char")
-    test:is(("help"):rjust(6, '.'),  "..help", "rjust, length 6, two extra charachters, custom fill char")
-    test:is(("help"):center(6, '.'), ".help.", "center, length 6, two extra charachters, custom fill char")
+    testcase:is(("help"):ljust(6, '.'),  "help..", "ljust, length 6, two extra charachters, custom fill char")
+    testcase:is(("help"):rjust(6, '.'),  "..help", "rjust, length 6, two extra charachters, custom fill char")
+    testcase:is(("help"):center(6, '.'), ".help.", "center, length 6, two extra charachters, custom fill char")
     local errmsg = "%(char expected, got string%)"
     local _, err = pcall(function() ("help"):ljust(6, "XX") end)
-    test:ok(err and err:match(errmsg), "wrong params")
+    testcase:ok(err and err:match(errmsg), "wrong params")
     _, err = pcall(function() ("help"):rjust(6, "XX") end)
-    test:ok(err and err:match(errmsg), "wrong params")
+    testcase:ok(err and err:match(errmsg), "wrong params")
     _, err = pcall(function() ("help"):center(6, "XX") end)
-    test:ok(err and err:match(errmsg), "wrong params")
+    testcase:ok(err and err:match(errmsg), "wrong params")
 end)
 
 -- gh-2215 - string.startswith()/string.endswith() Lua API
-test:test("startswith/endswith", function(test)
-    test:plan(21)
-
-    test:ok((""):startswith(""),      "empty+empty startswith")
-    test:ok((""):endswith(""),        "empty+empty endswith")
-    test:ok(not (""):startswith("a"), "empty+non-empty startswith")
-    test:ok(not (""):endswith("a"),   "empty+non-empty endswith")
-    test:ok(("a"):startswith(""),     "non-empty+empty startswith")
-    test:ok(("a"):endswith(""),       "non-empty+empty endswith")
-
-    test:ok(("12345"):startswith("123")            , "simple startswith")
-    test:ok(("12345"):startswith("123", 1, 5)      , "startswith with good begin/end")
-    test:ok(("12345"):startswith("123", 1, 3)      , "startswith with good begin/end")
-    test:ok(("12345"):startswith("123", -5, 3)     , "startswith with good negative begin/end")
-    test:ok(("12345"):startswith("123", -5, -3)    , "startswith with good negative begin/end")
-    test:ok(not ("12345"):startswith("123", 2, 5)  , "bad startswith with good begin/end")
-    test:ok(not ("12345"):startswith("123", 1, 2)  , "bad startswith with good begin/end")
-
-    test:ok(("12345"):endswith("345")              , "simple endswith")
-    test:ok(("12345"):endswith("345", 1, 5)        , "endswith with good begin/end")
-    test:ok(("12345"):endswith("345", 3, 5)        , "endswith with good begin/end")
-    test:ok(("12345"):endswith("345", -3, 5)       , "endswith with good begin/end")
-    test:ok(("12345"):endswith("345", -3, -1)      , "endswith with good begin/end")
-    test:ok(not ("12345"):endswith("345", 1, 4)    , "bad endswith with good begin/end")
-    test:ok(not ("12345"):endswith("345", 4, 5)    , "bad endswith with good begin/end")
+test:test("startswith/endswith", function(testcase)
+    testcase:plan(21)
+
+    testcase:ok((""):startswith(""),      "empty+empty startswith")
+    testcase:ok((""):endswith(""),        "empty+empty endswith")
+    testcase:ok(not (""):startswith("a"), "empty+non-empty startswith")
+    testcase:ok(not (""):endswith("a"),   "empty+non-empty endswith")
+    testcase:ok(("a"):startswith(""),     "non-empty+empty startswith")
+    testcase:ok(("a"):endswith(""),       "non-empty+empty endswith")
+
+    testcase:ok(("12345"):startswith("123")            , "simple startswith")
+    testcase:ok(("12345"):startswith("123", 1, 5)      , "startswith with good begin/end")
+    testcase:ok(("12345"):startswith("123", 1, 3)      , "startswith with good begin/end")
+    testcase:ok(("12345"):startswith("123", -5, 3)     , "startswith with good negative begin/end")
+    testcase:ok(("12345"):startswith("123", -5, -3)    , "startswith with good negative begin/end")
+    testcase:ok(not ("12345"):startswith("123", 2, 5)  , "bad startswith with good begin/end")
+    testcase:ok(not ("12345"):startswith("123", 1, 2)  , "bad startswith with good begin/end")
+
+    testcase:ok(("12345"):endswith("345")              , "simple endswith")
+    testcase:ok(("12345"):endswith("345", 1, 5)        , "endswith with good begin/end")
+    testcase:ok(("12345"):endswith("345", 3, 5)        , "endswith with good begin/end")
+    testcase:ok(("12345"):endswith("345", -3, 5)       , "endswith with good begin/end")
+    testcase:ok(("12345"):endswith("345", -3, -1)      , "endswith with good begin/end")
+    testcase:ok(not ("12345"):endswith("345", 1, 4)    , "bad endswith with good begin/end")
+    testcase:ok(not ("12345"):endswith("345", 4, 5)    , "bad endswith with good begin/end")
 
     local _, err = pcall(function() ("help"):startswith({'n', 1}) end)
-    test:ok(err and err:match("%(string expected, got table%)"), "wrong params")
+    testcase:ok(err and err:match("%(string expected, got table%)"), "wrong params")
 end)
 
-test:test("hex", function(test)
-    test:plan(2)
-    test:is(string.hex("hello"), "68656c6c6f", "hex non-empty string")
-    test:is(string.hex(""), "", "hex empty string")
+test:test("hex", function(testcase)
+    testcase:plan(2)
+    testcase:is(string.hex("hello"), "68656c6c6f", "hex non-empty string")
+    testcase:is(string.hex(""), "", "hex empty string")
 end)
 
-test:test("fromhex", function(test)
-    test:plan(11)
-    test:is(string.fromhex("48656c6c6f"), "Hello", "from hex to bin")
-    test:is(string.fromhex("4c696e7578"), "Linux", "from hex to bin")
-    test:is(string.fromhex("6C6F72656D"), "lorem", "from hex to bin")
-    test:is(string.fromhex("697073756D"), "ipsum", "from hex to bin")
-    test:is(string.fromhex("6c6f72656d"), "lorem", "from hex to bin")
-    test:is(string.fromhex("697073756d"), "ipsum", "from hex to bin")
-    test:is(string.fromhex("6A6B6C6D6E6F"), "jklmno", "from hex to bin")
-    test:is(string.fromhex("6a6b6c6d6e6f"), "jklmno", "from hex to bin")
+test:test("fromhex", function(testcase)
+    testcase:plan(11)
+    testcase:is(string.fromhex("48656c6c6f"), "Hello", "from hex to bin")
+    testcase:is(string.fromhex("4c696e7578"), "Linux", "from hex to bin")
+    testcase:is(string.fromhex("6C6F72656D"), "lorem", "from hex to bin")
+    testcase:is(string.fromhex("697073756D"), "ipsum", "from hex to bin")
+    testcase:is(string.fromhex("6c6f72656d"), "lorem", "from hex to bin")
+    testcase:is(string.fromhex("697073756d"), "ipsum", "from hex to bin")
+    testcase:is(string.fromhex("6A6B6C6D6E6F"), "jklmno", "from hex to bin")
+    testcase:is(string.fromhex("6a6b6c6d6e6f"), "jklmno", "from hex to bin")
     local _, err = pcall(string.fromhex, "aaa")
-    test:ok(err and err:match("(even amount of chars expected," ..
+    testcase:ok(err and err:match("(even amount of chars expected," ..
                               " got odd amount)"))
-    local _, err = pcall(string.fromhex, "qq")
-    test:ok(err and err:match("(hex string expected, got non hex chars)"))
-    local _, err = pcall(string.fromhex, 795)
-    test:ok(err and err:match("(string expected, got number)"))
+    _, err = pcall(string.fromhex, "qq")
+    testcase:ok(err and err:match("(hex string expected, got non hex chars)"))
+    _, err = pcall(string.fromhex, 795)
+    testcase:ok(err and err:match("(string expected, got number)"))
 end)
 
-test:test("strip", function(test)
-    test:plan(45)
+test:test("strip", function(testcase)
+    testcase:plan(45)
     local str = "  Hello world! "
-    test:is(string.strip(str), "Hello world!", "strip (without chars)")
-    test:is(string.lstrip(str), "Hello world! ", "lstrip (without chars)")
-    test:is(string.rstrip(str), "  Hello world!", "rstrip (without chars)")
+    testcase:is(string.strip(str), "Hello world!", "strip (without chars)")
+    testcase:is(string.lstrip(str), "Hello world! ", "lstrip (without chars)")
+    testcase:is(string.rstrip(str), "  Hello world!", "rstrip (without chars)")
     str = ""
-    test:is(string.strip(str), str, "strip (0-len inp without chars)")
-    test:is(string.lstrip(str), str, "lstrip (0-len inp without chars)")
-    test:is(string.rstrip(str), str, "rstrip (0-len inp without chars)")
+    testcase:is(string.strip(str), str, "strip (0-len inp without chars)")
+    testcase:is(string.lstrip(str), str, "lstrip (0-len inp without chars)")
+    testcase:is(string.rstrip(str), str, "rstrip (0-len inp without chars)")
     str = " "
-    test:is(string.strip(str), "", "strip (1-len inp without chars)")
-    test:is(string.lstrip(str), "", "lstrip (1-len inp without chars)")
-    test:is(string.rstrip(str), "", "rstrip (1-len inp without chars)")
+    testcase:is(string.strip(str), "", "strip (1-len inp without chars)")
+    testcase:is(string.lstrip(str), "", "lstrip (1-len inp without chars)")
+    testcase:is(string.rstrip(str), "", "rstrip (1-len inp without chars)")
     str = "\t\v"
-    test:is(string.strip(str), "", "strip (strip everything without chars)")
-    test:is(string.lstrip(str), "", "lstrip (strip everything without chars)")
-    test:is(string.rstrip(str), "", "rstrip (strip everything without chars)")
+    testcase:is(string.strip(str), "", "strip (strip everything without chars)")
+    testcase:is(string.lstrip(str), "", "lstrip (strip everything without chars)")
+    testcase:is(string.rstrip(str), "", "rstrip (strip everything without chars)")
     str = "hello"
-    test:is(string.strip(str), str, "strip (strip nothing without chars)")
-    test:is(string.lstrip(str), str, "lstrip (strip nothing without chars)")
-    test:is(string.rstrip(str), str, "rstrip (strip nothing without chars)")
+    testcase:is(string.strip(str), str, "strip (strip nothing without chars)")
+    testcase:is(string.lstrip(str), str, "lstrip (strip nothing without chars)")
+    testcase:is(string.rstrip(str), str, "rstrip (strip nothing without chars)")
     str = " \t\n\v\f\rTEST \t\n\v\f\r"
-    test:is(string.strip(str), "TEST", "strip (all space characters without chars)")
-    test:is(string.lstrip(str), "TEST \t\n\v\f\r", "lstrip (all space characters without chars)")
-    test:is(string.rstrip(str), " \t\n\v\f\rTEST", "rstrip (all space characters without chars)")
+    testcase:is(string.strip(str), "TEST", "strip (all space characters without chars)")
+    testcase:is(string.lstrip(str), "TEST \t\n\v\f\r", "lstrip (all space characters without chars)")
+    testcase:is(string.rstrip(str), " \t\n\v\f\rTEST", "rstrip (all space characters without chars)")
 
     local chars = "#\0"
     str = "##Hello world!#"
-    test:is(string.strip(str, chars), "Hello world!", "strip (with chars)")
-    test:is(string.lstrip(str, chars), "Hello world!#", "lstrip (with chars)")
-    test:is(string.rstrip(str, chars), "##Hello world!", "rstrip (with chars)")
+    testcase:is(string.strip(str, chars), "Hello world!", "strip (with chars)")
+    testcase:is(string.lstrip(str, chars), "Hello world!#", "lstrip (with chars)")
+    testcase:is(string.rstrip(str, chars), "##Hello world!", "rstrip (with chars)")
     str = ""
-    test:is(string.strip(str, chars), str, "strip (0-len inp with chars)")
-    test:is(string.lstrip(str, chars), str, "lstrip (0-len inp with chars)")
-    test:is(string.rstrip(str, chars), str, "rstrip (0-len inp with chars)")
+    testcase:is(string.strip(str, chars), str, "strip (0-len inp with chars)")
+    testcase:is(string.lstrip(str, chars), str, "lstrip (0-len inp with chars)")
+    testcase:is(string.rstrip(str, chars), str, "rstrip (0-len inp with chars)")
     str = "#"
-    test:is(string.strip(str, chars), "", "strip (1-len inp with chars)")
-    test:is(string.lstrip(str, chars), "", "lstrip (1-len inp with chars)")
-    test:is(string.rstrip(str, chars), "", "rstrip (1-len inp with chars)")
+    testcase:is(string.strip(str, chars), "", "strip (1-len inp with chars)")
+    testcase:is(string.lstrip(str, chars), "", "lstrip (1-len inp with chars)")
+    testcase:is(string.rstrip(str, chars), "", "rstrip (1-len inp with chars)")
     str = "##"
-    test:is(string.strip(str, chars), "", "strip (strip everything with chars)")
-    test:is(string.lstrip(str, chars), "", "lstrip (strip everything with chars)")
-    test:is(string.rstrip(str, chars), "", "rstrip (strip everything with chars)")
+    testcase:is(string.strip(str, chars), "", "strip (strip everything with chars)")
+    testcase:is(string.lstrip(str, chars), "", "lstrip (strip everything with chars)")
+    testcase:is(string.rstrip(str, chars), "", "rstrip (strip everything with chars)")
     str = "hello"
-    test:is(string.strip(str, chars), str, "strip (strip nothing with chars)")
-    test:is(string.lstrip(str, chars), str, "lstrip (strip nothing with chars)")
-    test:is(string.rstrip(str, chars), str, "rstrip (strip nothing with chars)")
+    testcase:is(string.strip(str, chars), str, "strip (strip nothing with chars)")
+    testcase:is(string.lstrip(str, chars), str, "lstrip (strip nothing with chars)")
+    testcase:is(string.rstrip(str, chars), str, "rstrip (strip nothing with chars)")
     str = "\0\0\0TEST\0"
-    test:is(string.strip(str, chars), "TEST", "strip (embedded 0s with chars)")
-    test:is(string.lstrip(str, chars), "TEST\0", "lstrip (embedded 0s with chars)")
-    test:is(string.rstrip(str, chars), "\0\0\0TEST", "rstrip (embedded 0s with chars)")
+    testcase:is(string.strip(str, chars), "TEST", "strip (embedded 0s with chars)")
+    testcase:is(string.lstrip(str, chars), "TEST\0", "lstrip (embedded 0s with chars)")
+    testcase:is(string.rstrip(str, chars), "\0\0\0TEST", "rstrip (embedded 0s with chars)")
     chars = ""
-    test:is(string.strip(str, chars), str, "strip (0-len chars)")
-    test:is(string.lstrip(str, chars), str, "lstrip (0-len chars)")
-    test:is(string.rstrip(str, chars), str, "rstrip (0-len chars)")
+    testcase:is(string.strip(str, chars), str, "strip (0-len chars)")
+    testcase:is(string.lstrip(str, chars), str, "lstrip (0-len chars)")
+    testcase:is(string.rstrip(str, chars), str, "rstrip (0-len chars)")
 
     local _, err = pcall(string.strip, 12)
-    test:ok(err and err:match("#1 to '.-%.strip' %(string expected, got number%)"), "strip err 1")
+    testcase:ok(err and err:match("#1 to '.-%.strip' %(string expected, got number%)"), "strip err 1")
     _, err = pcall(string.lstrip, 12)
-    test:ok(err and err:match("#1 to '.-%.lstrip' %(string expected, got number%)"), "lstrip err 1")
+    testcase:ok(err and err:match("#1 to '.-%.lstrip' %(string expected, got number%)"), "lstrip err 1")
     _, err = pcall(string.rstrip, 12)
-    test:ok(err and err:match("#1 to '.-%.rstrip' %(string expected, got number%)"), "rstrip err 1")
+    testcase:ok(err and err:match("#1 to '.-%.rstrip' %(string expected, got number%)"), "rstrip err 1")
 
     _, err = pcall(string.strip, "foo", 12)
-    test:ok(err and err:match("#2 to '.-%.strip' %(string expected, got number%)"), "strip err 2")
+    testcase:ok(err and err:match("#2 to '.-%.strip' %(string expected, got number%)"), "strip err 2")
     _, err = pcall(string.lstrip, "foo", 12)
-    test:ok(err and err:match("#2 to '.-%.lstrip' %(string expected, got number%)"), "lstrip err 2")
+    testcase:ok(err and err:match("#2 to '.-%.lstrip' %(string expected, got number%)"), "lstrip err 2")
     _, err = pcall(string.rstrip, "foo", 12)
-    test:ok(err and err:match("#2 to '.-%.rstrip' %(string expected, got number%)"), "rstrip err 2")
+    testcase:ok(err and err:match("#2 to '.-%.rstrip' %(string expected, got number%)"), "rstrip err 2")
 end)
 
-test:test("unicode", function(test)
-    test:plan(104)
+test:test("unicode", function(testcase)
+    testcase:plan(104)
     local str = 'хеЛлоу вОрЛд ё Ё я Я э Э ъ Ъ hElLo WorLd 1234 i I İ 勺#☢༺'
     local upper_res = 'ХЕЛЛОУ ВОРЛД Ё Ё Я Я Э Э Ъ Ъ HELLO WORLD 1234 I I İ 勺#☢༺'
     local lower_res = 'хеллоу ворлд ё ё я я э э ъ ъ hello world 1234 i i i̇ 勺#☢༺'
     local s = utf8.upper(str)
-    test:is(s, upper_res, 'default locale upper')
+    testcase:is(s, upper_res, 'default locale upper')
     s = utf8.lower(str)
-    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)
-    test:isnt(err:find('Usage'), nil, 'upper usage is checked')
-    s, err = pcall(utf8.lower, true)
-    test:isnt(err:find('Usage'), nil, 'lower usage is checked')
-
-    test:is(utf8.isupper('a'), false, 'isupper("a")')
-    test:is(utf8.isupper('A'), true, 'isupper("A")')
-    test:is(utf8.islower('a'), true, 'islower("a")')
-    test:is(utf8.islower('A'), false, 'islower("A")')
-    test:is(utf8.isalpha('a'), true, 'isalpha("a")')
-    test:is(utf8.isalpha('A'), true, 'isalpha("A")')
-    test:is(utf8.isalpha('aa'), false, 'isalpha("aa")')
-    test:is(utf8.isalpha('勺'), true, 'isalpha("勺")')
-    test:is(utf8.isupper('Ё'), true, 'isupper("Ё")')
-    test:is(utf8.islower('ё'), true, 'islower("ё")')
-    test:is(utf8.isdigit('a'), false, 'isdigit("a")')
-    test:is(utf8.isdigit('1'), true, 'isdigit("1")')
-    test:is(utf8.isdigit('9'), true, 'isdigit("9")')
-
-    test:is(utf8.len(str), 56, 'len works on complex string')
+    testcase:is(s, lower_res, 'default locale lower')
+    testcase:is(utf8.upper(''), '', 'empty string upper')
+    testcase:is(utf8.lower(''), '', 'empty string lower')
+    local err, _
+    _, err = pcall(utf8.upper, true)
+    testcase:isnt(err:find('Usage'), nil, 'upper usage is checked')
+    _, err = pcall(utf8.lower, true)
+    testcase:isnt(err:find('Usage'), nil, 'lower usage is checked')
+
+    testcase:is(utf8.isupper('a'), false, 'isupper("a")')
+    testcase:is(utf8.isupper('A'), true, 'isupper("A")')
+    testcase:is(utf8.islower('a'), true, 'islower("a")')
+    testcase:is(utf8.islower('A'), false, 'islower("A")')
+    testcase:is(utf8.isalpha('a'), true, 'isalpha("a")')
+    testcase:is(utf8.isalpha('A'), true, 'isalpha("A")')
+    testcase:is(utf8.isalpha('aa'), false, 'isalpha("aa")')
+    testcase:is(utf8.isalpha('勺'), true, 'isalpha("勺")')
+    testcase:is(utf8.isupper('Ё'), true, 'isupper("Ё")')
+    testcase:is(utf8.islower('ё'), true, 'islower("ё")')
+    testcase:is(utf8.isdigit('a'), false, 'isdigit("a")')
+    testcase:is(utf8.isdigit('1'), true, 'isdigit("1")')
+    testcase:is(utf8.isdigit('9'), true, 'isdigit("9")')
+
+    testcase:is(utf8.len(str), 56, 'len works on complex string')
     s = '12İ☢勺34'
-    test:is(utf8.len(s), 7, 'len works no options')
-    test:is(utf8.len(s, 1), 7, 'default start is 1')
-    test:is(utf8.len(s, 2), 6, 'start 2')
-    test:is(utf8.len(s, 3), 5, 'start 3')
+    testcase:is(utf8.len(s), 7, 'len works no options')
+    testcase:is(utf8.len(s, 1), 7, 'default start is 1')
+    testcase:is(utf8.len(s, 2), 6, 'start 2')
+    testcase:is(utf8.len(s, 3), 5, 'start 3')
     local c
     c, err = utf8.len(s, 4)
-    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)
-    test:is(err, 6, 'error on 6 byte')
-    c, 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')
-    test:is(utf8.len(s, 1, -1), 7, 'default end is -1')
-    test:is(utf8.len(s, 1, -2), 6, 'end -2')
-    test:is(utf8.len(s, 1, -3), 5, 'end -3')
-    test:is(utf8.len(s, 1, -4), 5, 'end in the middle of symbol')
-    test:is(utf8.len(s, 1, -5), 5, 'end in the middle of symbol')
-    test:is(utf8.len(s, 1, -6), 5, 'end in the middle of symbol')
-    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)
-    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')
-    test:is(err, 2, "invalid unicode in the middle of the string")
+    testcase:isnil(c, 'middle of symbol offset is error')
+    testcase:is(err, 4, 'error on 4 byte')
+    testcase:is(utf8.len(s, 5), 4, 'start 5')
+    _, err = utf8.len(s, 6)
+    testcase:is(err, 6, 'error on 6 byte')
+    _, err = utf8.len(s, 0)
+    testcase:is(err, 'position is out of string', 'range is out of string')
+    testcase:is(utf8.len(s, #s), 1, 'start from the end')
+    testcase:is(utf8.len(s, #s + 1), 0, 'position is out of string')
+    testcase:is(utf8.len(s, 1, -1), 7, 'default end is -1')
+    testcase:is(utf8.len(s, 1, -2), 6, 'end -2')
+    testcase:is(utf8.len(s, 1, -3), 5, 'end -3')
+    testcase:is(utf8.len(s, 1, -4), 5, 'end in the middle of symbol')
+    testcase:is(utf8.len(s, 1, -5), 5, 'end in the middle of symbol')
+    testcase:is(utf8.len(s, 1, -6), 5, 'end in the middle of symbol')
+    testcase:is(utf8.len(s, 1, -7), 4, 'end -7')
+    testcase:is(utf8.len(s, 2, -7), 3, '[2, -7]')
+    testcase:is(utf8.len(s, 3, -7), 2, '[3, -7]')
+    _, err = utf8.len(s, 4, -7)
+    testcase:is(err, 4, '[4, -7] is error - start from the middle of symbol')
+    testcase:is(utf8.len(s, 10, -100), 0, 'it is ok to be out of str by end pos')
+    testcase:is(utf8.len(s, 10, -10), 0, 'it is ok to swap end and start pos')
+    testcase:is(utf8.len(''), 0, 'empty len')
+    testcase:is(utf8.len(s, -6, -1), 3, 'pass both negative offsets')
+    testcase:is(utf8.len(s, 3, 3), 1, "end in the middle on the same symbol as start")
+    _, err = utf8.len('a\xF4')
+    testcase:is(err, 2, "invalid unicode in the middle of the string")
 
     local chars = {}
     local codes = {}
@@ -278,21 +278,21 @@ test:test("unicode", function(test)
         table.insert(chars, utf8.char(code))
         table.insert(codes, code)
     end
-    test:is(table.concat(chars), s, "next and char works")
-    c, err = pcall(utf8.char, 'kek')
-    test:isnt(err:find('bad argument'), nil, 'char usage is checked')
-    c, err = pcall(utf8.next, true)
-    test:isnt(err:find('Usage'), nil, 'next usage is checked')
-    c, err = pcall(utf8.next, '1234', true)
-    test:isnt(err:find('bad argument'), nil, 'next usage is checked')
+    testcase:is(table.concat(chars), s, "next and char works")
+    _, err = pcall(utf8.char, 'kek')
+    testcase:isnt(err:find('bad argument'), nil, 'char usage is checked')
+    _, err = pcall(utf8.next, true)
+    testcase:isnt(err:find('Usage'), nil, 'next usage is checked')
+    _, err = pcall(utf8.next, '1234', true)
+    testcase:isnt(err:find('bad argument'), nil, 'next usage is checked')
     local offset
     offset, c = utf8.next('')
-    test:isnil(offset, 'next on empty - nil offset')
-    test:isnil(c, 'next on empty - nil code')
+    testcase:isnil(offset, 'next on empty - nil offset')
+    testcase:isnil(c, 'next on empty - nil code')
     offset, c = utf8.next('123', 100)
-    test:isnil(offset, 'out of string - nil offset')
-    test:isnil(c, 'out of string - nil code')
-    test:is(utf8.char(unpack(codes)), s, 'char with multiple values')
+    testcase:isnil(offset, 'out of string - nil offset')
+    testcase:isnil(c, 'out of string - nil code')
+    testcase:is(utf8.char(unpack(codes)), s, 'char with multiple values')
 
     local uppers = 0
     local lowers = 0
@@ -304,70 +304,70 @@ test:test("unicode", function(test)
         if utf8.isalpha(code) then letters = letters + 1 end
         if utf8.isdigit(code) then digits = digits + 1 end
     end
-    test:is(uppers, 13, 'uppers by code')
-    test:is(lowers, 19, 'lowers by code')
-    test:is(letters, 33, 'letters by code')
-    test:is(digits, 4, 'digits by code')
+    testcase:is(uppers, 13, 'uppers by code')
+    testcase:is(lowers, 19, 'lowers by code')
+    testcase:is(letters, 33, 'letters by code')
+    testcase:is(digits, 4, 'digits by code')
 
     s = '12345678'
-    test:is(utf8.sub(s, 1, 1), '1', 'sub [1]')
-    test:is(utf8.sub(s, 1, 2), '12', 'sub [1:2]')
-    test:is(utf8.sub(s, 2, 2), '2', 'sub [2:2]')
-    test:is(utf8.sub(s, 0, 2), '12', 'sub [0:2]')
-    test:is(utf8.sub(s, 3, 7), '34567', 'sub [3:7]')
-    test:is(utf8.sub(s, 7, 3), '', 'sub [7:3]')
-    test:is(utf8.sub(s, 3, 100), '345678', 'sub [3:100]')
-    test:is(utf8.sub(s, 100, 3), '', 'sub [100:3]')
-
-    test:is(utf8.sub(s, 5), '5678', 'sub [5:]')
-    test:is(utf8.sub(s, 1, -1), s, 'sub [1:-1]')
-    test:is(utf8.sub(s, 1, -2), '1234567', 'sub [1:-2]')
-    test:is(utf8.sub(s, 2, -2), '234567', 'sub [2:-2]')
-    test:is(utf8.sub(s, 3, -3), '3456', 'sub [3:-3]')
-    test:is(utf8.sub(s, 5, -4), '5', 'sub [5:-4]')
-    test:is(utf8.sub(s, 7, -7), '', 'sub[7:-7]')
-
-    test:is(utf8.sub(s, -2, -1), '78', 'sub [-2:-1]')
-    test:is(utf8.sub(s, -1, -1), '8', 'sub [-1:-1]')
-    test:is(utf8.sub(s, -4, -2), '567', 'sub [-4:-2]')
-    test:is(utf8.sub(s, -400, -2), '1234567', 'sub [-400:-2]')
-    test:is(utf8.sub(s, -3, -5), '', 'sub [-3:-5]')
-
-    test:is(utf8.sub(s, -6, 5), '345', 'sub [-6:5]')
-    test:is(utf8.sub(s, -5, 4), '4', 'sub [-5:4]')
-    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)
-    test:isnt(err:find('Usage'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, true)
-    test:isnt(err:find('Usage'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, '123')
-    test:isnt(err:find('Usage'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, '123', true)
-    test:isnt(err:find('bad argument'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, '123', 1, true)
-    test:isnt(err:find('bad argument'), nil, 'usage is checked')
+    testcase:is(utf8.sub(s, 1, 1), '1', 'sub [1]')
+    testcase:is(utf8.sub(s, 1, 2), '12', 'sub [1:2]')
+    testcase:is(utf8.sub(s, 2, 2), '2', 'sub [2:2]')
+    testcase:is(utf8.sub(s, 0, 2), '12', 'sub [0:2]')
+    testcase:is(utf8.sub(s, 3, 7), '34567', 'sub [3:7]')
+    testcase:is(utf8.sub(s, 7, 3), '', 'sub [7:3]')
+    testcase:is(utf8.sub(s, 3, 100), '345678', 'sub [3:100]')
+    testcase:is(utf8.sub(s, 100, 3), '', 'sub [100:3]')
+
+    testcase:is(utf8.sub(s, 5), '5678', 'sub [5:]')
+    testcase:is(utf8.sub(s, 1, -1), s, 'sub [1:-1]')
+    testcase:is(utf8.sub(s, 1, -2), '1234567', 'sub [1:-2]')
+    testcase:is(utf8.sub(s, 2, -2), '234567', 'sub [2:-2]')
+    testcase:is(utf8.sub(s, 3, -3), '3456', 'sub [3:-3]')
+    testcase:is(utf8.sub(s, 5, -4), '5', 'sub [5:-4]')
+    testcase:is(utf8.sub(s, 7, -7), '', 'sub[7:-7]')
+
+    testcase:is(utf8.sub(s, -2, -1), '78', 'sub [-2:-1]')
+    testcase:is(utf8.sub(s, -1, -1), '8', 'sub [-1:-1]')
+    testcase:is(utf8.sub(s, -4, -2), '567', 'sub [-4:-2]')
+    testcase:is(utf8.sub(s, -400, -2), '1234567', 'sub [-400:-2]')
+    testcase:is(utf8.sub(s, -3, -5), '', 'sub [-3:-5]')
+
+    testcase:is(utf8.sub(s, -6, 5), '345', 'sub [-6:5]')
+    testcase:is(utf8.sub(s, -5, 4), '4', 'sub [-5:4]')
+    testcase:is(utf8.sub(s, -2, 2), '', 'sub [-2:2]')
+    testcase:is(utf8.sub(s, -1, 8), '8', 'sub [-1:8]')
+
+    _, err = pcall(utf8.sub)
+    testcase:isnt(err:find('Usage'), nil, 'usage is checked')
+    _, err = pcall(utf8.sub, true)
+    testcase:isnt(err:find('Usage'), nil, 'usage is checked')
+    _, err = pcall(utf8.sub, '123')
+    testcase:isnt(err:find('Usage'), nil, 'usage is checked')
+    _, err = pcall(utf8.sub, '123', true)
+    testcase:isnt(err:find('bad argument'), nil, 'usage is checked')
+    _, err = pcall(utf8.sub, '123', 1, true)
+    testcase:isnt(err:find('bad argument'), nil, 'usage is checked')
 
     local s1 = '☢'
     local s2 = 'İ'
-    test:is(s1 < s2, false, 'test binary cmp')
-    test:is(utf8.cmp(s1, s2) < 0, true, 'test unicode <')
-    test:is(utf8.cmp(s1, s1) == 0, true, 'test unicode eq')
-    test:is(utf8.cmp(s2, s1) > 0, true, 'test unicode >')
-    test:is(utf8.casecmp('a', 'A') == 0, true, 'test icase ==')
-    test:is(utf8.casecmp('b', 'A') > 0, true, 'test icase >, first')
-    test:is(utf8.casecmp('B', 'a') > 0, true, 'test icase >, second >')
-    test:is(utf8.cmp('', '') == 0, true, 'test empty compare')
-    test:is(utf8.cmp('', 'a') < 0, true, 'test left empty compare')
-    test:is(utf8.cmp('a', '') > 0, true, 'test right empty compare')
-    test:is(utf8.casecmp('', '') == 0, true, 'test empty icompare')
-    test:is(utf8.casecmp('', 'a') < 0, true, 'test left empty icompare')
-    test:is(utf8.casecmp('a', '') > 0, true, 'test right empty icompare')
+    testcase:is(s1 < s2, false, 'test binary cmp')
+    testcase:is(utf8.cmp(s1, s2) < 0, true, 'test unicode <')
+    testcase:is(utf8.cmp(s1, s1) == 0, true, 'test unicode eq')
+    testcase:is(utf8.cmp(s2, s1) > 0, true, 'test unicode >')
+    testcase:is(utf8.casecmp('a', 'A') == 0, true, 'test icase ==')
+    testcase:is(utf8.casecmp('b', 'A') > 0, true, 'test icase >, first')
+    testcase:is(utf8.casecmp('B', 'a') > 0, true, 'test icase >, second >')
+    testcase:is(utf8.cmp('', '') == 0, true, 'test empty compare')
+    testcase:is(utf8.cmp('', 'a') < 0, true, 'test left empty compare')
+    testcase:is(utf8.cmp('a', '') > 0, true, 'test right empty compare')
+    testcase:is(utf8.casecmp('', '') == 0, true, 'test empty icompare')
+    testcase:is(utf8.casecmp('', 'a') < 0, true, 'test left empty icompare')
+    testcase:is(utf8.casecmp('a', '') > 0, true, 'test right empty icompare')
 
     -- gh-3709: utf8 can not handle an empty string.
-    test:is(utf8.lower(''), '', 'lower empty')
-    test:is(utf8.upper(''), '', 'upper empty')
+    testcase:is(utf8.lower(''), '', 'lower empty')
+    testcase:is(utf8.upper(''), '', 'upper empty')
 end)
 
 os.exit(test:check() == true and 0 or -1)
diff --git a/test/app-tap/tap.test.lua b/test/app-tap/tap.test.lua
index e2a78f630..0a8d8c6a1 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')
@@ -97,17 +97,17 @@ sub2 = test:test("subtest 2")
 --
 -- Multisubtest
 --
-test:test("1 level", function(t)
-    t:plan(1)
-    t:test("2 level", function(t)
-        t:plan(1)
-        t:test("3 level", function(t)
-            t:plan(1)
-            t:test("4 level", function(t)
-                t:plan(1)
-                t:test("5 level", function(t)
-                    t:plan(1)
-                    t:ok(true, 'ok')
+test:test("1 level", function(t1)
+    t1:plan(1)
+    t1:test("2 level", function(t2)
+        t2:plan(1)
+        t2:test("3 level", function(t3)
+            t3:plan(1)
+            t3:test("4 level", function(t4)
+                t4:plan(1)
+                t4:test("5 level", function(t5)
+                    t5:plan(1)
+                    t5:ok(true, 'ok')
                 end)
             end)
         end)
diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
index 9f1464617..257ce494f 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
@@ -224,7 +213,7 @@ do
     -- bad code
     local code = [[ box.cfg{ ]]
     create_script(dir, 'bad_script.lua',  code)
-    local code = [[ box.cfg{memtx_memory = 104857600} ]]
+    code = [[ box.cfg{memtx_memory = 104857600} ]]
     create_script(dir, 'good_script.lua', code)
 
     local status, err = pcall(function()
@@ -258,9 +247,9 @@ do
     -- bad code
     local code = [[ error('help'); return 1]]
     create_script(dir, 'bad_script.lua',  code)
-    local code = [[ return 1]]
+    code = [[ return 1]]
     create_script(dir, 'ok_script.lua',  code)
-    local code = [[ box.cfg{memtx_memory = 104857600} box.once('help', function() end)]]
+    code = [[ box.cfg{memtx_memory = 104857600} box.once('help', function() end)]]
     create_script(dir, 'good_script.lua', code)
 
     local status, err = pcall(function()
@@ -327,12 +316,12 @@ end
 do
     local dir = fio.tempdir()
 
-    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 function test_help(testcase, directory, cmd, e_stderr)
+        local desc = directory and 'with config' or 'without config'
+        directory = directory or './'
+        local _, _, stderr = run_command(directory, cmd)
         if e_stderr ~= nil then
-            if not test:ok(stderr:find(e_stderr), ("check stderr of '%s' %s"):format(cmd, desc)) then
+            if not testcase: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))
             end
         end
@@ -381,22 +370,22 @@ do
 
     create_script(dir, 'filler.lua', filler_code)
 
-    local function check_ctlcat_xlog(test, dir, args, delim, lc)
+    local function check_ctlcat_xlog(testcase, directory, args, delim, lc)
         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)
-        test:is(res, 0, desc .. " result")
-        test:is(select(2, stdout:gsub(delim, delim)), lc, desc .. " line count")
+        local res, stdout, _ = run_command(directory, command_base .. args)
+        testcase:is(res, 0, desc .. " result")
+        testcase:is(select(2, stdout:gsub(delim, delim)), lc, desc .. " line count")
     end
 
-    local function check_ctlcat_snap(test, dir, args, delim, lc)
+    local function check_ctlcat_snap(testcase, directory, args, delim, lc)
         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)
-        test:is(res, 0, desc .. " result")
-        test:is(select(2, stdout:gsub(delim, delim)), lc, desc .. " line count")
+        local res, stdout, _ = run_command(directory, command_base .. args)
+        testcase:is(res, 0, desc .. " result")
+        testcase:is(select(2, stdout:gsub(delim, delim)), lc, desc .. " line count")
     end
 
     local status, err = pcall(function()
@@ -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)
+            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)
@@ -494,7 +484,7 @@ else
     end
 end
 
-test:test('filter_xlog', function(test)
+test:test('filter_xlog', function(testcase)
     local xlog_data = {
         -- [1] =
         {
@@ -612,13 +602,13 @@ test:test('filter_xlog', function(test)
             exp_result = {x[7], x[9]},
         },
     }
-    test:plan(#cases)
+    testcase:plan(#cases)
 
     rawset(_G, 'TARANTOOLCTL_UNIT_TEST', true)
     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
@@ -632,14 +622,14 @@ test:test('filter_xlog', function(test)
     end
 
     for _, case in ipairs(cases) do
-        local gen, param, state = xlog_data_pairs(xlog_data)
+        local data_pairs, param, state = xlog_data_pairs(xlog_data)
         local res = {}
-        tarantoolctl.internal.filter_xlog(gen, param, state, case.opts,
+        tarantoolctl.internal.filter_xlog(data_pairs, param, state, case.opts,
             function(record)
                 table.insert(res, record)
             end
         )
-        test:is_deeply(res, case.exp_result, case[1])
+        testcase:is_deeply(res, case.exp_result, case[1])
     end
 end)
 
diff --git a/test/app-tap/trigger.test.lua b/test/app-tap/trigger.test.lua
index a31d45e5f..ea23b3325 100755
--- a/test/app-tap/trigger.test.lua
+++ b/test/app-tap/trigger.test.lua
@@ -14,8 +14,8 @@ test:plan(3)
 local trigger_list = trigger.new("sweet trigger")
 test:ok(trigger_list ~= nil, "test that trigger list is created")
 
-test:test("simple trigger test", function(test)
-    test:plan(10)
+test:test("simple trigger test", function(testcase)
+    testcase:plan(10)
 
     local cnt = 0
     local function trigger_cnt() cnt = cnt + 1 end
@@ -23,35 +23,35 @@ test:test("simple trigger test", function(test)
     -- Append first trigger
     trigger_list(trigger_cnt)
     trigger_list:run()
-    test:is(cnt, 1, "check first run")
+    testcase:is(cnt, 1, "check first run")
     -- Append second trigger
     trigger_list(trigger_cnt)
     trigger_list:run()
-    test:is(cnt, 3, "check first run")
+    testcase:is(cnt, 3, "check first run")
     -- Check listing
     local list_copy = trigger_list()
-    test:is(#list_copy, 2, "trigger() count")
+    testcase:is(#list_copy, 2, "trigger() count")
     table.remove(list_copy)
-    test:is(#trigger_list(), 2, "check that we've returned copy")
+    testcase:is(#trigger_list(), 2, "check that we've returned copy")
 
     -- Delete both triggers
-    test:is(trigger_list(nil, trigger_cnt), trigger_cnt, "pop trigger")
+    testcase:is(trigger_list(nil, trigger_cnt), trigger_cnt, "pop trigger")
     trigger_list:run()
-    test:is(#trigger_list(), 1, "check trigger count after delete")
-    test:is(cnt, 4, "check third run")
-    test:is(trigger_list(nil, trigger_cnt), trigger_cnt, "pop trigger")
+    testcase:is(#trigger_list(), 1, "check trigger count after delete")
+    testcase:is(cnt, 4, "check third run")
+    testcase:is(trigger_list(nil, trigger_cnt), trigger_cnt, "pop trigger")
     trigger_list:run()
-    test:is(#trigger_list(), 0, "check trigger count after delete")
+    testcase:is(#trigger_list(), 0, "check trigger count after delete")
 
 
     -- 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")
+    testcase:ok(string.find(err, "is not found"), "check error")
 end)
 
-test:test("errored trigger test", function(test)
-    test:plan(6)
+test:test("errored trigger test", function(testcase)
+    testcase:plan(6)
 
     --
     -- Check that trigger:run() fails on the first error
@@ -61,27 +61,27 @@ test:test("errored trigger test", function(test)
     local function trigger_cnt() cnt = cnt + 1 end
     local function trigger_errored() error("test error") end
 
-    test:is(#trigger_list(), 0, "check for empty triggers")
+    testcase:is(#trigger_list(), 0, "check for empty triggers")
 
     -- Append first trigger
     trigger_list(trigger_cnt)
     trigger_list:run()
-    test:is(cnt, 1, "check simple trigger")
+    testcase:is(cnt, 1, "check simple trigger")
     -- Append errored trigger
     trigger_list(trigger_errored)
-    local status = pcall(function() trigger_list:run() end)
-    test:is(cnt, 2, "check simple+error trigger")
+    pcall(function() trigger_list:run() end)
+    testcase:is(cnt, 2, "check simple+error trigger")
     -- Flush triggers
     table_clear(trigger_list)
-    test:is(#trigger_list(), 0, "successfull flush")
+    testcase:is(#trigger_list(), 0, "successfull flush")
     -- Append first trigger
     trigger_list(trigger_errored)
-    local status = pcall(function() trigger_list:run() end)
-    test:is(cnt, 2, "check error trigger")
+    pcall(function() trigger_list:run() end)
+    testcase:is(cnt, 2, "check error trigger")
     -- Append errored trigger
     trigger_list(trigger_cnt)
-    local status = pcall(function() trigger_list:run() end)
-    test:is(cnt, 2, "check error+simple trigger")
+    pcall(function() trigger_list:run() end)
+    testcase:is(cnt, 2, "check error+simple trigger")
 end)
 
 os.exit(test:check() == true and 0 or -1)
diff --git a/test/app-tap/yaml.test.lua b/test/app-tap/yaml.test.lua
index 4669b6102..82fcb90c0 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,11 +98,12 @@ 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})
+    local handle
+    handle, prefix = s.decode(ret, {tag_only = true})
     test:is(handle, "!print!", "handle is decoded ok")
     test:is(prefix, "tag:tarantool.io/push,2018", "prefix is decoded ok")
     local several_tags =
@@ -114,6 +113,7 @@ local function test_tagged(test, s)
 - 100
 ...
 ]]
+    local ok
     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")
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 02/19] Fix luacheck warnings in test/app
  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 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 03/19] Fix luacheck warnings in test/box sergeyb
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/.luacheckrc b/.luacheckrc
index 4055b0994..358789457 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -33,7 +33,7 @@ exclude_files = {
     -- Third-party source code.
     "src/box/lua/serpent.lua",
     "test-run/**/*.lua",
-    "test/app/**/*.lua",
+    "test/app/*.test.lua",
     "test/box/**/*.lua",
     "test/box-py/**/*.lua",
     "test/box-tap/**/*.lua",
@@ -81,3 +81,6 @@ files["test/app-tap/lua/require_mod.lua"] = {
 files["test/app-tap/string.test.lua"] = {
     globals = {"utf8"}
 }
+files["test/app/lua/fiber.lua"] = {
+    globals = {"box_fiber_run_test"}
+}
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 03/19] Fix luacheck warnings in test/box
  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 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 04/19] Fix luacheck warnings in test/box-py sergeyb
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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                        | 58 +++++++++++++++++++++++++++++-
 test/box/box.lua                   |  7 ++--
 test/box/lua/bitset.lua            |  7 ++--
 test/box/lua/cfg_bad_vinyl_dir.lua |  2 +-
 test/box/lua/cfg_rtree.lua         |  2 +-
 test/box/lua/cfg_test1.lua         |  2 +-
 test/box/lua/cfg_test2.lua         |  2 +-
 test/box/lua/cfg_test3.lua         |  2 +-
 test/box/lua/cfg_test4.lua         |  2 +-
 test/box/lua/cfg_test5.lua         |  2 +-
 test/box/lua/cfg_test6.lua         |  2 +-
 test/box/lua/fifo.lua              |  2 +-
 test/box/lua/identifier.lua        |  9 +++--
 test/box/lua/index_random_test.lua |  2 +-
 test/box/lua/utils.lua             | 10 +++---
 test/box/on_schema_init.lua        |  8 ++---
 test/box/proxy.lua                 |  2 +-
 test/box/tiny.lua                  |  2 +-
 18 files changed, 87 insertions(+), 36 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 358789457..4ed6734a7 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -34,7 +34,13 @@ exclude_files = {
     "src/box/lua/serpent.lua",
     "test-run/**/*.lua",
     "test/app/*.test.lua",
-    "test/box/**/*.lua",
+    "test/box/*.test.lua",
+    -- Unused source file, to be dropped (gh-5169).
+    "test/box/lua/require_init.lua",
+    -- Unused source file, to be dropped (gh-5169).
+    "test/box/lua/require_mod.lua",
+    -- Unused source file, to be dropped (gh-5169).
+    "test/box/lua/test_init.lua",
     "test/box-py/**/*.lua",
     "test/box-tap/**/*.lua",
     "test/engine/**/*.lua",
@@ -84,3 +90,53 @@ files["test/app-tap/string.test.lua"] = {
 files["test/app/lua/fiber.lua"] = {
     globals = {"box_fiber_run_test"}
 }
+files["test/box/box.lua"] = {
+    globals = {
+        "cfg_filter",
+        "sorted",
+        "iproto_request",
+    }
+}
+files["test/box/lua/push.lua"] = {
+    globals = {"push_collection"}
+}
+files["test/box/lua/index_random_test.lua"] = {
+    globals = {"index_random_test"}
+}
+files["test/box/lua/utils.lua"] = {
+    globals = {
+        "arithmetic",
+        "check_space",
+        "create_iterator",
+        "iterate",
+        "setmap",
+        "sort",
+        "space_field_types",
+        "space_bsize",
+        "table_generate",
+        "table_shuffle",
+        "tuple_to_string",
+    }
+}
+files["test/box/lua/bitset.lua"] = {
+    globals = {
+        "clear",
+        "create_space",
+        "delete",
+        "drop_space",
+        "dump",
+        "fill",
+        "test_insert_delete",
+    }
+}
+files["test/box/lua/fifo.lua"] = {
+    globals = {
+        "fifomax",
+        "fifo_push",
+        "fifo_top",
+        "find_or_create_fifo",
+    }
+}
+files["test/box/lua/identifier.lua"] = {
+     globals = {"run_test"}
+}
diff --git a/test/box/box.lua b/test/box/box.lua
index 6fad07015..72b116dfd 100644
--- a/test/box/box.lua
+++ b/test/box/box.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 local msgpack = require('msgpack')
 
@@ -19,7 +19,7 @@ local _hide = {
 
 function cfg_filter(data)
     if type(data)~='table' then return data end
-    local keys,k,_ = {}
+    local keys = {}
     for k in pairs(data) do
         table.insert(keys, k)
     end
@@ -50,7 +50,8 @@ function iproto_request(socket, query_header, query_body)
     assert(size ~= nil, 'Failed to read response')
     size = msgpack.decode(size)
     local response = socket:read(size)
-    local header, header_len = msgpack.decode(response)
+    local header_len
+    header, header_len = msgpack.decode(response)
     body = msgpack.decode(response:sub(header_len))
     return {
         ['header'] = header,
diff --git a/test/box/lua/bitset.lua b/test/box/lua/bitset.lua
index 41d2c3681..948bf3710 100644
--- a/test/box/lua/bitset.lua
+++ b/test/box/lua/bitset.lua
@@ -1,8 +1,5 @@
 local utils = require('utils')
 
-local SPACE_NO = 0 
-local INDEX_NO = 1
-
 function create_space()
     local space = box.schema.create_space('tweedledum')
     space:create_index('primary', { type = 'hash', parts = {1, 'unsigned'}, unique = true })
@@ -13,7 +10,7 @@ function fill(...)
     local space = box.space['tweedledum']
     local nums = utils.table_generate(utils.arithmetic(...))
     utils.table_shuffle(nums)
-    for _k, v in ipairs(nums) do
+    for _, v in ipairs(nums) do
         space:insert{v, v}
     end
 end
@@ -22,7 +19,7 @@ function delete(...)
     local space = box.space['tweedledum']
     local nums = utils.table_generate(utils.arithmetic(...))
     utils.table_shuffle(nums)
-    for _k, v in ipairs(nums) do
+    for _, v in ipairs(nums) do
         space:delete{v}
     end
 end
diff --git a/test/box/lua/cfg_bad_vinyl_dir.lua b/test/box/lua/cfg_bad_vinyl_dir.lua
index 8e1a98dc8..82746b99a 100644
--- a/test/box/lua/cfg_bad_vinyl_dir.lua
+++ b/test/box/lua/cfg_bad_vinyl_dir.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/box/lua/cfg_rtree.lua b/test/box/lua/cfg_rtree.lua
index f2d32ef7d..860cb14a8 100644
--- a/test/box/lua/cfg_rtree.lua
+++ b/test/box/lua/cfg_rtree.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 box.error.injection.set("ERRINJ_INDEX_RESERVE", true)
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/box/lua/cfg_test1.lua b/test/box/lua/cfg_test1.lua
index 60b7aff9a..aa026ed42 100644
--- a/test/box/lua/cfg_test1.lua
+++ b/test/box/lua/cfg_test1.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/box/lua/cfg_test2.lua b/test/box/lua/cfg_test2.lua
index 2397f9c19..536661698 100644
--- a/test/box/lua/cfg_test2.lua
+++ b/test/box/lua/cfg_test2.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/box/lua/cfg_test3.lua b/test/box/lua/cfg_test3.lua
index 6a6e544b6..4978900fb 100644
--- a/test/box/lua/cfg_test3.lua
+++ b/test/box/lua/cfg_test3.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/box/lua/cfg_test4.lua b/test/box/lua/cfg_test4.lua
index 82dab8757..21a38f95c 100644
--- a/test/box/lua/cfg_test4.lua
+++ b/test/box/lua/cfg_test4.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/box/lua/cfg_test5.lua b/test/box/lua/cfg_test5.lua
index e3eb87392..d462c3bbc 100644
--- a/test/box/lua/cfg_test5.lua
+++ b/test/box/lua/cfg_test5.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/box/lua/cfg_test6.lua b/test/box/lua/cfg_test6.lua
index efcfc6f3e..0a5859bc5 100644
--- a/test/box/lua/cfg_test6.lua
+++ b/test/box/lua/cfg_test6.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen = os.getenv("LISTEN"),
diff --git a/test/box/lua/fifo.lua b/test/box/lua/fifo.lua
index bb3446179..c9216cfde 100644
--- a/test/box/lua/fifo.lua
+++ b/test/box/lua/fifo.lua
@@ -4,7 +4,7 @@ function find_or_create_fifo(space, name)
     local fifo = space:get{name}
     if fifo == nil then
         fifo = {}
-        for i = 1, fifomax do table.insert(fifo, 0) end
+        for _ = 1, fifomax do table.insert(fifo, 0) end
         fifo = space:insert{name, 4, 4, unpack(fifo)}
     end
     return fifo
diff --git a/test/box/lua/identifier.lua b/test/box/lua/identifier.lua
index 0cfb9e722..3103239ad 100644
--- a/test/box/lua/identifier.lua
+++ b/test/box/lua/identifier.lua
@@ -1,6 +1,6 @@
-max_len_string = string.rep('a', box.schema.NAME_MAX)
+local max_len_string = string.rep('a', box.schema.NAME_MAX)
 
-valid_testcases = {
+local valid_testcases = {
     --[[ Symbols from various unicode groups ,, --]]
     "1", "_", "sd", "я", "Ё",
     ".", "@", "#" , "⁋", "☢",
@@ -13,7 +13,7 @@ valid_testcases = {
     "⧭", "⭓", max_len_string
 }
 
-invalid_testcases = {
+local invalid_testcases = {
     --[[ Invalid and non printable unicode sequences --]]
     --[[ 1-3 ASCII control, C0 --]]
     "\x01", "\x09", "\x1f",
@@ -35,7 +35,6 @@ invalid_testcases = {
 }
 
 function run_test(create_func, cleanup_func)
-    local json = require("json")
     local bad_tests = {}
     for i, identifier in ipairs(valid_testcases) do
         local ok, res = pcall(create_func,identifier)
@@ -48,7 +47,7 @@ function run_test(create_func, cleanup_func)
         end
     end
     for i, identifier in ipairs(invalid_testcases) do
-        local ok, res = pcall(create_func,identifier)
+        local ok = pcall(create_func,identifier)
         if ok then
             table.insert(bad_tests, "invalid_testcases: "..i)
         end
diff --git a/test/box/lua/index_random_test.lua b/test/box/lua/index_random_test.lua
index 7b5256a7c..83e230216 100644
--- a/test/box/lua/index_random_test.lua
+++ b/test/box/lua/index_random_test.lua
@@ -7,7 +7,7 @@ function index_random_test(space, index_no)
 	-- insert values into the index
 	for k=1,COUNT,1 do space:insert{k}  end
 	-- delete some values from the index
-	for i=1,COUNT/2,1 do
+	for _=1,COUNT/2,1 do
 		local k = math.random(COUNT)
 		local tuple = space:delete{k}
 		if tuple ~= nil then COUNT = COUNT - 1 end
diff --git a/test/box/lua/utils.lua b/test/box/lua/utils.lua
index 5f859fd19..a6185fbd0 100644
--- a/test/box/lua/utils.lua
+++ b/test/box/lua/utils.lua
@@ -22,8 +22,7 @@ function iterate(space_no, index_no, f1, f2, iterator, ...)
 			return f
 		end
 	end
-	local state, v
-	for state, v in box.space[space_no].index[index_no]:pairs({...}, { iterator = iterator }) do
+	for _, v in box.space[space_no].index[index_no]:pairs({...}, { iterator = iterator }) do
 		local pk = get_field(v, 1);
 		local tk = '$';
 		for f = f1 + 1, f2, 1 do tk = (tk..(get_field(v, f))..'$'); end;
@@ -90,7 +89,7 @@ end;
 
 -- return string tuple
 function tuple_to_string(tuple, yaml)
-    ans = '['
+    local ans = '['
     for i = 0, #tuple - 1 do
         if #i == 4 then
             ans = ans..i
@@ -208,14 +207,13 @@ function create_iterator(obj, key, opts)
     local iter, key, state = obj:pairs(key, opts)
     local res = {iter = iter, key = key, state = state}
     res.next = function()
-        local st, tp = iter.gen(key, state)
+        local _, tp = iter.gen(key, state)
         return tp
     end
     res.iterate_over = function()
-        local tp = nil
         local ret = {}
         local i = 0
-        tp = res.next()
+        local tp = res.next()
         while tp do
             ret[i] = tp
             i = i + 1
diff --git a/test/box/on_schema_init.lua b/test/box/on_schema_init.lua
index 17cf89166..a10687a09 100644
--- a/test/box/on_schema_init.lua
+++ b/test/box/on_schema_init.lua
@@ -1,12 +1,12 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
-function test_before_replace_trig(old, new)
+local function test_before_replace_trig(old, new) -- luacheck: no unused args
     -- return multiple values so that the stack fills earlier.
     return new:update{{'+', 2, 1}}, new:update{{'+', 2, 1}}, new:update{{'+', 2, 1}}, new:update{{'+', 2, 1}}
 end
 
-function space_on_replace_trig(old, new)
+local function space_on_replace_trig(old, new) -- luacheck: no unused args
     if new and new[3] == 'test_on_schema_init' then
         box.on_commit(function()
             box.space.test_on_schema_init:before_replace(test_before_replace_trig)
@@ -14,7 +14,7 @@ function space_on_replace_trig(old, new)
     end
 end
 
-function on_init_trig()
+local function on_init_trig()
     box.space._space:on_replace(space_on_replace_trig)
 end
 
diff --git a/test/box/proxy.lua b/test/box/proxy.lua
index 8bbd505f8..c763e9634 100644
--- a/test/box/proxy.lua
+++ b/test/box/proxy.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/box/tiny.lua b/test/box/tiny.lua
index 04b523fb2..608d48366 100644
--- a/test/box/tiny.lua
+++ b/test/box/tiny.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 04/19] Fix luacheck warnings in test/box-py
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (2 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 03/19] Fix luacheck warnings in test/box sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 05/19] Fix luacheck warnings in test/box-tap sergeyb
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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         | 1 -
 test/box-py/box.lua | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 4ed6734a7..07446c7ea 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -41,7 +41,6 @@ exclude_files = {
     "test/box/lua/require_mod.lua",
     -- Unused source file, to be dropped (gh-5169).
     "test/box/lua/test_init.lua",
-    "test/box-py/**/*.lua",
     "test/box-tap/**/*.lua",
     "test/engine/**/*.lua",
     "test/engine_long/*.lua",
diff --git a/test/box-py/box.lua b/test/box-py/box.lua
index e9403774c..35a087de9 100644
--- a/test/box-py/box.lua
+++ b/test/box-py/box.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 05/19] Fix luacheck warnings in test/box-tap
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (3 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 04/19] Fix luacheck warnings in test/box-py sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 06/19] Fix luacheck warnings in test/engine sergeyb
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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                           | 21 +++++++++-
 test/box-tap/auth.test.lua            | 20 +++-------
 test/box-tap/cfg.test.lua             | 34 ++++++++--------
 test/box-tap/cfgup.test.lua           |  4 +-
 test/box-tap/extended_error.test.lua  | 11 +++---
 test/box-tap/feedback_daemon.test.lua |  4 +-
 test/box-tap/gc.test.lua              |  4 +-
 test/box-tap/on_schema_init.test.lua  |  4 +-
 test/box-tap/schema_mt.test.lua       | 22 +++++------
 test/box-tap/session.storage.test.lua | 10 ++---
 test/box-tap/session.test.lua         | 56 +++++++++++++--------------
 test/box-tap/trigger_atexit.test.lua  | 10 ++---
 test/box-tap/trigger_yield.test.lua   | 10 ++---
 13 files changed, 109 insertions(+), 101 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 07446c7ea..73f347d68 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -41,7 +41,6 @@ exclude_files = {
     "test/box/lua/require_mod.lua",
     -- Unused source file, to be dropped (gh-5169).
     "test/box/lua/test_init.lua",
-    "test/box-tap/**/*.lua",
     "test/engine/**/*.lua",
     "test/engine_long/*.lua",
     "test/long_run-py/**/*.lua",
@@ -139,3 +138,23 @@ files["test/box/lua/fifo.lua"] = {
 files["test/box/lua/identifier.lua"] = {
      globals = {"run_test"}
 }
+files["test/box-tap/session.test.lua"] = {
+    globals = {
+        "active_connections",
+        "session",
+        "space",
+        "f1",
+        "f2",
+    },
+}
+files["test/box-tap/extended_error.test.lua"] = {
+    globals = {
+        "error_access_denied",
+        "error_new",
+        "error_new_stacked",
+        "error_throw",
+        "error_throw_stacked",
+        "error_throw_access_denied",
+        "forbidden_function",
+    },
+}
diff --git a/test/box-tap/auth.test.lua b/test/box-tap/auth.test.lua
index 4e9879408..c6de6ff82 100755
--- a/test/box-tap/auth.test.lua
+++ b/test/box-tap/auth.test.lua
@@ -18,22 +18,22 @@ local test = tap.test("auth")
 test:plan(42)
 
 local space = box.schema.space.create('tweedledum')
-local index = space:create_index('primary', { type = 'hash' })
+space:create_index('primary', { type = 'hash' })
 box.schema.user.create('test', {password='pass'})
 box.schema.user.create('test2', {password=''})
 
 -- check how authentication trigger work
 local msg, counter, succeeded
-function auth_trigger(user_name)
+local function auth_trigger(user_name) -- luacheck: no unused args
     counter = counter + 1
 end
 -- get user name as argument
-function auth_trigger2(user_name)
+local function auth_trigger2(user_name) -- luacheck: no unused args
     msg = 'user ' .. user_name .. ' is there'
 end
 -- get user name and result of authentication as arguments
-function auth_trigger3(user_name, success)
-        succeeded = success
+local function auth_trigger3(user_name, success) -- luacheck: no unused args
+    succeeded = success
 end
 -- set trigger
 local handle = session.on_auth(auth_trigger)
@@ -57,7 +57,6 @@ test:is(counter, 1, "on_auth has been fired once")
 test:is(msg, "user test is there", "on_auth username param")
 test:ok(succeeded, "on_auth success param")
 conn:close()
-conn = nil
 
 -- check failing authentication
 counter = 0
@@ -68,7 +67,6 @@ test:is(counter, 1, "on_auth has been fired once")
 test:is(msg, "user test is there", "on_auth username param")
 test:ok(not succeeded, "on_auth success param")
 conn:close()
-conn = nil
 
 counter = 0
 succeeded = false
@@ -78,7 +76,6 @@ test:is(counter, 1, "on_auth has been fired once")
 test:is(msg, "user test2 is there", "on_auth username param")
 test:ok(succeeded, "on_auth success param")
 conn:close()
-conn = nil
 
 counter = 0
 succeeded = false
@@ -88,7 +85,6 @@ test:is(counter, 1, "on_auth has been fired once")
 test:is(msg, "user test2 is there", "on_auth username param")
 test:ok(succeeded, "on_auth success param")
 conn:close()
-conn = nil
 
 counter = 0
 succeeded = false
@@ -98,7 +94,6 @@ test:is(counter, 1, "on_auth has been fired once")
 test:is(msg, "user test2 is there", "on_auth username param")
 test:ok(succeeded, "on_auth success param")
 conn:close()
-conn = nil
 
 counter = 0
 succeeded = false
@@ -108,7 +103,6 @@ test:is(counter, 1, "on_auth has been fired once")
 test:is(msg, "user guest is there", "on_auth username param")
 test:ok(succeeded, "on_auth success param")
 conn:close()
-conn = nil
 
 counter = 0
 succeeded = false
@@ -118,7 +112,6 @@ test:is(counter, 1, "on_auth has been fired once")
 test:is(msg, "user guest is there", "on_auth username param")
 test:ok(succeeded, "on_auth success param")
 conn:close()
-conn = nil
 
 counter = 0
 succeeded = false
@@ -128,7 +121,6 @@ test:is(counter, 1, "on_auth has been fired once")
 test:is(msg, "user guest is there", "on_auth username param")
 test:ok(succeeded, "on_auth success param")
 conn:close()
-conn = nil
 
 counter = 0
 succeeded = false
@@ -138,7 +130,6 @@ test:is(counter, 1, "on_auth has been fired once")
 test:is(msg, "user guest is there", "on_auth username param")
 test:ok(succeeded, "on_auth success param")
 conn:close()
-conn = nil
 
 -- check guest connection without authentication(no increment)
 counter = 0
@@ -148,7 +139,6 @@ conn:ping()
 test:is(counter, 0, "on_auth hasn't been fired")
 test:ok(not succeeded, "on_auth not successed param")
 conn:close()
-conn = nil
 
 test:isnil(session.on_auth(nil, auth_trigger), "removal returns nil")
 test:isnil(session.on_auth(nil, auth_trigger2), "removal returns nil")
diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua
index 569b5f463..a577f023d 100755
--- a/test/box-tap/cfg.test.lua
+++ b/test/box-tap/cfg.test.lua
@@ -76,14 +76,14 @@ test:ok(not status and result:match('Please call box.cfg{}'),
     'exception on unconfigured box')
 
 status, result = pcall(box.error, box.error.ILLEGAL_PARAMS, 'xx')
-test:ok(result.code == box.error.ILLEGAL_PARAMS, "box.error without box.cfg")
+test:ok(not status and result.code == box.error.ILLEGAL_PARAMS, "box.error without box.cfg")
 status, result = pcall(function() return box.runtime.info() end)
 test:ok(status and type(result) == 'table', "box.runtime without box.cfg")
 status, result = pcall(function() return box.index.EQ end)
 test:ok(status and type(result) == 'number', "box.index without box.cfg")
 status, result = pcall(function() return box.NULL end)
 test:ok(status and result == msgpack.NULL, "box.NULL without box.cfg")
-status, result = pcall(box.session.id)
+status = pcall(box.session.id)
 test:ok(status, "box.session without box.cfg")
 status, result = pcall(box.tuple.new, {1, 2, 3})
 test:ok(status and result[1] == 1, "box.tuple without box.cfg")
@@ -145,13 +145,13 @@ test:is(box.cfg.too_long_threshold , 0.1, "too_long_threshold new value")
 test:is(box.cfg.read_only, false, "read_only default value")
 box.cfg{read_only = true}
 test:is(box.cfg.read_only, true, "read_only new value")
-local status, reason = pcall(function()
+local status = pcall(function()
     box.space._schema:insert({'read_only', 'test'})
 end)
 test:ok(not status and box.error.last().code == box.error.READONLY,
     "read_only = true")
 box.cfg{read_only = false}
-local status, reason = pcall(function()
+local status = pcall(function()
     box.space._schema:insert({'read_only', 'test'})
 end)
 test:ok(status, "read_only = false")
@@ -163,7 +163,7 @@ test:is(box.cfg.worker_pool_threads, 1, 'worker_pool_threads')
 
 local tarantool_bin = arg[-1]
 local PANIC = 256
-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'},
@@ -178,7 +178,7 @@ function run_script(code)
 end
 
 -- gh-3468: should allow box.cfg with vinyl_memory=0
-code =[[
+local code =[[
 box.cfg{vinyl_memory=0}
 os.exit(box.cfg.vinyl_memory == 0 and 0 or 1)
 ]]
@@ -198,7 +198,6 @@ code = [[ box.cfg{ wal_mode = 'write' }; box.cfg { wal_mode = 'fsync'} ]]
 test:is(run_script(code), PANIC, 'wal_mode write -> fsync is not supported')
 
 -- gh-684: Inconsistency with box.cfg and directories
-local code;
 code = [[ box.cfg{ work_dir='invalid' } ]]
 test:is(run_script(code), PANIC, 'work_dir is invalid')
 
@@ -238,7 +237,7 @@ os.remove(path)
 
 path = './tarantool.sock'
 local path2 = './tarantool2.sock'
-local s = socket.tcp_server('unix/', path, function () end)
+s = socket.tcp_server('unix/', path, function () end)
 os.execute('ln ' .. path .. ' ' .. path2)
 s:close()
 box.cfg{ listen = 'unix/:'.. path2}
@@ -270,6 +269,7 @@ test:is(run_script(code), 0, "wal_mode none and ER_LOADING")
 --
 -- gh-1962: incorrect replication source
 --
+local reason
 status, reason = pcall(box.cfg, {replication="3303,3304"})
 test:ok(not status and reason:match("Incorrect"), "invalid replication")
 
@@ -298,7 +298,7 @@ test:is(run_script(code), 0, "page size equal with range")
 code = [[
 box.cfg{slab_alloc_arena = 0.2, slab_alloc_minimal = 16,
     slab_alloc_maximal = 64 * 1024}
-os.exit(box.cfg.memtx_memory == 214748364 
+os.exit(box.cfg.memtx_memory == 214748364
     and box.cfg.memtx_min_tuple_size == 16
     and box.cfg.memtx_max_tuple_size == 64 * 1024
 and 0 or 1)
@@ -384,7 +384,7 @@ test:is(run_script(code), 0, "wal_max_size xlog rotation")
 -- gh-2872 bootstrap is aborted if vinyl_dir contains vylog files
 -- left from previous runs
 --
-vinyl_dir = fio.tempdir()
+local vinyl_dir = fio.tempdir()
 run_script(string.format([[
 box.cfg{vinyl_dir = '%s'}
 s = box.schema.space.create('test', {engine = 'vinyl'})
@@ -401,8 +401,8 @@ fio.rmtree(vinyl_dir)
 --
 -- gh-2278 vinyl does not support DDL/DML if wal_mode = 'none'
 --
-dir = fio.tempdir()
-cfg = string.format("wal_dir = '%s', memtx_dir = '%s', vinyl_dir = '%s'", dir, dir, dir)
+local dir = fio.tempdir()
+local cfg = string.format("wal_dir = '%s', memtx_dir = '%s', vinyl_dir = '%s'", dir, dir, dir)
 run_script(string.format([[
 box.cfg{%s}
 s = box.schema.space.create('test', {engine = 'vinyl'})
@@ -453,9 +453,9 @@ test:is(run_script(code), 0, "check replicaset_uuid")
 -- Configuration fails on instance or replica set UUID mismatch.
 --
 dir = fio.tempdir()
-instance_uuid = uuid.new()
-replicaset_uuid = uuid.new()
-code_fmt = [[
+local instance_uuid = uuid.new()
+local replicaset_uuid = uuid.new()
+local code_fmt = [[
 box.cfg{memtx_dir = '%s', instance_uuid = '%s', replicaset_uuid = '%s'}
 os.exit(0)
 ]]
@@ -569,14 +569,14 @@ test:is(run_script(code), 0, "log_nonblock")
 -- Crash (instead of panic) when trying to recover a huge tuple.
 --
 dir = fio.tempdir()
-code1 = string.format([[
+local code1 = string.format([[
 box.cfg{wal_dir = '%s', memtx_dir = '%s', memtx_max_tuple_size = 10 * 1024 * 1024}
 box.schema.space.create('test')
 box.space.test:create_index('primary')
 box.space.test:insert{1, string.rep('x', 1024 * 1024)}
 os.exit(0)
 ]], dir, dir)
-code2 = string.format([[
+local code2 = string.format([[
 box.cfg{wal_dir = '%s', memtx_dir = '%s', memtx_max_tuple_size = 10 * 1024}
 os.exit(0)
 ]], dir, dir)
diff --git a/test/box-tap/cfgup.test.lua b/test/box-tap/cfgup.test.lua
index 45fc12316..e699e304f 100755
--- a/test/box-tap/cfgup.test.lua
+++ b/test/box-tap/cfgup.test.lua
@@ -6,8 +6,8 @@ local tap = require('tap')
 local test = tap.test('cfg')
 test:plan(3)
 
-config = {
-	pid_file = '1.pid',
+local config = {
+    pid_file = '1.pid',
     log="tarantool.log"
 }
 
diff --git a/test/box-tap/extended_error.test.lua b/test/box-tap/extended_error.test.lua
index 884387be8..7a6152d22 100755
--- a/test/box-tap/extended_error.test.lua
+++ b/test/box-tap/extended_error.test.lua
@@ -24,7 +24,8 @@ box.schema.func.create('forbidden_function')
 box.session.su('guest')
 local tmp = box.func.forbidden_function
 local access_denied_error
-tmp, access_denied_error = pcall(tmp.call, tmp)
+local _
+_, access_denied_error = pcall(tmp.call, tmp)
 box.session.su('admin')
 box.schema.func.drop('forbidden_function')
 box.session.su(user)
@@ -85,7 +86,7 @@ local checks = {
     type = 'ClientError',
 }
 test:ok(check_error(err, checks), "ClientError marshaling")
-tmp, err = pcall(c.call, c, 'error_throw', args)
+_, err = pcall(c.call, c, 'error_throw', args)
 test:ok(check_error(err, checks), "ClientError marshaling in iproto fields")
 
 args = {{code = 1001, reason = 'Reason2', type = 'MyError'}}
@@ -97,7 +98,7 @@ checks = {
     type = 'MyError',
 }
 test:ok(check_error(err, checks), "CustomError marshaling")
-tmp, err = pcall(c.call, c, 'error_throw', args)
+_, err = pcall(c.call, c, 'error_throw', args)
 test:ok(check_error(err, checks), "CustomError marshaling in iproto fields")
 
 err = c:call('error_access_denied')
@@ -111,7 +112,7 @@ checks = {
     access_type = 'Execute',
 }
 test:ok(check_error(err, checks), "AccessDeniedError marshaling")
-tmp, err = pcall(c.call, c, 'error_throw_access_denied')
+_, err = pcall(c.call, c, 'error_throw_access_denied')
 test:ok(check_error(err, checks), "AccessDeniedError marshaling in iproto fields")
 
 args = {
@@ -137,7 +138,7 @@ local checks2 = {
 }
 test:ok(check_error(err2, checks2), "Second error in the stack")
 
-tmp, err = pcall(c.call, c, 'error_throw_stacked', args)
+_, err = pcall(c.call, c, 'error_throw_stacked', args)
 err1 = err
 err2 = err.prev
 test:isnt(err2, nil, 'Stack is received via iproto fields')
diff --git a/test/box-tap/feedback_daemon.test.lua b/test/box-tap/feedback_daemon.test.lua
index a04995d8a..f51c4fb4d 100755
--- a/test/box-tap/feedback_daemon.test.lua
+++ b/test/box-tap/feedback_daemon.test.lua
@@ -36,7 +36,7 @@ local function http_handle(s)
         buf = s:read('\n')
     end
     buf = s:read(length)
-    local ok, data = pcall(json.decode, buf)
+    local ok = pcall(json.decode, buf)
     if ok then
         feedback = buf
         feedback_count = feedback_count + 1
@@ -126,7 +126,7 @@ fio.unlink("feedback.json")
 
 server:close()
 -- check it does not fail without server
-local daemon = box.internal.feedback_daemon
+daemon = box.internal.feedback_daemon
 daemon.start()
 daemon.send_test()
 daemon.stop()
diff --git a/test/box-tap/gc.test.lua b/test/box-tap/gc.test.lua
index f88752e71..f0155779c 100755
--- a/test/box-tap/gc.test.lua
+++ b/test/box-tap/gc.test.lua
@@ -4,7 +4,7 @@ local fiber = require('fiber')
 
 box.cfg{}
 
-local debug = type(box.error.injection) == "table" 
+local debug = type(box.error.injection) == "table"
 
 -- check box.info.gc() is false if snapshot is not in progress
 local test = tap.test('box.info.gc')
@@ -19,7 +19,7 @@ test:is(gc.checkpoint_is_in_progress, false, "checkpoint is not in progress")
 if debug then
     box.error.injection.set("ERRINJ_SNAP_COMMIT_DELAY", true)
     local snapshot_f  = function()
-       box.snapshot() 
+       box.snapshot()
     end
     fiber.create(snapshot_f)
     local gc = box.info.gc()
diff --git a/test/box-tap/on_schema_init.test.lua b/test/box-tap/on_schema_init.test.lua
index 51b28ea08..db9ae6f27 100755
--- a/test/box-tap/on_schema_init.test.lua
+++ b/test/box-tap/on_schema_init.test.lua
@@ -8,7 +8,7 @@ local test = tap.test('on_schema_init')
 local str = ''
 test:plan(7)
 
-function testing_trig()
+local function testing_trig()
     test:istable(box.space._space, 'system spaces are accessible')
     test:is(type(box.space._space.before_replace), 'function', 'before_replace triggers')
     test:is(type(box.space._space.on_replace), 'function', 'on_replace triggers')
@@ -17,7 +17,7 @@ function testing_trig()
     str = str..'on_schema_init'
 end
 
-trig = box.ctl.on_schema_init(testing_trig)
+local trig = box.ctl.on_schema_init(testing_trig)
 test:is(type(trig), 'function', 'on_schema_init trigger set')
 
 box.cfg{log = 'tarantool.log'}
diff --git a/test/box-tap/schema_mt.test.lua b/test/box-tap/schema_mt.test.lua
index 5a635262f..c0fe5f10b 100755
--- a/test/box-tap/schema_mt.test.lua
+++ b/test/box-tap/schema_mt.test.lua
@@ -20,7 +20,7 @@ local sp1 = box.schema.create_space('test1', {engine = 'memtx'})
 local sp2 = box.schema.create_space('test2', {engine = 'vinyl'})
 test:is(getmetatable(sp1).__index, getmetatable(sp2).__index, 'spaces share metatables __index')
 
-function box.schema.space_mt.myfunc(space, args)
+function box.schema.space_mt.myfunc(space, args) -- luacheck: no unused args
   return args
 end
 test:is(sp1:myfunc(123), 123, 'space_mt can be extended')
@@ -41,13 +41,13 @@ test:isnt(getmetatable(sp1_pk).__index, getmetatable(sp2_pk).__index, 'engines d
 -- Check that there are two ways to extend index metatable:
 -- extend base index metatable, or extend engine specific.
 --
-function box.schema.index_mt.common_func(index, args)
+function box.schema.index_mt.common_func(index, args) -- luacheck: no unused args
   return args
 end
-function box.schema.vinyl_index_mt.vinyl_func(index, args)
+function box.schema.vinyl_index_mt.vinyl_func(index, args) -- luacheck: no unused args
   return args
 end
-function box.schema.memtx_index_mt.memtx_func(index, args)
+function box.schema.memtx_index_mt.memtx_func(index, args) -- luacheck: no unused args
   return args
 end
 test:is(box.schema.index_mt.common_func, box.schema.vinyl_index_mt.common_func,
@@ -77,14 +77,14 @@ test:is(sp2_sk:common_func(400), 400, 'vinyl common methods work')
 -- A space local metatable can extended so it does not affect
 -- other spaces. Same about index.
 --
-sp3 = box.schema.create_space('test3', {engine = 'memtx'})
-sp3_pk = sp3:create_index('pk')
-sp3_sk = sp3:create_index('sk')
-mt1 = getmetatable(sp1)
-mt2 = getmetatable(sp2)
+local sp3 = box.schema.create_space('test3', {engine = 'memtx'})
+local sp3_pk = sp3:create_index('pk')
+local sp3_sk = sp3:create_index('sk')
+local mt1 = getmetatable(sp1)
+local mt2 = getmetatable(sp2)
 test:isnt(mt1, mt2, 'spaces do not share metatables')
-index_mt1 = getmetatable(sp3_pk)
-index_mt2 = getmetatable(sp3_sk)
+local index_mt1 = getmetatable(sp3_pk)
+local index_mt2 = getmetatable(sp3_sk)
 test:isnt(index_mt1, index_mt2, 'indexes do not share metatables')
 
 mt1.my_func = function(a) return a end
diff --git a/test/box-tap/session.storage.test.lua b/test/box-tap/session.storage.test.lua
index 40ca9c230..d17d3efce 100755
--- a/test/box-tap/session.storage.test.lua
+++ b/test/box-tap/session.storage.test.lua
@@ -19,7 +19,7 @@ test:is(
 )
 
 local uri = inspector:eval('session_storage', 'box.cfg.listen')[1]
-conn1 = net_box.connect(uri)
+local conn1 = net_box.connect(uri)
 
 conn1:eval("session = box.session")
 test:is(conn1:eval("return type(session.id())"), "number", "session.id()")
@@ -34,7 +34,7 @@ conn1:eval("all = getmetatable(session).aggregate_storage")
 test:ok(conn1:eval("return all[session.id()].abc == 'cde'"), "check meta table")
 
 
-conn2 = net_box.connect(uri)
+local conn2 = net_box.connect(uri)
 
 test:is(conn2:eval("return type(session.storage)"), "table", "storage")
 test:isnil(conn2:eval("return type(session.storage.abc)"), "empty storage")
@@ -45,12 +45,12 @@ test:ok(conn1:eval("return session.storage.abc == 'cde'"), "first conn storage")
 test:ok(conn1:eval("return all[session.id()].abc == 'cde'"), "check first conn metatable")
 test:ok(conn2:eval("return all[session.id()].abc == 'def'"), "check second conn metatable")
 
-tres1 = conn1:eval("t1 = {} for k, v in pairs(all) do table.insert(t1, v.abc) end return t1")
+local tres1 = conn1:eval("t1 = {} for k, v in pairs(all) do table.insert(t1, v.abc) end return t1")
 
 conn1:close()
 conn2:close()
-conn3 = net_box.connect(uri)
-tres2 = conn3:eval("t2 = {} for k, v in pairs(all) do table.insert(t2, v.abc) end return t2")
+local conn3 = net_box.connect(uri)
+local tres2 = conn3:eval("t2 = {} for k, v in pairs(all) do table.insert(t2, v.abc) end return t2")
 table.sort(tres1)
 table.sort(tres2)
 test:is(tres1[1], "cde", "check after closing")
diff --git a/test/box-tap/session.test.lua b/test/box-tap/session.test.lua
index 5d4965533..160f047bc 100755
--- a/test/box-tap/session.test.lua
+++ b/test/box-tap/session.test.lua
@@ -13,7 +13,7 @@ local uri = require('uri').parse(box.cfg.listen)
 local HOST, PORT = uri.host or 'localhost', uri.service
 session = box.session
 space = box.schema.space.create('tweedledum')
-index = space:create_index('primary', { type = 'hash' })
+space:create_index('primary', { type = 'hash' })
 
 test:plan(56)
 
@@ -23,25 +23,25 @@ test:plan(56)
 test:ok(session.exists(session.id()), "session is created")
 test:isnil(session.peer(session.id()), "session.peer")
 test:ok(session.exists(), "session.exists")
-ok, err = pcall(session.exists, 1, 2, 3)
+local _, err = pcall(session.exists, 1, 2, 3)
 test:is(err, "session.exists(sid): bad arguments", "exists bad args #2")
 test:ok(not session.exists(1234567890), "session doesn't exist")
 
 -- check session.id()
 test:ok(session.id() > 0, "id > 0")
-failed = false
+local failed = false
 local f = fiber.create(function() failed = session.id() == 0 end)
 while f:status() ~= 'dead' do fiber.sleep(0) end
 test:ok(not failed, "session not broken")
 test:is(session.peer(), session.peer(session.id()), "peer() == peer(id())")
 
 -- check on_connect/on_disconnect triggers
-function noop() end
+local function noop() end
 test:is(type(session.on_connect(noop)), "function", "type of trigger noop on_connect")
 test:is(type(session.on_disconnect(noop)), "function", "type of trigger noop on_disconnect")
 
 -- check it's possible to reset these triggers
-function fail() error('hear') end
+local function fail() error('hear') end
 test:is(type(session.on_connect(fail, noop)), "function", "type of trigger fail, noop on_connect")
 test:is(type(session.on_disconnect(fail, noop)), "function", "type of trigger fail, noop on_disconnect")
 
@@ -49,19 +49,19 @@ test:is(type(session.on_disconnect(fail, noop)), "function", "type of trigger fa
 test:is(type(session.on_connect()), "table", "type of trigger on_connect, no args")
 test:is(type(session.on_disconnect()), "table", "type of trigger on_disconnect, no args")
 
-ok, err = pcall(session.on_connect, function() end, function() end)
+_, err = pcall(session.on_connect, function() end, function() end)
 test:is(err,"trigger reset: Trigger is not found", "on_connect trigger not found")
-ok, err = pcall(session.on_disconnect, function() end, function() end)
+_, err = pcall(session.on_disconnect, function() end, function() end)
 test:is(err,"trigger reset: Trigger is not found", "on_disconnect trigger not found")
 
-ok, err = pcall(session.on_connect, 1, 2)
+_, err = pcall(session.on_connect, 1, 2)
 test:is(err, "trigger reset: incorrect arguments", "on_connect bad args #1")
-ok, err = pcall(session.on_disconnect, 1, 2)
+_, err = pcall(session.on_disconnect, 1, 2)
 test:is(err, "trigger reset: incorrect arguments", "on_disconnect bad args #1")
 
-ok, err = pcall(session.on_connect, 1)
+_, err = pcall(session.on_connect, 1)
 test:is(err, "trigger reset: incorrect arguments", "on_connect bad args #2")
-ok, err = pcall(session.on_disconnect, 1)
+_, err = pcall(session.on_disconnect, 1)
 test:is(err, "trigger reset: incorrect arguments", "on_disconnect bad args #2")
 
 -- use of nil to clear the trigger
@@ -70,18 +70,18 @@ session.on_disconnect(nil, fail)
 
 -- check how connect/disconnect triggers work
 local peer_name = "peer_name"
-function inc() active_connections = active_connections + 1 end
-function dec() active_connections = active_connections - 1 end
-function peer() peer_name = box.session.peer() end
-net = { box = require('net.box') }
+local function inc() active_connections = active_connections + 1 end
+local function dec() active_connections = active_connections - 1 end
+local function peer() peer_name = box.session.peer() end
+local net = { box = require('net.box') }
 test:is(type(session.on_connect(inc)), "function", "type of trigger inc on_connect")
 test:is(type(session.on_disconnect(dec)), "function", "type of trigger dec on_disconnect")
 test:is(type(session.on_disconnect(peer)), "function", "type of trigger peer on_disconnect")
 active_connections = 0
-c = net.box.connect(HOST, PORT)
+local c = net.box.connect(HOST, PORT)
 while active_connections < 1 do fiber.sleep(0.001) end
 test:is(active_connections, 1, "active_connections after 1 connection")
-c1 = net.box.connect(HOST, PORT)
+local c1 = net.box.connect(HOST, PORT)
 while active_connections < 2 do fiber.sleep(0.001) end
 test:is(active_connections, 2, "active_connections after 2 connection")
 c:close()
@@ -95,14 +95,14 @@ session.on_disconnect(nil, dec)
 session.on_disconnect(nil, peer)
 
 -- write audit trail of connect/disconnect into a space
-function audit_connect() box.space['tweedledum']:insert{session.id()} end
-function audit_disconnect() box.space['tweedledum']:delete{session.id()} end
+local function audit_connect() box.space['tweedledum']:insert{session.id()} end
+local function audit_disconnect() box.space['tweedledum']:delete{session.id()} end
 test:is(type(session.on_connect(audit_connect)), "function", "type of trigger audit_connect on_connect")
 test:is(type(session.on_disconnect(audit_disconnect)), "function", "type of trigger audit_connect on_disconnect")
 
 box.schema.user.grant('guest', 'read,write', 'space', 'tweedledum')
 box.schema.user.grant('guest', 'execute', 'universe')
-a = net.box.connect(HOST, PORT)
+local a = net.box.connect(HOST, PORT)
 test:ok(a:eval('return space:get{box.session.id()}[1] == session.id()'), "eval get_id")
 test:ok(a:eval('return session.sync() ~= 0'), "eval sync")
 a:close()
@@ -122,15 +122,15 @@ box.schema.user.revoke('guest', 'execute', 'universe')
 -- audit permission in on_connect/on_disconnect triggers
 box.schema.user.create('tester', { password = 'tester' })
 
-on_connect_user = nil
-on_disconnect_user = nil
-function on_connect() on_connect_user = box.session.effective_user() end
-function on_disconnect() on_disconnect_user = box.session.effective_user() end
+local on_connect_user = nil
+local on_disconnect_user = nil
+local function on_connect() on_connect_user = box.session.effective_user() end
+local function on_disconnect() on_disconnect_user = box.session.effective_user() end
 _ = box.session.on_connect(on_connect)
 _ = box.session.on_disconnect(on_disconnect)
 local conn = require('net.box').connect("tester:tester@" ..HOST..':'..PORT)
 -- Triggers must not lead to privilege escalation
-ok, err = pcall(function () conn:eval('box.space._user:select()') end)
+local ok = pcall(function () conn:eval('box.space._user:select()') end)
 test:ok(not ok, "check access")
 conn:close()
 conn = nil
@@ -143,13 +143,13 @@ box.session.on_connect(nil, on_connect)
 box.session.on_disconnect(nil, on_disconnect)
 
 -- check Session privilege
-ok, err = pcall(function() net.box.connect("tester:tester@" ..HOST..':'..PORT) end)
+ok = pcall(function() net.box.connect("tester:tester@" ..HOST..':'..PORT) end)
 test:ok(ok, "session privilege")
 box.schema.user.revoke('tester', 'session', 'universe')
 conn = net.box.connect("tester:tester@" ..HOST..':'..PORT)
 test:is(conn.state, "error", "session privilege state")
 test:ok(conn.error:match("Session"), "sesssion privilege errmsg")
-ok, err = pcall(box.session.su, "user1")
+ok = pcall(box.session.su, "user1")
 test:ok(not ok, "session.su on revoked")
 box.schema.user.drop('tester')
 
@@ -187,7 +187,7 @@ conn:close()
 --
 -- gh-3450: box.session.sync() becomes request local.
 --
-cond = fiber.cond()
+local cond = fiber.cond()
 local sync1, sync2
 local started = 0
 function f1()
diff --git a/test/box-tap/trigger_atexit.test.lua b/test/box-tap/trigger_atexit.test.lua
index 59b47aa6a..8baa868c4 100755
--- a/test/box-tap/trigger_atexit.test.lua
+++ b/test/box-tap/trigger_atexit.test.lua
@@ -3,11 +3,9 @@
 
 -- see https://github.com/tarantool/tarantool/issues/583
 
-tap = require 'tap'
-fio = require 'fio'
-log = require 'log'
+local fio = require 'fio'
 
-tempdir = fio.tempdir()
+local tempdir = fio.tempdir()
 
 box.cfg {
     wal_dir = tempdir,
@@ -17,7 +15,7 @@ box.cfg {
     memtx_memory = 104857600 -- for small systems
 }
 
-local function test_replace(old_tuple, new_tuple)
+local function test_replace()
 
 end
 
@@ -27,7 +25,7 @@ box.space.abc:create_index('pk', { type = 'tree' })
 box.space.abc:on_replace(test_replace)
 
 
-cleanup_list = fio.glob(fio.pathjoin(tempdir, '*'))
+local cleanup_list = fio.glob(fio.pathjoin(tempdir, '*'))
 for _, file in pairs(cleanup_list) do
     fio.unlink(file)
 end
diff --git a/test/box-tap/trigger_yield.test.lua b/test/box-tap/trigger_yield.test.lua
index 5d02fea3a..10fca632c 100755
--- a/test/box-tap/trigger_yield.test.lua
+++ b/test/box-tap/trigger_yield.test.lua
@@ -5,21 +5,21 @@ box.cfg{
     log = "tarantool.log"
 }
 
-fiber = require('fiber')
+local fiber = require('fiber')
 
 box.schema.space.create('test')
 box.space.test:create_index('pk')
 
 box.space.test:truncate()
 
-function fail() fiber.sleep(0.0001) error("fail") end
+local function fail() fiber.sleep(0.0001) error("fail") end
 
 box.space.test:on_replace(fail)
 
-function insert() box.space.test:auto_increment{fiber.id()} end
+local function insert() box.space.test:auto_increment{fiber.id()} end
 
-fibers = {}
-for i = 1, 100 do
+local fibers = {}
+for _ = 1, 100 do
     table.insert(fibers, fiber.create(insert))
 end
 
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 06/19] Fix luacheck warnings in test/engine
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (4 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 05/19] Fix luacheck warnings in test/box-tap sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 07/19] Fix luacheck warnings in test/engine_long sergeyb
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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              | 7 ++++++-
 test/engine/box.lua      | 8 +-------
 test/engine/conflict.lua | 6 +++---
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 73f347d68..e0446f9be 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -41,7 +41,7 @@ exclude_files = {
     "test/box/lua/require_mod.lua",
     -- Unused source file, to be dropped (gh-5169).
     "test/box/lua/test_init.lua",
-    "test/engine/**/*.lua",
+    "test/engine/*.test.lua",
     "test/engine_long/*.lua",
     "test/long_run-py/**/*.lua",
     "test/replication/**/*.lua",
@@ -158,3 +158,8 @@ files["test/box-tap/extended_error.test.lua"] = {
         "forbidden_function",
     },
 }
+files["test/engine/conflict.lua"] = {
+    globals = {
+        "test_conflict",
+    },
+}
diff --git a/test/engine/box.lua b/test/engine/box.lua
index e2f04cba2..8558c9ac0 100644
--- a/test/engine/box.lua
+++ b/test/engine/box.lua
@@ -1,11 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
-
-local vinyl = {
-    threads = 3,
-    range_size=1024*64,
-    page_size=1024,
-}
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/engine/conflict.lua b/test/engine/conflict.lua
index b757b81d2..56c70f6ff 100644
--- a/test/engine/conflict.lua
+++ b/test/engine/conflict.lua
@@ -5,7 +5,7 @@ function test_conflict()
     local engine = inspector:get_cfg('engine')
 
     local s = box.schema.space.create('tester', {engine=engine});
-    local i = s:create_index('test_index', {type = 'tree', parts = {1, 'string'}});
+    s:create_index('test_index', {type = 'tree', parts = {1, 'string'}});
 
     local commits = 0
     local function conflict()
@@ -16,8 +16,8 @@ function test_conflict()
     end;
 
     local fiber = require('fiber');
-    local f0 = fiber.create(conflict);
-    local f1 = fiber.create(conflict); -- conflict
+    fiber.create(conflict);
+    fiber.create(conflict); -- conflict
     fiber.sleep(0);
 
     s:drop();
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 07/19] Fix luacheck warnings in test/engine_long
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (5 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 06/19] Fix luacheck warnings in test/engine sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 08/19] Fix luacheck warnings in test/long_run-py sergeyb
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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                | 8 +++++++-
 test/engine_long/suite.lua | 5 +----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index e0446f9be..c7854659c 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -42,7 +42,7 @@ exclude_files = {
     -- Unused source file, to be dropped (gh-5169).
     "test/box/lua/test_init.lua",
     "test/engine/*.test.lua",
-    "test/engine_long/*.lua",
+    "test/engine_long/*.test.lua",
     "test/long_run-py/**/*.lua",
     "test/replication/**/*.lua",
     "test/replication-py/**/*.lua",
@@ -163,3 +163,9 @@ files["test/engine/conflict.lua"] = {
         "test_conflict",
     },
 }
+files["test/engine_long/suite.lua"] = {
+    globals = {
+        "delete_replace_update",
+        "delete_insert",
+    }
+}
diff --git a/test/engine_long/suite.lua b/test/engine_long/suite.lua
index 9ac2bff9f..586160a1a 100644
--- a/test/engine_long/suite.lua
+++ b/test/engine_long/suite.lua
@@ -2,7 +2,7 @@ local function string_function()
     local random_number
     local random_string
     random_string = ""
-    for x = 1,20,1 do
+    for _ = 1,20,1 do
         random_number = math.random(65, 90)
         random_string = random_string .. string.char(random_number)
     end
@@ -10,7 +10,6 @@ local function string_function()
 end
 
 function delete_replace_update(engine_name, iterations)
-    local string_value
     if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
         box.space.tester:drop()
     end
@@ -40,7 +39,6 @@ function delete_replace_update(engine_name, iterations)
         random_number = math.random(1,6)
 
         string_value_3 = string_function()
---      print('<'..counter..'> [' ..  random_number .. '] value_2: ' .. string_value_2 .. ' value_3: ' .. string_value_3)
         if random_number == 1 then
             box.space.tester:delete{string_value_2}
         end
@@ -69,7 +67,6 @@ function delete_replace_update(engine_name, iterations)
 end
 
 function delete_insert(engine_name, iterations)
-    local string_value
     if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
         box.space.tester:drop()
     end
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 08/19] Fix luacheck warnings in test/long_run-py
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (6 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 07/19] Fix luacheck warnings in test/engine_long sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 09/19] Fix luacheck warnings in test/replication sergeyb
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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                         | 7 ++++++-
 test/long_run-py/lua/finalizers.lua | 7 +++----
 test/long_run-py/suite.lua          | 7 ++-----
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index c7854659c..84793362b 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -43,7 +43,6 @@ exclude_files = {
     "test/box/lua/test_init.lua",
     "test/engine/*.test.lua",
     "test/engine_long/*.test.lua",
-    "test/long_run-py/**/*.lua",
     "test/replication/**/*.lua",
     "test/replication-py/**/*.lua",
     "test/sql-tap/**/*.lua",
@@ -169,3 +168,9 @@ files["test/engine_long/suite.lua"] = {
         "delete_insert",
     }
 }
+files["test/long_run-py/suite.lua"] = {
+    globals = {
+        "delete_replace_update",
+        "delete_insert",
+    }
+}
diff --git a/test/long_run-py/lua/finalizers.lua b/test/long_run-py/lua/finalizers.lua
index 69146a323..4e57ebfa6 100644
--- a/test/long_run-py/lua/finalizers.lua
+++ b/test/long_run-py/lua/finalizers.lua
@@ -1,17 +1,16 @@
 #!/usr/bin/env tarantool
 
-function on_gc(t)
+local function on_gc()
 end;
 
-function test_finalizers()
-    local result = {}
+local function test_finalizers()
+    local result = {} -- luacheck: no unused
     local i = 1
     local ffi = require('ffi')
     while true do
         result[i] = ffi.gc(ffi.cast('void *', 0), on_gc)
         i = i + 1
     end
-    return "done"
 end;
 
 test_finalizers()
diff --git a/test/long_run-py/suite.lua b/test/long_run-py/suite.lua
index 0b33dec7d..6fe706366 100644
--- a/test/long_run-py/suite.lua
+++ b/test/long_run-py/suite.lua
@@ -1,9 +1,9 @@
 
-function string_function()
+local function string_function()
     local random_number
     local random_string
     random_string = ""
-    for x = 1,20,1 do
+    for _ = 1,20,1 do
         random_number = math.random(65, 90)
         random_string = random_string .. string.char(random_number)
     end
@@ -11,7 +11,6 @@ function string_function()
 end
 
 function delete_replace_update(engine_name)
-    local string_value
     if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
         box.space.tester:drop()
     end
@@ -41,7 +40,6 @@ function delete_replace_update(engine_name)
         random_number = math.random(1,6)
 
         string_value_3 = string_function()
---      print('<'..counter..'> [' ..  random_number .. '] value_2: ' .. string_value_2 .. ' value_3: ' .. string_value_3)
         if random_number == 1 then
             box.space.tester:delete{string_value_2}
         end
@@ -72,7 +70,6 @@ function delete_replace_update(engine_name)
 end
 
 function delete_insert(engine_name)
-    local string_value
     if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
         box.space.tester:drop()
     end
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 09/19] Fix luacheck warnings in test/replication
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (7 preceding siblings ...)
  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
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 10/19] Fix luacheck warnings in test/replication-py sergeyb
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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

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

* [Tarantool-patches] [PATCH 10/19] Fix luacheck warnings in test/replication-py
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (8 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 09/19] Fix luacheck warnings in test/replication sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 11/19] Fix luacheck warnings in test/sql sergeyb
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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                     | 1 -
 test/replication-py/master.lua  | 2 +-
 test/replication-py/panic.lua   | 2 +-
 test/replication-py/replica.lua | 4 ----
 4 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index bcd2f3a2b..789958fc8 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -44,7 +44,6 @@ exclude_files = {
     "test/engine/*.test.lua",
     "test/engine_long/*.test.lua",
     "test/replication/*.test.lua",
-    "test/replication-py/**/*.lua",
     "test/sql-tap/**/*.lua",
     "test/sql/**/*.lua",
     "test/swim/**/*.lua",
diff --git a/test/replication-py/master.lua b/test/replication-py/master.lua
index e924b5495..b43bafd54 100644
--- a/test/replication-py/master.lua
+++ b/test/replication-py/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-py/panic.lua b/test/replication-py/panic.lua
index 75a738cbb..e72d11419 100644
--- a/test/replication-py/panic.lua
+++ b/test/replication-py/panic.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-py/replica.lua b/test/replication-py/replica.lua
index 32d888eff..a5fa292d2 100644
--- a/test/replication-py/replica.lua
+++ b/test/replication-py/replica.lua
@@ -1,6 +1,4 @@
 #!/usr/bin/env tarantool
-box_cfg_done = false
-
 require('console').listen(os.getenv('ADMIN'))
 
 box.cfg({
@@ -9,5 +7,3 @@ box.cfg({
     memtx_memory        = 107374182,
     replication_timeout = 0.1
 })
-
-box_cfg_done = true
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 11/19] Fix luacheck warnings in test/sql
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (9 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 10/19] Fix luacheck warnings in test/replication-py sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 12/19] Fix luacheck warnings in test/sql-tap sergeyb
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

From: Sergey Bronnikov <sergeyb@tarantool.org>

Part of #4681

Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Reviewed-by: Igor Munkin <imun@tarantool.org>
---
 .luacheckrc                    | 36 +++++++++++++++++++++++++++++++++-
 test/sql/lua/sql_tokenizer.lua |  2 +-
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 789958fc8..646c844d6 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -45,7 +45,7 @@ exclude_files = {
     "test/engine_long/*.test.lua",
     "test/replication/*.test.lua",
     "test/sql-tap/**/*.lua",
-    "test/sql/**/*.lua",
+    "test/sql/*.test.lua",
     "test/swim/**/*.lua",
     "test/var/**/*.lua",
     "test/vinyl/**/*.lua",
@@ -202,3 +202,37 @@ files["test/replication/lua/fast_replica.lua"] = {
         "wait_all",
     },
 }
+files["test/sql-tap/*.lua"] = {
+    ignore = {
+        -- Setting an undefined global variable.
+        -- https://github.com/tarantool/tarantool/issues/5173
+        "111",
+        -- Accessing an undefined global variable.
+        -- https://github.com/tarantool/tarantool/issues/5174
+        "113",
+        -- Unused local variable.
+        -- https://github.com/tarantool/tarantool/issues/5175
+        "211",
+        -- A line consists of nothing but whitespace.
+        -- https://github.com/tarantool/tarantool/issues/5176
+        "611",
+        -- A line contains trailing whitespace.
+        -- https://github.com/tarantool/tarantool/issues/5177
+        "612",
+        -- Trailing whitespace in a string.
+        -- https://github.com/tarantool/tarantool/issues/5178
+        "613",
+        -- Trailing whitespace in a comment.
+        -- https://github.com/tarantool/tarantool/issues/5179
+        "614",
+        -- Inconsistent indentation (SPACE followed by TAB).
+        -- https://github.com/tarantool/tarantool/issues/5180
+        "621",
+        -- Line is too long.
+        -- https://github.com/tarantool/tarantool/issues/5181
+        "631"
+    }
+}
+files["test/sql-tap/lua/sqltester.lua"] = {
+    globals = {"table_match_regex_p"}
+}
diff --git a/test/sql/lua/sql_tokenizer.lua b/test/sql/lua/sql_tokenizer.lua
index 9922d792d..ffe4fb4e8 100644
--- a/test/sql/lua/sql_tokenizer.lua
+++ b/test/sql/lua/sql_tokenizer.lua
@@ -134,7 +134,7 @@ end
 -- @retval Token type. If the rest of the SQL request consists of
 --         spaces and comments, then return TK_EMPTY.
 local function get_next_token(context)
-    local c = ''
+    local c
     repeat
         local i = context.offset
         c = context.sql:sub(i, i)
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 12/19] Fix luacheck warnings in test/sql-tap
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (10 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 11/19] Fix luacheck warnings in test/sql sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 13/19] Fix luacheck warnings in test/swim sergeyb
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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                                   |  1 -
 test/sql-tap/alter.test.lua                   |  4 ++--
 test/sql-tap/analyze5.test.lua                |  2 +-
 test/sql-tap/analyze9.test.lua                | 22 +++++++++----------
 test/sql-tap/between.test.lua                 |  4 ++--
 test/sql-tap/date.test.lua                    |  3 ++-
 test/sql-tap/delete1.test.lua                 |  2 +-
 test/sql-tap/e_delete.test.lua                |  2 +-
 test/sql-tap/e_expr.test.lua                  | 11 +++++-----
 test/sql-tap/func.test.lua                    |  2 +-
 test/sql-tap/func3.test.lua                   |  2 +-
 test/sql-tap/gh-2723-concurrency.test.lua     |  8 +++----
 .../gh-3083-ephemeral-unref-tuples.test.lua   |  2 +-
 .../gh-3307-xfer-optimization-issue.test.lua  |  2 +-
 .../gh-3332-tuple-format-leak.test.lua        |  2 +-
 .../gh2127-indentifier-max-length.test.lua    | 10 ++++-----
 test/sql-tap/identifier-characters.test.lua   |  2 +-
 test/sql-tap/index1.test.lua                  |  3 +--
 test/sql-tap/index7.test.lua                  |  2 +-
 test/sql-tap/join3.test.lua                   |  2 +-
 test/sql-tap/lua-tables.test.lua              |  2 +-
 test/sql-tap/lua/sqltester.lua                | 11 +++++-----
 test/sql-tap/misc1.test.lua                   | 10 ++++-----
 test/sql-tap/misc5.test.lua                   |  2 +-
 test/sql-tap/select1.test.lua                 | 10 ++++-----
 test/sql-tap/select2.test.lua                 |  8 +++----
 test/sql-tap/select4.test.lua                 |  1 -
 test/sql-tap/select5.test.lua                 |  1 -
 test/sql-tap/select9.test.lua                 | 12 ++++------
 test/sql-tap/selectA.test.lua                 |  8 +------
 test/sql-tap/selectB.test.lua                 | 14 ++++++------
 test/sql-tap/selectG.test.lua                 |  1 -
 test/sql-tap/sort.test.lua                    |  2 +-
 test/sql-tap/sql-errors.test.lua              |  2 +-
 test/sql-tap/table.test.lua                   |  3 ++-
 test/sql-tap/tkt-38cb5df375.test.lua          |  1 -
 test/sql-tap/tkt-91e2e8ba6f.test.lua          |  3 ---
 test/sql-tap/tkt-9a8b09f8e6.test.lua          |  3 ---
 test/sql-tap/tkt-bd484a090c.test.lua          |  3 ++-
 test/sql-tap/tkt2192.test.lua                 |  3 ++-
 test/sql-tap/tkt3493.test.lua                 |  3 ---
 test/sql-tap/trigger2.test.lua                |  4 ++--
 test/sql-tap/triggerA.test.lua                |  1 -
 test/sql-tap/where2.test.lua                  |  9 +++-----
 test/sql-tap/where3.test.lua                  |  2 +-
 test/sql-tap/where4.test.lua                  |  4 ++--
 test/sql-tap/where5.test.lua                  |  2 +-
 test/sql-tap/where6.test.lua                  |  2 +-
 test/sql-tap/where7.test.lua                  | 16 +++++++-------
 test/sql-tap/whereA.test.lua                  |  2 +-
 test/sql-tap/whereB.test.lua                  |  2 +-
 test/sql-tap/whereC.test.lua                  |  5 ++---
 test/sql-tap/whereD.test.lua                  |  4 ++--
 test/sql-tap/whereF.test.lua                  |  4 ++--
 test/sql-tap/whereG.test.lua                  |  4 ++--
 test/sql-tap/whereI.test.lua                  |  4 ++--
 test/sql-tap/whereK.test.lua                  |  4 ++--
 test/sql-tap/with1.test.lua                   | 14 ++++++------
 test/sql-tap/with2.test.lua                   | 18 +++++++--------
 59 files changed, 133 insertions(+), 159 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 646c844d6..237b9e456 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -44,7 +44,6 @@ exclude_files = {
     "test/engine/*.test.lua",
     "test/engine_long/*.test.lua",
     "test/replication/*.test.lua",
-    "test/sql-tap/**/*.lua",
     "test/sql/*.test.lua",
     "test/swim/**/*.lua",
     "test/var/**/*.lua",
diff --git a/test/sql-tap/alter.test.lua b/test/sql-tap/alter.test.lua
index 615b9d8a6..4983b711c 100755
--- a/test/sql-tap/alter.test.lua
+++ b/test/sql-tap/alter.test.lua
@@ -90,7 +90,7 @@ test:do_catchsql_test(
 test:do_test(
     "alter-2.3.prepare",
     function()
-        format = {}
+        local format = {}
         format[1] = { name = 'id', type = 'integer'}
         format[2] = { name = 'f2', type = 'number'}
         s = box.schema.create_space('t', {format = format})
@@ -520,7 +520,7 @@ test:do_catchsql_test(
 test:do_test(
     "alter-8.1.0",
     function()
-        format = {}
+        local format = {}
         format[1] = { name = 'id', type = 'scalar'}
         format[2] = { name = 'f2', type = 'scalar'}
         s = box.schema.create_space('T', {format = format})
diff --git a/test/sql-tap/analyze5.test.lua b/test/sql-tap/analyze5.test.lua
index 45e76492a..0ea0ac07e 100755
--- a/test/sql-tap/analyze5.test.lua
+++ b/test/sql-tap/analyze5.test.lua
@@ -26,7 +26,7 @@ local function eqp(sql)
     return test:execsql("EXPLAIN QUERY PLAN"..sql)
 end
 
-local function alpha(blob)
+local function alpha()
     ret = ""
     for _, c in ipairs(X(37, "X!cmd", [=[["split",["blob"],""]]=])) do
         if X(39, "X!cmd", [=[["string","is","alpha",["c"]]]=])
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 02eb49f69..0fcca14fc 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -160,7 +160,7 @@ end
 box.internal.sql_create_function("lrange", "TEXT", lrange)
 
 generate_tens = function(n)
-    tens = {}
+    local tens = {}
     for i = 1, n do
         tens[i] = 10
     end
@@ -168,7 +168,7 @@ generate_tens = function(n)
 end
 
 generate_tens_str = function(n)
-    tens = {}
+    local tens = {}
     for i = 1, n do
         tens[i] = "10"
     end
@@ -239,7 +239,7 @@ test:do_execsql_test(
 insert_filler_rows_n = function(iStart, nCopy, nVal)
     for i = 0, nVal-1 do
         local iVal = iStart+i
-        for j = 0, nCopy-1 do
+        for _ = 0, nCopy-1 do
             box.execute(string.format("INSERT INTO t1 VALUES (null, %s, %s, '%s')", iVal, iVal, iVal))
         end
     end
@@ -609,7 +609,7 @@ test:do_execsql_test(
 test:do_test(
     "10.1.2",
     function()
-        local a = 0
+        local a
         for i = 1, 100 do
             if i > 90 then
                 a = i
@@ -657,7 +657,7 @@ test:do_execsql_test(
 test:do_test(
     "10.2.2",
     function()
-        local a = 0
+        local a
         for i = 1, 100 do
             if i > 90 then
                 a = i
@@ -711,7 +711,7 @@ test:do_execsql_test(
 test:do_test(
     11.1,
     function()
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 10 == 0 then 
                 a = "\"ABC\""
@@ -762,7 +762,7 @@ test:do_execsql_test(
 test:do_test(
     11.5,
     function()
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 10 == 0 then 
                 a = "\"ABC\""
@@ -823,7 +823,7 @@ test:do_execsql_test(
 test:do_test(
     12.1,
     function()
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 10 == 0 then 
                 a = "\"ABC\""
@@ -874,7 +874,7 @@ test:do_execsql_test(
 test:do_test(
     12.5,
     function()
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 10 == 0 then 
                 a = "\"ABC\""
@@ -931,7 +931,7 @@ test:do_test(
         test:execsql("CREATE TABLE t1(id INTEGER PRIMARY KEY AUTOINCREMENT, a TEXT, b INT, c INT, d INT);")
         test:execsql("CREATE INDEX i1 ON t1(a);")
         test:execsql("CREATE INDEX i2 ON t1(b, c);")
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 2 == 1 then
                 a = "\"abc\""
@@ -1161,7 +1161,7 @@ test:do_test(
             INSERT INTO t1 SELECT null, 2*a,2*b,2*c,d FROM t1;
             INSERT INTO t1 SELECT null, 2*a,2*b,2*c,d FROM t1;
         ]])
-        local b = 0
+        local b
         for i = 0, 31 do
             if (i < 8) then
                 b = 0
diff --git a/test/sql-tap/between.test.lua b/test/sql-tap/between.test.lua
index 60d9ae1d6..436106f83 100755
--- a/test/sql-tap/between.test.lua
+++ b/test/sql-tap/between.test.lua
@@ -60,11 +60,11 @@ local function queryplan(sql)
     table.insert(data,x)
     local eqp = box.execute("EXPLAIN QUERY PLAN "..sql.."").rows
     -- puts eqp=$eqp
-    for i, val in ipairs(eqp) do
+    for _, val in ipairs(eqp) do
         --local a = val[1]
         --local b = val[2]
         --local c = val[3]
-        local x = val[4]
+        x = val[4]
         local tab, idx = string.match(x, "TABLE (%w+) USING.* INDEX (%w+)")
 
         if tab then
diff --git a/test/sql-tap/date.test.lua b/test/sql-tap/date.test.lua
index 87fc80db0..b2d59000e 100755
--- a/test/sql-tap/date.test.lua
+++ b/test/sql-tap/date.test.lua
@@ -29,7 +29,8 @@ test:plan(0)
 
 -- Disabled until #3694 is resolved.
 --
-if false then
+local enable_broken_tests = false
+if enable_broken_tests then
 local function datetest(tnum, expr, result)
     test:do_test(
         "date-"..tnum,
diff --git a/test/sql-tap/delete1.test.lua b/test/sql-tap/delete1.test.lua
index bfed3ba9d..7d7146715 100755
--- a/test/sql-tap/delete1.test.lua
+++ b/test/sql-tap/delete1.test.lua
@@ -132,7 +132,7 @@ test:do_test(
     })
 
 -- Tests for data dictionary integration.
-format = {}
+local format = {}
 format[1] = {name = 'id', type = 'scalar'}
 format[2] = {name = 'f', type = 'scalar'}
 s = box.schema.create_space('t', {format = format})
diff --git a/test/sql-tap/e_delete.test.lua b/test/sql-tap/e_delete.test.lua
index a0c944327..d1cf2a79f 100755
--- a/test/sql-tap/e_delete.test.lua
+++ b/test/sql-tap/e_delete.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(18)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index 7ee7a2d98..9aeae0d13 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -1077,7 +1077,7 @@ test:do_execsql_test(
 --
 -- MUST_WORK_TEST prepared statements
 if (0>0) then
-    local function parameter_test(tn, sql, params, result)
+    local function parameter_test(tn, sql, params, result) -- luacheck: no unused args
         stmt = sql_prepare_v2("db", sql, -1)
         for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
             nm = sql_bind_parameter_name(stmt, number)
@@ -1264,7 +1264,7 @@ test:do_execsql_test(
 test:execsql [[
     CREATE TABLE tblname(cname INT PRIMARY KEY);
 ]]
-local function glob(args)
+local function glob()
     return 1
 end
 
@@ -2121,7 +2121,7 @@ test:do_execsql_test(
 local likeargs = {}
 function likefunc(...)
     local args = {...}
-    for i, v in ipairs(args) do
+    for _, v in ipairs(args) do
         table.insert(likeargs, v)
     end
     return 1
@@ -2356,7 +2356,7 @@ end
 local regexpargs = {}
 local function regexpfunc(...)
     local args = {...}
-    for i, v in ipairs(args) do
+    for _, v in ipairs(args) do
         table.insert(regexpargs, v)
     end
     return 1
@@ -2415,7 +2415,7 @@ test:do_test(
 local matchargs = {  }
 local function matchfunc(...)
     local args = {...}
-    for i, v in ipairs(args) do
+    for _, v in ipairs(args) do
         table.insert(matchargs, v)
     end
     return 1
@@ -2678,6 +2678,7 @@ if 0>0 then
     -- comparisons take place.
     --
 
+    -- luacheck: ignore (loop is executed at most once)
     for _ in X(0, "X!foreach", [=[["a b c",[["list",[["expr","3"]],[["expr","4"]],[["expr","5"]]]]]]=]) do
         break
     end
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index 3c088920f..eac930857 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -1472,7 +1472,7 @@ test:do_test(
 test:do_test(
     "func-17.1",
     function()
-        local function testfunc1(args)
+        local function testfunc1()
             X(768, "X!cmd", [=[["error","Error %d with %s percents %p"]]=])
         end
 
diff --git a/test/sql-tap/func3.test.lua b/test/sql-tap/func3.test.lua
index 95d96965e..e9cc45e93 100755
--- a/test/sql-tap/func3.test.lua
+++ b/test/sql-tap/func3.test.lua
@@ -288,7 +288,7 @@ test:do_test(
 --
 -- gh-3929: sql: ANSI aliases for LENGTH().
 --
-suits = {}
+local suits = {}
 suits[1] = {str = '123456789', len = 9}
 suits[2] = {str = '\x80', len = 1}
 suits[3] = {str = '\x61\x62\x63', len = 3}
diff --git a/test/sql-tap/gh-2723-concurrency.test.lua b/test/sql-tap/gh-2723-concurrency.test.lua
index 842142d2d..4b8788ce2 100755
--- a/test/sql-tap/gh-2723-concurrency.test.lua
+++ b/test/sql-tap/gh-2723-concurrency.test.lua
@@ -20,7 +20,7 @@ for id = 1, N do
         end
     )
 end
-for id = 1, N do
+for _ = 1, N do
     ch:get()
 end
 
@@ -46,7 +46,7 @@ for id = 1, N do
         end
     )
 end
-for id = 1, N do
+for _ = 1, N do
     ch:get()
 end
 test:do_test(
@@ -64,7 +64,7 @@ box.execute("create index i1 on t1(b);")
 for id = 1, N*N do
     box.execute(string.format("insert into t1 values(%s, %s, 3)", id, id))
 end
-for id = 1, N do
+for _ = 1, N do
     fiber.create(
         function ()
             box.execute("delete from t1")
@@ -72,7 +72,7 @@ for id = 1, N do
         end
     )
 end
-for id = 1, N do
+for _ = 1, N do
     ch:get()
 end
 test:do_test(
diff --git a/test/sql-tap/gh-3083-ephemeral-unref-tuples.test.lua b/test/sql-tap/gh-3083-ephemeral-unref-tuples.test.lua
index 3807ba665..0e73a940f 100755
--- a/test/sql-tap/gh-3083-ephemeral-unref-tuples.test.lua
+++ b/test/sql-tap/gh-3083-ephemeral-unref-tuples.test.lua
@@ -12,7 +12,7 @@ test:do_test(
 			box.execute("insert into test(id, k) values(" .. i .. "," .. i .. ")")
 		end
 
-		for i = 1, 10000 do
+		for _ = 1, 10000 do
 			box.execute("SELECT id, k FROM test WHERE k IN (5849, 4986, 4997, 5020, 5044, 4990, 5013, 4983)")
 		end
 	end, {
diff --git a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
index bb8a4989e..5b9df5c09 100755
--- a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
+++ b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(39)
 
 local function do_xfer_test(test, test_func, test_name, func, exp, opts)
diff --git a/test/sql-tap/gh-3332-tuple-format-leak.test.lua b/test/sql-tap/gh-3332-tuple-format-leak.test.lua
index 84e67b7ef..05c440e47 100755
--- a/test/sql-tap/gh-3332-tuple-format-leak.test.lua
+++ b/test/sql-tap/gh-3332-tuple-format-leak.test.lua
@@ -21,7 +21,7 @@ test:do_test(
 test:do_test(
     "format-leak",
     function()
-        for i = 1, 100000 do
+        for _ = 1, 100000 do
             box.execute("SELECT id FROM t1 WHERE flags=3 ORDER BY id LIMIT 2");
         end
     end, {
diff --git a/test/sql-tap/gh2127-indentifier-max-length.test.lua b/test/sql-tap/gh2127-indentifier-max-length.test.lua
index 46efffeed..e37281913 100755
--- a/test/sql-tap/gh2127-indentifier-max-length.test.lua
+++ b/test/sql-tap/gh2127-indentifier-max-length.test.lua
@@ -7,7 +7,7 @@ local tt = {}
 local table_word = "АААААААААА"
 
 -- Create 30kb table name
-for i=1,300 do
+for _=1,300 do
 	table.insert(tt, table_word)
 end
 
@@ -27,7 +27,7 @@ local vt = {}
 local view_word = "BBBBBBBBBB"
 
 -- Create 30kb view name
-for i=1, 300 do
+for _=1, 300 do
 	table.insert(vt, view_word)
 end
 
@@ -45,7 +45,7 @@ local it = {}
 local index_word = "ЕЕЕЕЕЕЕЕЕЕ"
 
 -- Create 30kb index name
-for i=1, 300 do
+for _=1, 300 do
 	table.insert(it, index_word)
 end
 
@@ -55,7 +55,7 @@ local field_table = {}
 local field_word = 'ДДДДДДДДД'
 
 -- Create 30kb field name
-for i=1, 300 do
+for _=1, 300 do
 	table.insert(field_table, field_word)
 end
 
@@ -75,7 +75,7 @@ test:do_execsql_test(
 local trig_table = {}
 local trigger_word = "ССССССССС"
 
-for i=1, 300 do
+for _=1, 300 do
 	table.insert(trig_table, trigger_word)
 end
 
diff --git a/test/sql-tap/identifier-characters.test.lua b/test/sql-tap/identifier-characters.test.lua
index 27ed2f889..65a738f5d 100755
--- a/test/sql-tap/identifier-characters.test.lua
+++ b/test/sql-tap/identifier-characters.test.lua
@@ -65,7 +65,7 @@ local testcases = {
 		test:execsql("commit")
 		if ok == false then error(res) end
 	end,
-	function (id) end},
+	function () end},
 	{"trigger name",
 		function (id)
 			test:execsql(string.format([[
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index e173e685c..f1394199e 100755
--- a/test/sql-tap/index1.test.lua
+++ b/test/sql-tap/index1.test.lua
@@ -106,7 +106,6 @@ test:do_test(
 test:do_test(
     "index-2.2",
     function()
-        local msg
         local v , msg= pcall(function()
             test:execsql("CREATE INDEX index1 ON test1(f1, f2, f4, f3)")
             end)
@@ -1019,7 +1018,7 @@ end
 test:do_test(
     "index-22.1.0",
     function()
-        format = {}
+        local format = {}
         format[1] = { name = 'id', type = 'scalar'}
         format[2] = { name = 'f2', type = 'scalar'}
         s = box.schema.create_space('T', {format = format})
diff --git a/test/sql-tap/index7.test.lua b/test/sql-tap/index7.test.lua
index c98f17218..4506fd97e 100755
--- a/test/sql-tap/index7.test.lua
+++ b/test/sql-tap/index7.test.lua
@@ -22,7 +22,7 @@ test:plan(12)
 
 -- Capture the output of a pragma in a TEMP table.
 --
-local function capture_pragma(db, tabname, sql)
+local function capture_pragma()
     once = 1
 end
 
diff --git a/test/sql-tap/join3.test.lua b/test/sql-tap/join3.test.lua
index 876b3121a..030fbaba3 100755
--- a/test/sql-tap/join3.test.lua
+++ b/test/sql-tap/join3.test.lua
@@ -49,7 +49,7 @@ for N=1, bitmask_size do
 end
 -- Joins with a comparison
 --
-local result = {}
+result = {}
 --for _ in X(0, "X!for", [=[["set N 1","$N<=$bitmask_size","incr N"]]=]) do
 for N=1, bitmask_size do
     table.insert(result,N)
diff --git a/test/sql-tap/lua-tables.test.lua b/test/sql-tap/lua-tables.test.lua
index 07e0f6a1e..16c89a8e8 100755
--- a/test/sql-tap/lua-tables.test.lua
+++ b/test/sql-tap/lua-tables.test.lua
@@ -5,7 +5,7 @@ test:plan(14)
 test:do_test(
     "lua-tables-prepare-1",
     function()
-        format = {}
+        local format = {}
         format[1] = { name = 'id', type = 'scalar'}
         format[2] = { name = 'f2', type = 'scalar'}
         s = box.schema.create_space('t', {format = format})
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 9b0218e63..79702f1fb 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -176,8 +176,8 @@ local function execsql(self, sql)
 end
 test.execsql = execsql
 
-local function catchsql(self, sql, expect)
-    r = {pcall(execsql, self, sql) }
+local function catchsql(self, sql)
+    local r = {pcall(execsql, self, sql) }
     if r[1] == true then
         r[1] = 0
     else
@@ -256,7 +256,7 @@ end
 test.sortsql = sortsql
 
 local function catchsql2(self, sql)
-    r = {pcall(execsql2, self, sql) }
+    local r = {pcall(execsql2, self, sql) }
     -- 0 means ok
     -- 1 means not ok
     r[1] = r[1] == true and 0 or 1
@@ -271,8 +271,8 @@ test.catchsql2 = catchsql2
 -- opcode at the beginning.  This procedure can be used to prove
 -- that different SQL statements generate exactly the same VDBE code.
 local function explain_no_trace(self, sql)
-    tr = execsql(self, "EXPLAIN "..sql)
-    for i=1,8 do
+    local tr = execsql(self, "EXPLAIN "..sql)
+    for _=1,8 do
         table.remove(tr,1)
     end
     return tr
@@ -378,7 +378,6 @@ function test.randstr(Length)
     for Loop = 0, 255 do
         Chars[Loop+1] = string.char(Loop)
     end
-    local String = table.concat(Chars)
     local Result = {}
     local Lookup = Chars
     local Range = #Lookup
diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
index 32f38cc97..40b53b3d6 100755
--- a/test/sql-tap/misc1.test.lua
+++ b/test/sql-tap/misc1.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(59)
 
 --!./tcltestrunner.lua
@@ -583,7 +583,7 @@ if (0 > 0) then
             test:execsql("START TRANSACTION")
             test:execsql("UPDATE t1 SET a=0 WHERE 0")
             sql("db2", "test.db")
-            rc = X(371, "X!cmd", [=[["catch","db2 eval {SELECT count(*) FROM t1}","msg"]]=])
+            local rc = X(371, "X!cmd", [=[["catch","db2 eval {SELECT count(*) FROM t1}","msg"]]=])
             return table.insert(rc,msg) or rc
             -- v2 result: {1 {database is locked}}
         end, {
@@ -596,7 +596,7 @@ if (0 > 0) then
         "misc1-11.2",
         function()
             test:execsql("COMMIT")
-            rc = X(377, "X!cmd", [=[["catch","db2 eval {SELECT count(*) FROM t1}","msg"]]=])
+            local rc = X(377, "X!cmd", [=[["catch","db2 eval {SELECT count(*) FROM t1}","msg"]]=])
             db2("close")
             return table.insert(rc,msg) or rc
         end, {
@@ -726,7 +726,7 @@ test:do_execsql_test(
 -- MUST_WORK_TEST collate
 if 0>0 then
     db("collate", "numeric", "numeric_collate")
-    local function numeric_collate(lhs, rhs)
+    local function numeric_collate1(lhs, rhs)
         if (lhs == rhs)
         then
             return 0
@@ -736,7 +736,7 @@ if 0>0 then
 
     -- Mimic the sql 2 collation type TEXT.
     db("collate", "text", "text_collate")
-    local function numeric_collate(lhs, rhs)
+    local function numeric_collate2()
         return X(34, "X!cmd", [=[["string","compare",["lhs"],["rhs"]]]=])
     end
 
diff --git a/test/sql-tap/misc5.test.lua b/test/sql-tap/misc5.test.lua
index 2725e6782..7a8da91b4 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -291,7 +291,7 @@ test:do_test(
         test:execsql "CREATE TABLE t1(x  INT primary key)"
         sql = "INSERT INTO t1 VALUES("
         tail = ""
-        for i = 0, 199, 1 do
+        for _ = 0, 199, 1 do
             sql = sql .. "(1+"
             tail = tail .. ")"
         end
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index fbebfab37..4eb30e59e 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1,6 +1,7 @@
 #!/usr/bin/env tarantool
 test = require("sqltester")
 test:plan(173)
+local enable_broken_tests = false
 
 function set_full_column_names(value)
     box.space._session_settings:update('sql_full_column_names', {
@@ -1178,7 +1179,7 @@ test:do_execsql2_test(
 test:do_test(
     "select1-6.9.7",
     function()
-        x = test:execsql2 [[
+        local x = test:execsql2 [[
             SELECT * FROM test1 a, (select 5, 6) LIMIT 1
         ]]
         for i, tmp in ipairs(x) do
@@ -1196,7 +1197,7 @@ test:do_test(
 test:do_test(
     "select1-6.9.8",
     function()
-        x = test:execsql2 [[
+        local x = test:execsql2 [[
             SELECT * FROM test1 a, (select 5 AS x, 6 AS y) AS b LIMIT 1
         ]]
         for i, tmp in ipairs(x) do
@@ -1512,8 +1513,7 @@ test:do_execsql_test(
 -- TODO: This test is failing because f1 is now being loaded off the
 -- disk as a vdbe integer, not a string. Hence the value of f1/(f1-11)
 -- changes because of rounding. Disable the test for now.
-if false
- then
+if enable_broken_tests then
     test:do_execsql_test(
         "select1-8.4",
         [[
@@ -1969,7 +1969,7 @@ test:do_test(
             START TRANSACTION;
             INSERT INTO abc VALUES(1, 1, 1);
         ]]
-        for i = 0,9,1 do
+        for _ = 0,9,1 do
             test:execsql [[
                 INSERT INTO abc SELECT a+(select max(a) FROM abc), b+(select max(a) FROM abc), c+(select max(a) FROM abc) FROM abc;
             ]]
diff --git a/test/sql-tap/select2.test.lua b/test/sql-tap/select2.test.lua
index 24fad2149..5c9e4cad5 100755
--- a/test/sql-tap/select2.test.lua
+++ b/test/sql-tap/select2.test.lua
@@ -37,8 +37,8 @@ test:do_test(
         local data = test:execsql "SELECT DISTINCT f1 FROM tbl1 ORDER BY f1"
         for _, f1 in ipairs(data) do
             table.insert(r, f1..":")
-            local data = test:execsql( string.format("SELECT f2 FROM tbl1 WHERE f1=%s ORDER BY f2", f1))
-            for _, f2 in ipairs(data) do
+            local d = test:execsql( string.format("SELECT f2 FROM tbl1 WHERE f1=%s ORDER BY f2", f1))
+            for _, f2 in ipairs(d) do
                 table.insert(r, f2)
             end
         end
@@ -56,8 +56,8 @@ test:do_test(
         local data = test:execsql "SELECT DISTINCT f1 FROM tbl1 WHERE f1>3 AND f1<5"
         for _, f1 in ipairs(data) do
             table.insert(r, f1..":")
-            local data = test:execsql( string.format("SELECT f2 FROM tbl1 WHERE f1=%s ORDER BY f2", f1))
-            for _, f2 in ipairs(data) do
+            local d = test:execsql( string.format("SELECT f2 FROM tbl1 WHERE f1=%s ORDER BY f2", f1))
+            for _, f2 in ipairs(d) do
                 table.insert(r, f2)
             end
         end
diff --git a/test/sql-tap/select4.test.lua b/test/sql-tap/select4.test.lua
index 23cf1bf1b..26f80d57e 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -30,7 +30,6 @@ test:execsql [[
     CREATE TABLE t1(n int primary key, log int);
     START TRANSACTION;
 ]]
-local i, j
 for i = 1, 31, 1 do
     j = 0
     while math.pow(2, j) < i do
diff --git a/test/sql-tap/select5.test.lua b/test/sql-tap/select5.test.lua
index d34de3139..309043448 100755
--- a/test/sql-tap/select5.test.lua
+++ b/test/sql-tap/select5.test.lua
@@ -27,7 +27,6 @@ test:execsql [[
     CREATE TABLE t1(x int primary key, y int);
     START TRANSACTION;
 ]]
-local i, j
 for i = 1, 31, 1 do
     j = 0
     while math.pow(2, j) < i do
diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
index 1ae16a658..3a432a7a7 100755
--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(21157)
 -- it is bad idea to store 20k positive test results in git
 test.silent = true
@@ -60,10 +60,8 @@ function subrange(t, first, last)
 end
 
 local function test_compound_select(testname, sql, result)
-    local nCol = 1
     local A = box.execute(sql) --test.box(sql)
-    nCol = #A.metadata
-    A = A.rows
+    local nCol = #A.metadata
     local nRow = #result / nCol
     local compound_sql = sql
     test:do_execsql_test(
@@ -274,10 +272,8 @@ test:do_execsql_test(
         -- </select9-2.0>
     })
 
-local t1_space_id = ""
-local t2_space_id = ""
-t1_space_id = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
-t2_space_id = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
+local t1_space_id = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
+local t2_space_id = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
 --X(276, "X!cmd", [=[["db","eval","SELECT * from _space where name='t2'","data","\n  set t2_space_id $data(id)\n"]]=])
 --local function reverse(lhs, rhs)
 --    return X(283, "X!cmd", [=[["string","compare",["rhs"],["lhs"]]]=])
diff --git a/test/sql-tap/selectA.test.lua b/test/sql-tap/selectA.test.lua
index 5cc69ef61..d986f233e 100755
--- a/test/sql-tap/selectA.test.lua
+++ b/test/sql-tap/selectA.test.lua
@@ -78,9 +78,6 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-end
 test:do_execsql_test(
     "selectA-2.1",
     [[
@@ -2356,10 +2353,7 @@ test:do_execsql_test(
 --
 -- MUST_WORK_TEST
 -- TODO stored procedures are not supported by now
-if (0 > 0)
- then
-end
-local function f(args)
+local function f()
     return 1
 end
 
diff --git a/test/sql-tap/selectB.test.lua b/test/sql-tap/selectB.test.lua
index 56d4b9d1b..934aa2db9 100755
--- a/test/sql-tap/selectB.test.lua
+++ b/test/sql-tap/selectB.test.lua
@@ -26,11 +26,11 @@ local function test_transform(testname, sql1, sql2, results)
     local vdbe1 = {  }
     local vdbe2 = {  }
     local data = box.execute("explain "..sql1)
-    for i, line in ipairs(data) do
+    for _, line in ipairs(data) do
         table.insert(vdbe1, line[2])
     end
     data = box.execute("explain "..sql2)
-    for i, line in ipairs(data) do
+    for _, line in ipairs(data) do
         table.insert(vdbe2, line[2])
     end
     test:do_test(
@@ -211,10 +211,7 @@ test:do_execsql_test(
     })
 
 for ii = 3, 6, 1 do
-    if ii == 4 then
-        -- TODO
-        --X(2, "X!cmd", [=[["optimization_control","db","query-flattener","off"]]=])
-    elseif ii == 5 then
+    if ii == 5 then
         --X(2, "X!cmd", [=[["optimization_control","db","query-flattener","on"]]=])
         test:do_execsql_test(
             "selectB-5.0",
@@ -231,7 +228,10 @@ for ii = 3, 6, 1 do
                 -- </selectB-5.0>
             })
 
-    elseif ii == 6 then
+    --elseif ii == 4 then
+        -- TODO
+        --X(2, "X!cmd", [=[["optimization_control","db","query-flattener","off"]]=])
+    --elseif ii == 6 then
         --X(2, "X!cmd", [=[["optimization_control","db","query-flattener","off"]]=])
     end
     test:do_execsql_test(
diff --git a/test/sql-tap/selectG.test.lua b/test/sql-tap/selectG.test.lua
index 0ca066d1c..b1644190c 100755
--- a/test/sql-tap/selectG.test.lua
+++ b/test/sql-tap/selectG.test.lua
@@ -36,7 +36,6 @@ test:do_test(
     function()
         local sql_arr = {[[CREATE TABLE t1(x INT primary key);
             INSERT INTO t1(x) VALUES]]}
-        local i
         for i = 1, 100000-1, 1 do
             table.insert(sql_arr, "("..i.."),")
         end
diff --git a/test/sql-tap/sort.test.lua b/test/sql-tap/sort.test.lua
index 36074d6ef..0ad2f4ef4 100755
--- a/test/sql-tap/sort.test.lua
+++ b/test/sql-tap/sort.test.lua
@@ -761,7 +761,7 @@ test:do_execsql_test(
 --
 -- MUST_WORK_TEST? special sql functions (sql_soft_heap_limit, sql_test_control...)
 if (0 > 0) then
-local function cksum(x)
+local function cksum()
     local i1 = 1
     local i2 = 2
     X(503, "X!cmd", [=[["binary","scan",["x"],"c*","L"]]=])
diff --git a/test/sql-tap/sql-errors.test.lua b/test/sql-tap/sql-errors.test.lua
index 5ec94bfe3..14294f706 100755
--- a/test/sql-tap/sql-errors.test.lua
+++ b/test/sql-tap/sql-errors.test.lua
@@ -6,7 +6,7 @@ test:execsql([[
 	CREATE TABLE t0 (i INT PRIMARY KEY, a INT);
 	CREATE VIEW v0 AS SELECT * FROM t0;
 ]])
-format = {}
+local format = {}
 for i = 1, 2001 do format[i] = {name = 'A' .. i, type = 'unsigned'} end
 s0 = box.schema.space.create('S0', {format = format})
 i0 = s0:create_index('I0')
diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua
index 1b4ec1173..86d20e09f 100755
--- a/test/sql-tap/table.test.lua
+++ b/test/sql-tap/table.test.lua
@@ -1,6 +1,7 @@
 #!/usr/bin/env tarantool
 test = require("sqltester")
 test:plan(79)
+enable_broken_tests = false
 
 --!./tcltestrunner.lua
 -- 2001 September 15
@@ -947,7 +948,7 @@ test:do_execsql_test(
 --
 --  Disabled until #3694 is resolved.
 --
-if false then
+if enable_broken_tests then
 test:do_execsql_test(
     "table-13.1",
     [[
diff --git a/test/sql-tap/tkt-38cb5df375.test.lua b/test/sql-tap/tkt-38cb5df375.test.lua
index a7587ef3a..32ac6fdcd 100755
--- a/test/sql-tap/tkt-38cb5df375.test.lua
+++ b/test/sql-tap/tkt-38cb5df375.test.lua
@@ -31,7 +31,6 @@ local function lrange(arr, start_num, end_num)
     return tmp
 end
 
-local ii
 test:do_execsql_test(
     "tkt-38cb5df375.0",
     [[
diff --git a/test/sql-tap/tkt-91e2e8ba6f.test.lua b/test/sql-tap/tkt-91e2e8ba6f.test.lua
index b12b6e0f3..d1ed6a653 100755
--- a/test/sql-tap/tkt-91e2e8ba6f.test.lua
+++ b/test/sql-tap/tkt-91e2e8ba6f.test.lua
@@ -82,9 +82,6 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-end
 test:do_execsql_test(
     1.7,
     [[
diff --git a/test/sql-tap/tkt-9a8b09f8e6.test.lua b/test/sql-tap/tkt-9a8b09f8e6.test.lua
index cb5348ab4..f90782cbd 100755
--- a/test/sql-tap/tkt-9a8b09f8e6.test.lua
+++ b/test/sql-tap/tkt-9a8b09f8e6.test.lua
@@ -22,9 +22,6 @@ test:plan(49)
 -- ["source",[["testdir"],"\/tester.tcl"]]
 testprefix = "tkt-9a8b09f8e6"
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-end
 test:do_execsql_test(
     1.1,
     [[
diff --git a/test/sql-tap/tkt-bd484a090c.test.lua b/test/sql-tap/tkt-bd484a090c.test.lua
index 0347fd426..9eab5fe73 100755
--- a/test/sql-tap/tkt-bd484a090c.test.lua
+++ b/test/sql-tap/tkt-bd484a090c.test.lua
@@ -2,6 +2,7 @@
 test = require("sqltester")
 --test:plan(2)
 test:plan(0)
+enable_broken_tests = false
 
 --!./tcltestrunner.lua
 -- 2011 June 21
@@ -22,7 +23,7 @@ testprefix = "tkt-bd484a090c"
 
 -- Disabled until #3694 is resolved.
 --
-if false then
+if enable_broken_tests then
 test:do_test(
     1.1,
     function()
diff --git a/test/sql-tap/tkt2192.test.lua b/test/sql-tap/tkt2192.test.lua
index 52309ff2b..763cae782 100755
--- a/test/sql-tap/tkt2192.test.lua
+++ b/test/sql-tap/tkt2192.test.lua
@@ -2,6 +2,7 @@
 test = require("sqltester")
 -- test:plan(6)
 test:plan(4)
+local enable_broken_tests = false
 
 --!./tcltestrunner.lua
 -- 2007 January 26
@@ -26,7 +27,7 @@ test:plan(4)
 
 --  Disabled until #3694 is resolved.
 --
-if false then
+if enable_broken_tests then
 test:do_execsql_test(
     "tkt2192-1.1",
     [[
diff --git a/test/sql-tap/tkt3493.test.lua b/test/sql-tap/tkt3493.test.lua
index 7ceec4702..6ec4214db 100755
--- a/test/sql-tap/tkt3493.test.lua
+++ b/test/sql-tap/tkt3493.test.lua
@@ -255,9 +255,6 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-end
 test:do_execsql_test(
     "tkt3493-3.2.1",
     [[
diff --git a/test/sql-tap/trigger2.test.lua b/test/sql-tap/trigger2.test.lua
index 192b707d3..b412e581c 100755
--- a/test/sql-tap/trigger2.test.lua
+++ b/test/sql-tap/trigger2.test.lua
@@ -126,12 +126,12 @@ for _, tbl_defn in ipairs(tbl_definitions) do
             raw_result = test:execsql [[
                 SELECT * FROM rlog ORDER BY idx;
             ]]
-            for k,v in pairs(raw_result) do table.insert(r, v) end
+            for _,v in pairs(raw_result) do table.insert(r, v) end
 
             raw_result = test:execsql [[
                 SELECT * FROM clog ORDER BY idx;
             ]]
-            for k,v in pairs(raw_result) do table.insert(r, v) end
+            for _,v in pairs(raw_result) do table.insert(r, v) end
             
             return r
         end, {
diff --git a/test/sql-tap/triggerA.test.lua b/test/sql-tap/triggerA.test.lua
index fac51ca14..8dfd4dfab 100755
--- a/test/sql-tap/triggerA.test.lua
+++ b/test/sql-tap/triggerA.test.lua
@@ -46,7 +46,6 @@ test:do_test(
                 INSERT INTO t1 VALUES(%d,'%s');
                 INSERT INTO t2 VALUES(20-%d,%d,'%s');
             ]], i, word, i, j, word))
-            i = i + 1
         end
         return test:execsql [[
             SELECT count(*) FROM t1 UNION ALL SELECT count(*) FROM t2;
diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua
index f267be8e6..838e58be6 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -1,9 +1,6 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
-yaml = require("yaml")
-fio = require("fio")
-
-ffi = require("ffi")
+local test = require("sqltester")
+local ffi = require("ffi")
 test:plan(74)
 
 ffi.cdef[[
@@ -115,7 +112,7 @@ local function queryplan(sql)
                 table.insert(data, tab)
                 table.insert(data, idx)
             else
-                as, tab = string.match(v, "TABLE (%w+ AS) (%w+)")
+                _, tab = string.match(v, "TABLE (%w+ AS) (%w+)")
                 if tab == nil  then
                     tab = string.match(v, "TABLE (%w+)")
                 end
diff --git a/test/sql-tap/where3.test.lua b/test/sql-tap/where3.test.lua
index ae9e37f61..4a8798eeb 100755
--- a/test/sql-tap/where3.test.lua
+++ b/test/sql-tap/where3.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(83)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/where4.test.lua b/test/sql-tap/where4.test.lua
index e38972666..65e7f9337 100755
--- a/test/sql-tap/where4.test.lua
+++ b/test/sql-tap/where4.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(8)
 
 --!./tcltestrunner.lua
@@ -23,7 +23,7 @@ test:plan(8)
 -- $Id: where4.test,v 1.6 2007/12/10 05:03:48 danielk1977 Exp $
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "where4"
+local testprefix = "where4"
 
 
 -- Build some test data
diff --git a/test/sql-tap/where5.test.lua b/test/sql-tap/where5.test.lua
index 749201564..655c1b72b 100755
--- a/test/sql-tap/where5.test.lua
+++ b/test/sql-tap/where5.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(50)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/where6.test.lua b/test/sql-tap/where6.test.lua
index 5fb79fa2a..f9de30dbc 100755
--- a/test/sql-tap/where6.test.lua
+++ b/test/sql-tap/where6.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(20)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/where7.test.lua b/test/sql-tap/where7.test.lua
index 70209545d..d3e7d91fe 100755
--- a/test/sql-tap/where7.test.lua
+++ b/test/sql-tap/where7.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(2023)
 
 --!./tcltestrunner.lua
@@ -229,7 +229,7 @@ test:do_test(
 test:do_test(
     "where7-1.20",
     function()
-        sql = "SELECT a FROM t1 WHERE a=11 OR b=11"
+        local sql = "SELECT a FROM t1 WHERE a=11 OR b=11"
         for i = 12, 100 do
             sql = sql .. string.format(" OR a=%s OR b=%s", i, i)
         end
@@ -244,7 +244,7 @@ test:do_test(
 test:do_test(
     "where7-1.21",
     function()
-        sql = "SELECT a FROM t1 WHERE b=11 OR c=11"
+        local sql = "SELECT a FROM t1 WHERE b=11 OR c=11"
         for i = 12, 100 do
             sql = sql .. string.format(" OR b=%s OR c=%s", i, i)
         end
@@ -259,7 +259,7 @@ test:do_test(
 test:do_test(
     "where7-1.22",
     function()
-        sql = "SELECT a FROM t1 WHERE (b=11 OR c=11"
+        local sql = "SELECT a FROM t1 WHERE (b=11 OR c=11"
         for i = 12, 100 do
             sql = sql .. string.format(" OR b=%s OR c=%s", i, i)
         end
@@ -274,7 +274,7 @@ test:do_test(
 test:do_test(
     "where7-1.23",
     function()
-        sql = "SELECT a FROM t1 WHERE (b=11 OR c=11"
+        local sql = "SELECT a FROM t1 WHERE (b=11 OR c=11"
         for i = 12, 100 do
             sql = sql .. string.format(" OR (b=%s AND d!=0) OR (c=%s AND d IS NOT NULL)", i, i)
         end
@@ -289,7 +289,7 @@ test:do_test(
 test:do_test(
     "where7-1.31",
     function()
-        sql = "SELECT a FROM t1 WHERE (a=11 AND b=11)"
+        local sql = "SELECT a FROM t1 WHERE (a=11 AND b=11)"
         for i = 12, 100 do
             sql = sql .. string.format(" OR (a=%s AND b=%s)", i, i)
         end
@@ -304,7 +304,7 @@ test:do_test(
 test:do_test(
     "where7-1.32",
     function()
-        sql = "SELECT a FROM t1 WHERE (b=11 AND c=11)"
+        local sql = "SELECT a FROM t1 WHERE (b=11 AND c=11)"
         for i = 12, 100 do
             sql = sql .. string.format(" OR (b=%s AND c=%s)", i, i)
         end
@@ -319,7 +319,7 @@ test:do_test(
 test:do_test(
     "where7-AST-depth-limit",
     function()
-        sql = "SELECT a FROM t1 WHERE a = 0"
+        local sql = "SELECT a FROM t1 WHERE a = 0"
         for i = 1, 199 do
             sql = sql .. string.format(" OR a = %s", i)
         end
diff --git a/test/sql-tap/whereA.test.lua b/test/sql-tap/whereA.test.lua
index a49d1c05c..968ceb2e9 100755
--- a/test/sql-tap/whereA.test.lua
+++ b/test/sql-tap/whereA.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(17)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/whereB.test.lua b/test/sql-tap/whereB.test.lua
index d98645fdc..c7ef910d1 100755
--- a/test/sql-tap/whereB.test.lua
+++ b/test/sql-tap/whereB.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(63)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/whereC.test.lua b/test/sql-tap/whereC.test.lua
index 89459dee3..231404cea 100755
--- a/test/sql-tap/whereC.test.lua
+++ b/test/sql-tap/whereC.test.lua
@@ -1,6 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
-local yaml = require('yaml')
+local test = require("sqltester")
 test:plan(41)
 
 --!./tcltestrunner.lua
@@ -17,7 +16,7 @@ test:plan(41)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereC"
+local testprefix = "whereC"
 test:do_execsql_test(
     1.0,
     [[
diff --git a/test/sql-tap/whereD.test.lua b/test/sql-tap/whereD.test.lua
index 14dc8d3bd..26221ec12 100755
--- a/test/sql-tap/whereD.test.lua
+++ b/test/sql-tap/whereD.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(36)
 
 --!./tcltestrunner.lua
@@ -19,7 +19,7 @@ test:plan(36)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereD"
+local testprefix = "whereD"
 test:do_execsql_test(
     1.1,
     [[
diff --git a/test/sql-tap/whereF.test.lua b/test/sql-tap/whereF.test.lua
index 5a894b748..64e51fbf0 100755
--- a/test/sql-tap/whereF.test.lua
+++ b/test/sql-tap/whereF.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(13)
 
 --!./tcltestrunner.lua
@@ -48,7 +48,7 @@ test:plan(13)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereF"
+local testprefix = "whereF"
 test:do_execsql_test(
     1.0,
     [[
diff --git a/test/sql-tap/whereG.test.lua b/test/sql-tap/whereG.test.lua
index 590027023..2fbc6c5b3 100755
--- a/test/sql-tap/whereG.test.lua
+++ b/test/sql-tap/whereG.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(23)
 
 --!./tcltestrunner.lua
@@ -18,7 +18,7 @@ test:plan(23)
 -- likelihood() functions.
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereG"
+local testprefix = "whereG"
 test:do_execsql_test(
     "whereG-1.0",
     [[
diff --git a/test/sql-tap/whereI.test.lua b/test/sql-tap/whereI.test.lua
index 3ae5b82f2..79c6bcfe5 100755
--- a/test/sql-tap/whereI.test.lua
+++ b/test/sql-tap/whereI.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(7)
 
 --!./tcltestrunner.lua
@@ -20,7 +20,7 @@ test:plan(7)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereI"
+local testprefix = "whereI"
 test:do_execsql_test(1.0, [[
     CREATE TABLE t1(a INT, b TEXT, c TEXT, PRIMARY KEY(a));
     INSERT INTO t1 VALUES(1, 'a', 'z');
diff --git a/test/sql-tap/whereK.test.lua b/test/sql-tap/whereK.test.lua
index 58e3146a7..0ca7fff0d 100755
--- a/test/sql-tap/whereK.test.lua
+++ b/test/sql-tap/whereK.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(10)
 
 --!./tcltestrunner.lua
@@ -23,7 +23,7 @@ test:plan(10)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "whereK"
+local testprefix = "whereK"
 test:do_execsql_test(1.1, [[
   CREATE TABLE t1(a INT ,b INT ,c INT , primary key (a,b,c));
   WITH RECURSIVE c(x) AS (VALUES(0) UNION ALL SELECT x+1 FROM c WHERE x<99)
diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua
index 75935108c..2a91085a2 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(64)
 
 --!./tcltestrunner.lua
@@ -18,7 +18,7 @@ test:plan(64)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "with1"
+local testprefix = "with1"
 -- if X(0, "X!capable", [["!cte"]]) then
 --   test:finish_test()
 --  return 
@@ -623,7 +623,7 @@ test:do_execsql_test("8.2-soduko", [[
 -- Some tests that use LIMIT and OFFSET in the definition of recursive CTEs.
 --
 -- I = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }
-function limit_test(tn, iLimit, iOffset)
+local function limit_test(tn, iLimit, iOffset)
     local last = 20 - 1
     local result = {}
     -- if X(0, "X!expr01", [["$iOffset < 0"]]) then
@@ -631,13 +631,13 @@ function limit_test(tn, iLimit, iOffset)
         iOffset = 0
     end
     -- if X(0, "X!expr01", [["$iLimit < 0 "]]) then
-    if iLimit < 0 then
-        -- result = X(467, "X!cmd", [=[["lrange",["::I"],["iOffset"],"end"]]=])
-        -- last is 20
-    else
+    if iLimit >= 0 then
         -- result = X(467, "X!cmd", [=[["lrange",["::I"],["iOffset"],[["expr",[["iLimit"],"+",["iOffset"],"-1"]]]]]=])
         last = iLimit + iOffset - 1
         if last > 20 then last = 20 - 1 end
+    --else
+        -- result = X(467, "X!cmd", [=[["lrange",["::I"],["iOffset"],"end"]]=])
+        -- last is 20
     end
 
     for i = iOffset, last do
diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua
index 1aa39b32e..cdf1d75a2 100755
--- a/test/sql-tap/with2.test.lua
+++ b/test/sql-tap/with2.test.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-test = require("sqltester")
+local test = require("sqltester")
 test:plan(59)
 
 --!./tcltestrunner.lua
@@ -18,7 +18,7 @@ test:plan(59)
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
 -- ["source",[["testdir"],"\/tester.tcl"]]
-testprefix = "with2"
+local testprefix = "with2"
 
 test:do_execsql_test(
     1.0,
@@ -386,22 +386,22 @@ genstmt(255), {
 -- Check that adding a WITH clause to an INSERT disables the xfer
 -- optimization.
 
-local function do_xfer_test(test, test_func, test_name, func, exp, opts)
-    local opts = opts or {}
+local function do_xfer_test(test_arg, test_func, test_name, func, exp, opts)
+    opts = opts or {}
     local exp_xfer_count = opts.exp_xfer_count
     local before = box.stat.sql().sql_xfer_count
-    test_func(test, test_name, func, exp)
+    test_func(test_arg, test_name, func, exp)
     local after = box.stat.sql().sql_xfer_count
     test:is(after - before, exp_xfer_count,
                    test_name .. '-xfer-count')
 end
 
-test.do_execsql_xfer_test = function(test, test_name, func, exp, opts)
-    do_xfer_test(test, test.do_execsql_test, test_name, func, exp, opts)
+test.do_execsql_xfer_test = function(test_arg, test_name, func, exp, opts)
+    do_xfer_test(test_arg, test_arg.do_execsql_test, test_name, func, exp, opts)
 end
 
-test.do_catchsql_xfer_test = function(test, test_name, func, exp, opts)
-    do_xfer_test(test, test.do_catchsql_test, test_name, func, exp, opts)
+test.do_catchsql_xfer_test = function(test_arg, test_name, func, exp, opts)
+    do_xfer_test(test_arg, test_arg.do_catchsql_test, test_name, func, exp, opts)
 end
 
 test:do_execsql_test(
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 13/19] Fix luacheck warnings in test/swim
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (11 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 12/19] Fix luacheck warnings in test/sql-tap sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 14/19] Fix luacheck warnings in test/vinyl sergeyb
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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       | 12 +++++++++++-
 test/swim/box.lua |  4 ++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 237b9e456..fd0c5c54a 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -45,7 +45,7 @@ exclude_files = {
     "test/engine_long/*.test.lua",
     "test/replication/*.test.lua",
     "test/sql/*.test.lua",
-    "test/swim/**/*.lua",
+    "test/swim/*.test.lua",
     "test/var/**/*.lua",
     "test/vinyl/**/*.lua",
     "test/wal_off/*.lua",
@@ -235,3 +235,13 @@ files["test/sql-tap/*.lua"] = {
 files["test/sql-tap/lua/sqltester.lua"] = {
     globals = {"table_match_regex_p"}
 }
+files["test/swim/box.lua"] = {
+    globals = {
+        "listen_port",
+        "listen_uri",
+        "uuid",
+        "uri",
+        "swim",
+        "fiber"
+    }
+}
diff --git a/test/swim/box.lua b/test/swim/box.lua
index a603777e0..41791013b 100644
--- a/test/swim/box.lua
+++ b/test/swim/box.lua
@@ -12,8 +12,8 @@ box.cfg{}
 -- with encryption. Otherwise they can accidentally discover
 -- SWIM instances from other tests.
 --
-enc_key = box.info.uuid
-enc_algo = 'aes128'
+local enc_key = box.info.uuid
+local enc_algo = 'aes128'
 
 --
 -- Wrap swim.new with a codec to prevent test workers affecting
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 14/19] Fix luacheck warnings in test/vinyl
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (12 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 13/19] Fix luacheck warnings in test/swim sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 15/19] Fix luacheck warnings in test/wal_off sergeyb
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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                 |  2 +-
 test/vinyl/large.lua        |  3 +--
 test/vinyl/stress.lua       | 22 +++++++++++-----------
 test/vinyl/txn_proxy.lua    |  6 +++---
 test/vinyl/upgrade/fill.lua |  8 ++++----
 test/vinyl/vinyl.lua        | 17 -----------------
 6 files changed, 20 insertions(+), 38 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index fd0c5c54a..aa79622d6 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -47,7 +47,7 @@ exclude_files = {
     "test/sql/*.test.lua",
     "test/swim/*.test.lua",
     "test/var/**/*.lua",
-    "test/vinyl/**/*.lua",
+    "test/vinyl/*.test.lua",
     "test/wal_off/*.lua",
     "test/xlog/**/*.lua",
     "test/xlog-py/**/*.lua",
diff --git a/test/vinyl/large.lua b/test/vinyl/large.lua
index e10e94c1a..a997aec7e 100644
--- a/test/vinyl/large.lua
+++ b/test/vinyl/large.lua
@@ -1,5 +1,4 @@
-fiber = require('fiber')
-digest = require('digest')
+local digest = require('digest')
 
 local PAGE_SIZE = 1024
 local RANGE_SIZE = 64 * PAGE_SIZE
diff --git a/test/vinyl/stress.lua b/test/vinyl/stress.lua
index 5e8d89795..15a999393 100644
--- a/test/vinyl/stress.lua
+++ b/test/vinyl/stress.lua
@@ -33,8 +33,8 @@ local spaces = {box.space.s1, box.space.s2, box.space.s3, box.space.s4,
 local max_data_size = box.cfg.vinyl_page_size * 1.5
 
 local function t1(ch, time_limit)
-    local t1 = fiber.time()
-    while fiber.time() - t1 < time_limit do
+    local time = fiber.time()
+    while fiber.time() - time < time_limit do
         local k = math.random(10000)
         local t = math.random(80)
         local data = string.char(math.random(string.byte('Z') - string.byte('A')) + string.byte('A') - 1)
@@ -56,13 +56,13 @@ local function t1(ch, time_limit)
 end;
 
 local function t2(ch, time_limit)
-    local t1 = fiber.time()
-    while fiber.time() - t1 < time_limit do
+    local time = fiber.time()
+    while fiber.time() - time < time_limit do
         local k = math.random(10000)
         local t = math.random(16)
         local space = spaces[math.fmod(t, #spaces) + 1]
         if t < 12 then
-            local l = space:get({k})
+            space:get({k})
         else
             space:delete({k})
         end
@@ -71,9 +71,9 @@ local function t2(ch, time_limit)
 end;
 
 local function t3(ch, time_limit)
-    local t1 = fiber.time()
+    local time = fiber.time()
     local i = 0
-    while fiber.time() - t1 < time_limit do
+    while fiber.time() - time < time_limit do
         i = i + 1
         local k = math.random(10000)
         local t = math.random(20)
@@ -99,19 +99,19 @@ local function stress(time_limit)
 
     math.randomseed(os.time());
 
-    for i = 1, 6 do
+    for _ = 1, 6 do
         fiber.create(t1, ch, time_limit)
     end;
 
-    for i = 1, 6 do
+    for _ = 1, 6 do
         fiber.create(t2, ch, time_limit)
     end;
 
-    for i = 1, 4 do
+    for _ = 1, 4 do
         fiber.create(t3, ch, time_limit)
     end;
 
-    for i = 1, 16 do
+    for _ = 1, 16 do
         ch:get()
     end;
 end
diff --git a/test/vinyl/txn_proxy.lua b/test/vinyl/txn_proxy.lua
index 7a4d0b865..15b0e4add 100644
--- a/test/vinyl/txn_proxy.lua
+++ b/test/vinyl/txn_proxy.lua
@@ -1,11 +1,11 @@
--- A fiber can't use multiple transactions simultaneously;  
+-- A fiber can't use multiple transactions simultaneously;
 -- i.e. [fiber] --? [transaction] in UML parlor.
 --
 -- This module provides a simple transaction proxy facility
--- to control multiple transactions at once. A proxy executes 
+-- to control multiple transactions at once. A proxy executes
 -- statements in a worker fiber in order to overcome
 -- "one transaction per fiber" limitation.
--- 
+--
 -- Ex:
 -- proxy = require('txn_proxy').new()
 -- proxy:begin()
diff --git a/test/vinyl/upgrade/fill.lua b/test/vinyl/upgrade/fill.lua
index 547777330..0164b9316 100644
--- a/test/vinyl/upgrade/fill.lua
+++ b/test/vinyl/upgrade/fill.lua
@@ -2,11 +2,11 @@
 -- This script generates a vinyl metadata log
 -- containing all possible record types.
 --
-fiber = require 'fiber'
+local fiber = require 'fiber'
 
 box.cfg{vinyl_memory = 1024 * 1024, vinyl_timeout = 1e-9, checkpoint_count = 1}
 
-dump_trigger = box.schema.space.create('dump_trigger', {engine = 'vinyl'})
+local dump_trigger = box.schema.space.create('dump_trigger', {engine = 'vinyl'})
 dump_trigger:create_index('pk', {run_count_per_level = 1})
 
 -- Trigger dump of all indexes and wait for it to finish.
@@ -15,7 +15,7 @@ dump_trigger:create_index('pk', {run_count_per_level = 1})
 -- to trigger system-wide memory dump, it is enough to insert a
 -- huge tuple into one space.
 --
-function dump()
+local function dump()
     local pad = string.rep('x', box.cfg.vinyl_memory / 2)
     dump_trigger:replace{1, pad}
     -- Must fail due to quota timeout, but still trigger dump.
@@ -38,7 +38,7 @@ end
 --   VY_LOG_CREATE_INDEX
 --   VY_LOG_INSERT_RANGE
 --
-s = box.schema.space.create('test', {engine = 'vinyl'})
+local s = box.schema.space.create('test', {engine = 'vinyl'})
 s:create_index('i1', {parts = {1, 'unsigned'}, run_count_per_level = 1})
 s:create_index('i2', {parts = {2, 'string'},   run_count_per_level = 2})
 
diff --git a/test/vinyl/vinyl.lua b/test/vinyl/vinyl.lua
index 31307f4bc..1d313b4e4 100644
--- a/test/vinyl/vinyl.lua
+++ b/test/vinyl/vinyl.lua
@@ -15,21 +15,4 @@ box.cfg {
     vinyl_max_tuple_size = 1024 * 1024 * 6,
 }
 
-function box_info_sort(data)
-    if type(data)~='table' then
-        return data
-    end
-    local keys = {}
-    for k in pairs(data) do
-        table.insert(keys, k)
-    end
-    table.sort(keys)
-    local result = {}
-    for _,k in pairs(keys) do
-        local v = data[k]
-        table.insert(result, {[k] = box_info_sort(v) })
-    end
-    return result
-end
-
 require('console').listen(os.getenv('ADMIN'))
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 15/19] Fix luacheck warnings in test/wal_off
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (13 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 14/19] Fix luacheck warnings in test/vinyl sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 16/19] Fix luacheck warnings in test/xlog sergeyb
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.luacheckrc b/.luacheckrc
index aa79622d6..e0f8fdbad 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -48,7 +48,7 @@ exclude_files = {
     "test/swim/*.test.lua",
     "test/var/**/*.lua",
     "test/vinyl/*.test.lua",
-    "test/wal_off/*.lua",
+    "test/wal_off/*.test.lua",
     "test/xlog/**/*.lua",
     "test/xlog-py/**/*.lua",
     "third_party/**/*.lua",
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 16/19] Fix luacheck warnings in test/xlog
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (14 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 15/19] Fix luacheck warnings in test/wal_off sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 17/19] Fix luacheck warnings in test/xlog-py sergeyb
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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                                          |  2 +-
 test/xlog/panic.lua                                  |  2 +-
 .../upgrade/2.1.3/gh-4771-upgrade-sequence/fill.lua  | 12 ++++++------
 test/xlog/xlog.lua                                   |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index e0f8fdbad..6ae38b779 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -49,7 +49,7 @@ exclude_files = {
     "test/var/**/*.lua",
     "test/vinyl/*.test.lua",
     "test/wal_off/*.test.lua",
-    "test/xlog/**/*.lua",
+    "test/xlog/*.test.lua",
     "test/xlog-py/**/*.lua",
     "third_party/**/*.lua",
     ".rocks/**/*.lua",
diff --git a/test/xlog/panic.lua b/test/xlog/panic.lua
index 2d4eb8d2e..0fa855421 100644
--- a/test/xlog/panic.lua
+++ b/test/xlog/panic.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
diff --git a/test/xlog/upgrade/2.1.3/gh-4771-upgrade-sequence/fill.lua b/test/xlog/upgrade/2.1.3/gh-4771-upgrade-sequence/fill.lua
index b159f2b67..8e9a9d13d 100644
--- a/test/xlog/upgrade/2.1.3/gh-4771-upgrade-sequence/fill.lua
+++ b/test/xlog/upgrade/2.1.3/gh-4771-upgrade-sequence/fill.lua
@@ -1,14 +1,14 @@
 box.cfg{}
-s1 = box.schema.create_space('test1')
-pk = s1:create_index('pk', {sequence = true})
+local s1 = box.schema.create_space('test1')
+s1:create_index('pk', {sequence = true})
 s1:replace{box.NULL}
 
-seq2 = box.schema.sequence.create('seq2')
-s2 = box.schema.create_space('test2')
-pk = s2:create_index('pk', {sequence = 'seq2'})
+box.schema.sequence.create('seq2')
+local s2 = box.schema.create_space('test2')
+s2:create_index('pk', {sequence = 'seq2'})
 s2:replace{box.NULL}
 
-seq3 = box.schema.sequence.create('seq3')
+local seq3 = box.schema.sequence.create('seq3')
 seq3:next()
 
 box.snapshot()
diff --git a/test/xlog/xlog.lua b/test/xlog/xlog.lua
index 004096d2d..aaf1a0ae6 100644
--- a/test/xlog/xlog.lua
+++ b/test/xlog/xlog.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 17/19] Fix luacheck warnings in test/xlog-py
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (15 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 16/19] Fix luacheck warnings in test/xlog sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 18/19] Add luacheck supression for luajit test sergeyb
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

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          | 1 -
 test/xlog-py/box.lua | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 6ae38b779..2bc2eaa33 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -50,7 +50,6 @@ exclude_files = {
     "test/vinyl/*.test.lua",
     "test/wal_off/*.test.lua",
     "test/xlog/*.test.lua",
-    "test/xlog-py/**/*.lua",
     "third_party/**/*.lua",
     ".rocks/**/*.lua",
     ".git/**/*.lua",
diff --git a/test/xlog-py/box.lua b/test/xlog-py/box.lua
index c87f7b94b..8b9e9434f 100644
--- a/test/xlog-py/box.lua
+++ b/test/xlog-py/box.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 18/19] Add luacheck supression for luajit test
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (16 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 17/19] Fix luacheck warnings in test/xlog-py sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-20 19:46   ` Igor Munkin
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 19/19] luajit: bump new version sergeyb
                   ` (3 subsequent siblings)
  21 siblings, 1 reply; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

From: Sergey Bronnikov <sergeyb@tarantool.org>

Part of #4681

Reviewed-by: Igor Munkin <imun@tarantool.org>
---
 .luacheckrc | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/.luacheckrc b/.luacheckrc
index 2bc2eaa33..21680c08c 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -171,6 +171,12 @@ files["test/long_run-py/suite.lua"] = {
         "delete_insert",
     }
 }
+files["test/luajit-tap/or-232-unsink-64-kptr.test.lua"] = {
+    ignore = {
+        -- An empty if branch.
+        "542",
+    }
+}
 files["test/replication/replica_quorum.lua"] = {
     globals = {
         "INSTANCE_URI",
-- 
2.26.2

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

* [Tarantool-patches] [PATCH 19/19] luajit: bump new version
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (17 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 18/19] Add luacheck supression for luajit test sergeyb
@ 2020-07-16 14:11 ` sergeyb
  2020-07-16 14:18 ` [Tarantool-patches] [PATCH] test: fix warnings spotted by luacheck sergeyb
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:11 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

From: Sergey Bronnikov <sergeyb@tarantool.org>

- test: luacheck fixes.

Close #4681
---
 third_party/luajit | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/third_party/luajit b/third_party/luajit
index 377198b88..5bc03933b 160000
--- a/third_party/luajit
+++ b/third_party/luajit
@@ -1 +1 @@
-Subproject commit 377198b88382960a2f0af9c09014284e34630513
+Subproject commit 5bc03933be6334d9b4c1f0919817eb282c029e97
-- 
2.26.2

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

* [Tarantool-patches] [PATCH] test: fix warnings spotted by luacheck
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (18 preceding siblings ...)
  2020-07-16 14:11 ` [Tarantool-patches] [PATCH 19/19] luajit: bump new version sergeyb
@ 2020-07-16 14:18 ` 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
  21 siblings, 2 replies; 28+ messages in thread
From: sergeyb @ 2020-07-16 14:18 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

From: Sergey Bronnikov <sergeyb@tarantool.org>

luacheck is integrated in tarantool CI pipeline and respects .luacheckrc in
tarantool repo, so jit global is suppressed there.

Co-authored-by: Igor Munkin <imun@tarantool.org>
Reviewed-by: Igor Munkin <imun@tarantool.org>
---
 ...gh-4476-fix-string-find-recording.test.lua |  6 ++---
 .../lj-494-table-chain-infinite-loop.test.lua | 26 +++++++++----------
 test/or-232-unsink-64-kptr.test.lua           |  1 +
 3 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/test/gh-4476-fix-string-find-recording.test.lua b/test/gh-4476-fix-string-find-recording.test.lua
index 209090a..fb55680 100755
--- a/test/gh-4476-fix-string-find-recording.test.lua
+++ b/test/gh-4476-fix-string-find-recording.test.lua
@@ -51,13 +51,13 @@ local err = [[module 'kit.1.10.3-136' not found:
 	no file '/usr/local/lib64/lua/5.1/kit.so'
 	no file '/usr/lib64/lua/5.1/kit.so']]
 
-local at, s, e
+local at, _, e
 local count_vm = 0
 
 jit.off()
 
 repeat
-  s, e = err:find("\n\t", at, true)
+  _, e = err:find("\n\t", at, true)
   at = e
   count_vm = count_vm + 1
 until not e
@@ -68,7 +68,7 @@ jit.on()
 jit.opt.start(0, 'hotloop=1')
 
 repeat
-  s, e = err:find("\n\t", at, true)
+  _, e = err:find("\n\t", at, true)
   at = e
   count_jit = count_jit + 1
   assert(count_jit <= count_vm, "Trace goes in cycles")
diff --git a/test/lj-494-table-chain-infinite-loop.test.lua b/test/lj-494-table-chain-infinite-loop.test.lua
index 0daeca3..314eb29 100755
--- a/test/lj-494-table-chain-infinite-loop.test.lua
+++ b/test/lj-494-table-chain-infinite-loop.test.lua
@@ -16,7 +16,7 @@ ffi.cdef("char* strstr(const char*, const char*)")
 local strstr = ffi.C.strstr
 local cast = ffi.cast
 local str_hash_offset = cast("uint32_t*", strstr("*", ""))[-2] == 1 and 3 or 2
-function str_hash(s)
+local function str_hash(s)
     return cast("uint32_t*", strstr(s, "")) - str_hash_offset
 end
 local table_new = require("table.new")
@@ -25,17 +25,17 @@ local table_new = require("table.new")
 local victims = {}
 local orig_hash = {}
 for c in ("abcdef"):gmatch"." do
-    v = c .. "{09add58a-13a4-44e0-a52c-d44d0f9b2b95}"
+    local v = c .. "{09add58a-13a4-44e0-a52c-d44d0f9b2b95}"
     victims[c] = v
     orig_hash[c] = str_hash(v)[0]
 end
 collectgarbage()
 
 do --- Basic version of the problem
-    for k, v in pairs(victims) do
+    for _, v in pairs(victims) do
         str_hash(v)[0] = 0
     end
-    t = table_new(0, 8)
+    local t = table_new(0, 8)
     -- Make chain a -> b -> c -> d, all with a as primary
     t[victims.a] = true
     t[victims.d] = true
@@ -59,10 +59,10 @@ end
 collectgarbage()
 
 do --- Just `mn != freenode` can lead to infinite loops
-    for k, v in pairs(victims) do
+    for _, v in pairs(victims) do
         str_hash(v)[0] = 0
     end
-    t = table_new(0, 8)
+    local t = table_new(0, 8)
     -- Make chain a -> b -> c -> d, all with a as primary
     t[victims.a] = true
     t[victims.d] = true
@@ -85,10 +85,10 @@ end
 collectgarbage()
 
 do --- Just `mn != nn` can lead to infinite loops
-    for k, v in pairs(victims) do
+    for _, v in pairs(victims) do
         str_hash(v)[0] = 0
     end
-    t = table_new(0, 8)
+    local t = table_new(0, 8)
     -- Make chain a -> b -> c -> d -> e, all with a as primary
     t[victims.a] = true
     t[victims.e] = true
@@ -113,10 +113,10 @@ end
 for i = 0, 10 do --- Non-strings can need rechaining too
     collectgarbage()
 
-    k = tonumber((("0x%xp-1074"):format(i)))
+    local k = tonumber((("0x%xp-1074"):format(i)))
     str_hash(victims.a)[0] = 0
     str_hash(victims.b)[0] = 0
-    t = table_new(0, 4)
+    local t = table_new(0, 4)
     -- a -> b, both with a as primary
     t[victims.a] = true
     t[victims.b] = true
@@ -140,10 +140,10 @@ end
 for i = 0, 10 do --- Non-strings can be moved to freenode
     collectgarbage()
 
-    k = false
+    local k = false
     str_hash(victims.a)[0] = 0
     str_hash(victims.b)[0] = 0
-    t = table_new(0, 4)
+    local t = table_new(0, 4)
     -- a -> k -> b, all with a as primary
     t[victims.a] = true
     t[victims.b] = true
@@ -160,7 +160,7 @@ end
 collectgarbage()
 
 do --- Do not forget to advance freenode in the not-string case
-    t = table_new(0, 4)
+    local t = table_new(0, 4)
     -- Chain of colliding numbers
     t[0x0p-1074] = true
     t[0x4p-1074] = true
diff --git a/test/or-232-unsink-64-kptr.test.lua b/test/or-232-unsink-64-kptr.test.lua
index d9b3f05..0178a6e 100755
--- a/test/or-232-unsink-64-kptr.test.lua
+++ b/test/or-232-unsink-64-kptr.test.lua
@@ -31,6 +31,7 @@ local array = ffi.new("struct { int x; } [1]")
 
 local function fn(i)
     local struct = array[0]     -- Load pointer that the JIT will constify.
+    -- luacheck: ignore
     if i == 1000 then end       -- Force trace exit when i==1000.
     struct.x = 0                -- Ensure that 'struct' is live after exit.
 end
-- 
2.26.2

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

* Re: [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (19 preceding siblings ...)
  2020-07-16 14:18 ` [Tarantool-patches] [PATCH] test: fix warnings spotted by luacheck sergeyb
@ 2020-07-17  8:09 ` Sergey Bronnikov
  2020-08-07  9:19 ` Igor Munkin
  21 siblings, 0 replies; 28+ messages in thread
From: Sergey Bronnikov @ 2020-07-17  8:09 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy, imun; +Cc: alexander.turenko

On 17:11 Thu 16 Jul , sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>

<snipped>

> Changelog v2:
>
> - reverted changes for diff-based tests
> - reverted changes for suppressed warnings

I used this command-line to make sure all changes for globally
suppressed warnings reverted:

.rocks/bin/luacheck --only W431,W432,W421,W412,W411,212/self,143/table,143/string,143/debug --codes  test/

> - format .luacheckrc according to Lua style guide
> - created GH issue for every ignored warning in a separated files
> - make each commit atomic again - all changes in commits are related to
> commit itself, not other commits

<snipped>

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

* Re: [Tarantool-patches] [PATCH] test: fix warnings spotted by luacheck
  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
  1 sibling, 0 replies; 28+ messages in thread
From: Igor Munkin @ 2020-07-20 18:26 UTC (permalink / raw)
  To: sergeyb; +Cc: tarantool-patches, v.shpilevoy, alexander.turenko

Sergey,

Thanks for the patch! I've already given my LGTM for this one here[1].
I guess the fixes are quite similar and obvious, so the patch can be
applied out of order to our LuaJIT repo. However, Vlad still doesn't
approved these changes, so let's wait his reply.

On 16.07.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> luacheck is integrated in tarantool CI pipeline and respects .luacheckrc in
> tarantool repo, so jit global is suppressed there.
> 
> Co-authored-by: Igor Munkin <imun@tarantool.org>
> Reviewed-by: Igor Munkin <imun@tarantool.org>
> ---
>  ...gh-4476-fix-string-find-recording.test.lua |  6 ++---
>  .../lj-494-table-chain-infinite-loop.test.lua | 26 +++++++++----------
>  test/or-232-unsink-64-kptr.test.lua           |  1 +
>  3 files changed, 17 insertions(+), 16 deletions(-)
> 

<snipped>

> -- 
> 2.26.2
> 

[1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-April/016301.html

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH 18/19] Add luacheck supression for luajit test
  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
  0 siblings, 1 reply; 28+ messages in thread
From: Igor Munkin @ 2020-07-20 19:46 UTC (permalink / raw)
  To: sergeyb; +Cc: tarantool-patches, v.shpilevoy, alexander.turenko

Sergey,

Here we go again... I wonder how exactly you tested LuaJIT related patch
if you ended up suppressing the same warning both inline and within
.luacheckrc. Consider the following:
| $ git diff | cat
| $ make luacheck | grep -F 'luajit'
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-3196-incorrect-string-length.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4427-ffi-sandwich.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4476-fix-string-find-recording.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4773-tonumber-fail-on-NUL-char.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-494-table-chain-infinite-loop.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-505-fold-no-strref-for-ptrdiff.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-524-fold-conv-respect-src-irt.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-flush-on-trace.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/or-232-unsink-64-kptr.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/utils.lua OK
| $ git stash pop
| $ git diff | cat
| diff --git a/.luacheckrc b/.luacheckrc
| index 21680c08c..2bc2eaa33 100644
| --- a/.luacheckrc
| +++ b/.luacheckrc
| @@ -171,12 +171,6 @@ files["test/long_run-py/suite.lua"] = {
|          "delete_insert",
|      }
|  }
| -files["test/luajit-tap/or-232-unsink-64-kptr.test.lua"] = {
| -    ignore = {
| -        -- An empty if branch.
| -        "542",
| -    }
| -}
|  files["test/replication/replica_quorum.lua"] = {
|      globals = {
|          "INSTANCE_URI",
| $ make luacheck | grep -F 'luajit'
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-3196-incorrect-string-length.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4427-ffi-sandwich.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4476-fix-string-find-recording.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4773-tonumber-fail-on-NUL-char.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-494-table-chain-infinite-loop.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-505-fold-no-strref-for-ptrdiff.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-524-fold-conv-respect-src-irt.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-flush-on-trace.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/or-232-unsink-64-kptr.test.lua OK
| Checking /home/imun/projects/tarantool-review/test/luajit-tap/utils.lua OK

So what does this suppression fix? Actually nothing. Please drop this
suppression from .luacheckrc (and thereby the patch itself).

By the way, I see another problem:
- Wait, it's all just luacheck failing on luajit tests?
| $ git co HEAD^
| $ git log --oneline -1 | cat
| c9653cbec Add luacheck supression for luajit test
| $ make luacheck || echo "Always has been"
| <snipped>
| Total: 95 warnings / 0 errors in 492 files
| make[3]: *** [CMakeFiles/luacheck.dir/build.make:58: luacheck] Error 1
| make[2]: *** [CMakeFiles/Makefile2:430: CMakeFiles/luacheck.dir/all] Error 2
| make[1]: *** [CMakeFiles/Makefile2:437: CMakeFiles/luacheck.dir/rule] Error 2
| make: *** [Makefile:316: luacheck] Error 2
| Always has been

I guess the agreement to make the series passing <luacheck> after
*every* patch still stands (like you made for src/ and extra/
directories). I doubt we should violate this rule for test/.

On 16.07.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Part of #4681
> 
> Reviewed-by: Igor Munkin <imun@tarantool.org>
> ---
>  .luacheckrc | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 2bc2eaa33..21680c08c 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc

<snipped>

> -- 
> 2.26.2
> 

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH 18/19] Add luacheck supression for luajit test
  2020-07-20 19:46   ` Igor Munkin
@ 2020-07-21 11:52     ` Sergey Bronnikov
  2020-07-21 12:38       ` Igor Munkin
  0 siblings, 1 reply; 28+ messages in thread
From: Sergey Bronnikov @ 2020-07-21 11:52 UTC (permalink / raw)
  To: Igor Munkin; +Cc: tarantool-patches, v.shpilevoy, alexander.turenko

Igor, thanks for review!

On 22:46 Mon 20 Jul , Igor Munkin wrote:
> Sergey,
>
> Here we go again... I wonder how exactly you tested LuaJIT related patch
> if you ended up suppressing the same warning both inline and within
> .luacheckrc. Consider the following:
> | $ git diff | cat
> | $ make luacheck | grep -F 'luajit'
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-3196-incorrect-string-length.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4427-ffi-sandwich.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4476-fix-string-find-recording.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4773-tonumber-fail-on-NUL-char.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-494-table-chain-infinite-loop.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-505-fold-no-strref-for-ptrdiff.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-524-fold-conv-respect-src-irt.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-flush-on-trace.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/or-232-unsink-64-kptr.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/utils.lua OK
> | $ git stash pop
> | $ git diff | cat
> | diff --git a/.luacheckrc b/.luacheckrc
> | index 21680c08c..2bc2eaa33 100644
> | --- a/.luacheckrc
> | +++ b/.luacheckrc
> | @@ -171,12 +171,6 @@ files["test/long_run-py/suite.lua"] = {
> |          "delete_insert",
> |      }
> |  }
> | -files["test/luajit-tap/or-232-unsink-64-kptr.test.lua"] = {
> | -    ignore = {
> | -        -- An empty if branch.
> | -        "542",
> | -    }
> | -}
> |  files["test/replication/replica_quorum.lua"] = {
> |      globals = {
> |          "INSTANCE_URI",
> | $ make luacheck | grep -F 'luajit'
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-3196-incorrect-string-length.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4427-ffi-sandwich.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4476-fix-string-find-recording.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/gh-4773-tonumber-fail-on-NUL-char.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-494-table-chain-infinite-loop.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-505-fold-no-strref-for-ptrdiff.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-524-fold-conv-respect-src-irt.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/lj-flush-on-trace.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/or-232-unsink-64-kptr.test.lua OK
> | Checking /home/imun/projects/tarantool-review/test/luajit-tap/utils.lua OK
>
> So what does this suppression fix? Actually nothing. Please drop this
> suppression from .luacheckrc (and thereby the patch itself).

Agree, missed it, supression is useless in config and I've removed it in
a branch.

> By the way, I see another problem:
> - Wait, it's all just luacheck failing on luajit tests?
> | $ git co HEAD^
> | $ git log --oneline -1 | cat
> | c9653cbec Add luacheck supression for luajit test
> | $ make luacheck || echo "Always has been"
> | <snipped>
> | Total: 95 warnings / 0 errors in 492 files
> | make[3]: *** [CMakeFiles/luacheck.dir/build.make:58: luacheck] Error 1
> | make[2]: *** [CMakeFiles/Makefile2:430: CMakeFiles/luacheck.dir/all] Error 2
> | make[1]: *** [CMakeFiles/Makefile2:437: CMakeFiles/luacheck.dir/rule] Error 2
> | make: *** [Makefile:316: luacheck] Error 2
> | Always has been
> 
> I guess the agreement to make the series passing <luacheck> after
> *every* patch still stands (like you made for src/ and extra/
> directories). I doubt we should violate this rule for test/.

Actually changes in a patch series are atomic and problem described
above is not related to atomicity of changes.
Paths in a luacheck config are interpreted relatively to the directory
from which config was loaded, see [1]. When you run 'make luacheck' in
separate build directory it uses absolute path to .luacheckrc and
therefore absolute paths to .lua files:
$ make luacheck VERBOSE=1
...
Perform static analysis of Lua code
../.rocks/bin/luacheck --codes --config /home/s.bronnikov/tarantool/.luacheckrc /home/s.bronnikov/tarantool
Checking /home/s.bronnikov/tarantool/build/extra/luarocks/hardcoded.lua
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
$

in such case exclude and include paths specified in config become
broken, luacheck simply ignores it and checks only .lua files in a build/
directory.

I made a small change on top of branch to fix case when we run 'make
luacheck' in a build dir:

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -158,7 +158,8 @@ add_custom_target(ctags DEPENDS tags)

  add_custom_target(luacheck)
   add_custom_command(TARGET luacheck
   -    COMMAND ${LUACHECK} --codes --config "${PROJECT_SOURCE_DIR}/.luacheckrc" "${PROJECT_SOURCE_DIR}"
   +    COMMAND ${LUACHECK} --codes --config .luacheckrc .
   +    WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
        COMMENT "Perform static analysis of Lua code"
		 )

CI passed with a patch, see [2].

1. https://luacheck.readthedocs.io/en/stable/config.html
2. https://gitlab.com/tarantool/tarantool/-/pipelines/168992688

> On 16.07.20, sergeyb@tarantool.org wrote:
> > From: Sergey Bronnikov <sergeyb@tarantool.org>
> > 
> > Part of #4681
> > 
> > Reviewed-by: Igor Munkin <imun@tarantool.org>
> > ---
> >  .luacheckrc | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/.luacheckrc b/.luacheckrc
> > index 2bc2eaa33..21680c08c 100644
> > --- a/.luacheckrc
> > +++ b/.luacheckrc
> 
> <snipped>
> 
> > -- 
> > 2.26.2
> > 
> 
> -- 
> Best regards,
> IM

-- 
sergeyb@

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

* Re: [Tarantool-patches] [PATCH 18/19] Add luacheck supression for luajit test
  2020-07-21 11:52     ` Sergey Bronnikov
@ 2020-07-21 12:38       ` Igor Munkin
  0 siblings, 0 replies; 28+ messages in thread
From: Igor Munkin @ 2020-07-21 12:38 UTC (permalink / raw)
  To: Sergey Bronnikov; +Cc: tarantool-patches, v.shpilevoy, alexander.turenko

Sergey,

On 21.07.20, Sergey Bronnikov wrote:
> Igor, thanks for review!
> 

<snipped>

> > By the way, I see another problem:
> > - Wait, it's all just luacheck failing on luajit tests?
> > | $ git co HEAD^
> > | $ git log --oneline -1 | cat
> > | c9653cbec Add luacheck supression for luajit test
> > | $ make luacheck || echo "Always has been"
> > | <snipped>
> > | Total: 95 warnings / 0 errors in 492 files
> > | make[3]: *** [CMakeFiles/luacheck.dir/build.make:58: luacheck] Error 1
> > | make[2]: *** [CMakeFiles/Makefile2:430: CMakeFiles/luacheck.dir/all] Error 2
> > | make[1]: *** [CMakeFiles/Makefile2:437: CMakeFiles/luacheck.dir/rule] Error 2
> > | make: *** [Makefile:316: luacheck] Error 2
> > | Always has been
> > 
> > I guess the agreement to make the series passing <luacheck> after
> > *every* patch still stands (like you made for src/ and extra/
> > directories). I doubt we should violate this rule for test/.
> 
> Actually changes in a patch series are atomic and problem described
> above is not related to atomicity of changes.

It definitely does relate to the subj.

> Paths in a luacheck config are interpreted relatively to the directory
> from which config was loaded, see [1]. When you run 'make luacheck' in
> separate build directory it uses absolute path to .luacheckrc and
> therefore absolute paths to .lua files:

One more time: I checked out the commit prior to the branch HEAD (i.e.
c9653cbec), configured Tarantool in-source build and ran <make luacheck>
available only in project root directory (otherwise the corresponding
error is reported by make util).

The root cause is not about the paths for out of source build (I didn't
even test this build type) but the exclude list, that doesn't contain
any line related to luajit test directory (i.e. test/luajit-tap). As a
result luacheck fails until the submodule is bumped, in other words
until the last commit. We already discussed this in the previous
series[1], but you ignored it. Again. Well, it's not a problem for me to
point out your attention to this. Again. This is about the 10th overall
series for luacheck, isn't it? How more iterations do we need for it?

> $ make luacheck VERBOSE=1
> ...
> Perform static analysis of Lua code
> ../.rocks/bin/luacheck --codes --config /home/s.bronnikov/tarantool/.luacheckrc /home/s.bronnikov/tarantool
> Checking /home/s.bronnikov/tarantool/build/extra/luarocks/hardcoded.lua
>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> ...
> $
> 
> in such case exclude and include paths specified in config become
> broken, luacheck simply ignores it and checks only .lua files in a build/
> directory.
> 
> I made a small change on top of branch to fix case when we run 'make
> luacheck' in a build dir:
> 
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -158,7 +158,8 @@ add_custom_target(ctags DEPENDS tags)
> 
>   add_custom_target(luacheck)
>    add_custom_command(TARGET luacheck
>    -    COMMAND ${LUACHECK} --codes --config "${PROJECT_SOURCE_DIR}/.luacheckrc" "${PROJECT_SOURCE_DIR}"
>    +    COMMAND ${LUACHECK} --codes --config .luacheckrc .
>    +    WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
>         COMMENT "Perform static analysis of Lua code"
> 		 )
> 
> CI passed with a patch, see [2].
> 
> 1. https://luacheck.readthedocs.io/en/stable/config.html
> 2. https://gitlab.com/tarantool/tarantool/-/pipelines/168992688

Spoiler alert: here is the missing line in .luacheckrc, that you've
removed in scope of post-review fixes for this patch[1].

================================================================================

diff --git a/.luacheckrc b/.luacheckrc
index 21680c08c..76807b716 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -50,6 +50,7 @@ exclude_files = {
     "test/vinyl/*.test.lua",
     "test/wal_off/*.test.lua",
     "test/xlog/*.test.lua",
+    "test/luajit-tap/*.test.lua",
     "third_party/**/*.lua",
     ".rocks/**/*.lua",
     ".git/**/*.lua",

================================================================================

With this line everything works fine. However I proposed to bump luajit
submodule prior to unmasking test/ directory, that looks more natural
and convenient to me. Does it look good to you?

> 

<snipped>

> 
> -- 
> sergeyb@

[1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-April/016332.html

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck
  2020-07-16 14:11 [Tarantool-patches] [PATCH 00/19] Add static analysis of Lua code in test/ with luacheck sergeyb
                   ` (20 preceding siblings ...)
  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
  21 siblings, 0 replies; 28+ messages in thread
From: Igor Munkin @ 2020-08-07  9:19 UTC (permalink / raw)
  To: sergeyb; +Cc: tarantool-patches, v.shpilevoy, alexander.turenko

Sergey,

I see little changes changes from the previous version. However, I
addressed the following comment to you in my last review[1]:
|> > Sergey,
|> >
|> > I guess we definitely need another series for this.
|>
|> Ja-ja, will do.
|>
|> > Furthermore, IIRC we
|> > decided to leave shadowing, so the current changes are simply not
|> > relevant. Please adjust the patches related to tests considering our
|> > recent discussion in cover letter and send a new patchset.
|>
|> I have reverted all changes related to globally supressed warnings.
|>

As I can see you claimed the irrelevant changes are reverted.

Unfortunately, I still see excess hunks in the patch[2] (e.g. related to
arguments and locals shadowing). Sorry, you *might* be misled by my
wording, since I mentioned cover letter, not the Sasha's review for the
previous patch[3].

OK, let's try one more time: please consider the results of the
discussion we had related to source Lua files series.

On 16.07.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Note: patch series for test/ was already sent to list in a thread with
> static analysis for src/ and extra/. Igor M. started to review it there, see
> [1], and then in private discussion we decided to split changes for
> test/ and {src/,extra/} for two different patch series. As changes for src/ and
> extra/ has been merged to master [2] I have rebased existed changes for
> test/, applied changes suggested by Igor in the initial review and
> reverted changes for warnings supressed globally in .luacheckrc.
> 
> 1. https://lists.tarantool.org/pipermail/tarantool-patches/2020-June/017301.html
> 2. https://lists.tarantool.org/pipermail/tarantool-patches/2020-July/018568.html
> 
> Changelog v2:
> 
> - reverted changes for diff-based tests
> - reverted changes for suppressed warnings
> - format .luacheckrc according to Lua style guide
> - created GH issue for every ignored warning in a separated files
> - make each commit atomic again - all changes in commits are related to
> commit itself, not other commits
> 
> GH issue: https://github.com/tarantool/tarantool/issues/4681
> GitHub branch: https://github.com/tarantool/tarantool/tree/ligurio/gh-4681-fix-luacheck-warnings-test
> CI: https://gitlab.com/tarantool/tarantool/-/pipelines/167419608
> 
> Sergey Bronnikov (19):
>   Fix luacheck warnings in test/app-tap
>   Fix luacheck warnings in test/app
>   Fix luacheck warnings in test/box
>   Fix luacheck warnings in test/box-py
>   Fix luacheck warnings in test/box-tap
>   Fix luacheck warnings in test/engine
>   Fix luacheck warnings in test/engine_long
>   Fix luacheck warnings in test/long_run-py
>   Fix luacheck warnings in test/replication
>   Fix luacheck warnings in test/replication-py
>   Fix luacheck warnings in test/sql
>   Fix luacheck warnings in test/sql-tap
>   Fix luacheck warnings in test/swim
>   Fix luacheck warnings in test/vinyl
>   Fix luacheck warnings in test/wal_off
>   Fix luacheck warnings in test/xlog
>   Fix luacheck warnings in test/xlog-py
>   Add luacheck supression for luajit test
>   luajit: bump new version
> 
>  .luacheckrc                                   | 195 ++++++-
>  test/app-tap/cfg.test.lua                     |   2 +-
>  test/app-tap/clock.test.lua                   |   4 +-
>  test/app-tap/console.test.lua                 |  14 +-
>  test/app-tap/console_lua.test.lua             |  18 +-
>  test/app-tap/csv.test.lua                     |  56 +-
>  test/app-tap/debug.test.lua                   |  10 +-
>  test/app-tap/errno.test.lua                   |  24 +-
>  test/app-tap/fail_main.test.lua               |   6 +-
>  .../gh-4761-json-per-call-options.test.lua    |  11 +-
>  test/app-tap/http_client.test.lua             | 297 +++++------
>  test/app-tap/iconv.test.lua                   |   6 +-
>  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                  |  23 +-
>  test/app-tap/lua/serializer_test.lua          |  46 +-
>  test/app-tap/minimal.test.lua                 |   4 +-
>  test/app-tap/module_api.test.lua              |  12 +-
>  test/app-tap/msgpackffi.test.lua              |   3 +-
>  test/app-tap/pcall.test.lua                   |   6 +-
>  test/app-tap/popen.test.lua                   |  35 +-
>  test/app-tap/snapshot.test.lua                |  17 +-
>  test/app-tap/string.test.lua                  | 502 +++++++++---------
>  test/app-tap/tap.test.lua                     |  26 +-
>  test/app-tap/tarantoolctl.test.lua            |  82 ++-
>  test/app-tap/trigger.test.lua                 |  48 +-
>  test/app-tap/yaml.test.lua                    |  16 +-
>  test/box-py/box.lua                           |   2 +-
>  test/box-tap/auth.test.lua                    |  20 +-
>  test/box-tap/cfg.test.lua                     |  34 +-
>  test/box-tap/cfgup.test.lua                   |   4 +-
>  test/box-tap/extended_error.test.lua          |  11 +-
>  test/box-tap/feedback_daemon.test.lua         |   4 +-
>  test/box-tap/gc.test.lua                      |   4 +-
>  test/box-tap/on_schema_init.test.lua          |   4 +-
>  test/box-tap/schema_mt.test.lua               |  22 +-
>  test/box-tap/session.storage.test.lua         |  10 +-
>  test/box-tap/session.test.lua                 |  56 +-
>  test/box-tap/trigger_atexit.test.lua          |  10 +-
>  test/box-tap/trigger_yield.test.lua           |  10 +-
>  test/box/box.lua                              |   7 +-
>  test/box/lua/bitset.lua                       |   7 +-
>  test/box/lua/cfg_bad_vinyl_dir.lua            |   2 +-
>  test/box/lua/cfg_rtree.lua                    |   2 +-
>  test/box/lua/cfg_test1.lua                    |   2 +-
>  test/box/lua/cfg_test2.lua                    |   2 +-
>  test/box/lua/cfg_test3.lua                    |   2 +-
>  test/box/lua/cfg_test4.lua                    |   2 +-
>  test/box/lua/cfg_test5.lua                    |   2 +-
>  test/box/lua/cfg_test6.lua                    |   2 +-
>  test/box/lua/fifo.lua                         |   2 +-
>  test/box/lua/identifier.lua                   |   9 +-
>  test/box/lua/index_random_test.lua            |   2 +-
>  test/box/lua/utils.lua                        |  10 +-
>  test/box/on_schema_init.lua                   |   8 +-
>  test/box/proxy.lua                            |   2 +-
>  test/box/tiny.lua                             |   2 +-
>  test/engine/box.lua                           |   8 +-
>  test/engine/conflict.lua                      |   6 +-
>  test/engine_long/suite.lua                    |   5 +-
>  test/long_run-py/lua/finalizers.lua           |   7 +-
>  test/long_run-py/suite.lua                    |   7 +-
>  test/replication-py/master.lua                |   2 +-
>  test/replication-py/panic.lua                 |   2 +-
>  test/replication-py/replica.lua               |   4 -
>  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 +-
>  test/sql-tap/alter.test.lua                   |   4 +-
>  test/sql-tap/analyze5.test.lua                |   2 +-
>  test/sql-tap/analyze9.test.lua                |  22 +-
>  test/sql-tap/between.test.lua                 |   4 +-
>  test/sql-tap/date.test.lua                    |   3 +-
>  test/sql-tap/delete1.test.lua                 |   2 +-
>  test/sql-tap/e_delete.test.lua                |   2 +-
>  test/sql-tap/e_expr.test.lua                  |  11 +-
>  test/sql-tap/func.test.lua                    |   2 +-
>  test/sql-tap/func3.test.lua                   |   2 +-
>  test/sql-tap/gh-2723-concurrency.test.lua     |   8 +-
>  .../gh-3083-ephemeral-unref-tuples.test.lua   |   2 +-
>  .../gh-3307-xfer-optimization-issue.test.lua  |   2 +-
>  .../gh-3332-tuple-format-leak.test.lua        |   2 +-
>  .../gh2127-indentifier-max-length.test.lua    |  10 +-
>  test/sql-tap/identifier-characters.test.lua   |   2 +-
>  test/sql-tap/index1.test.lua                  |   3 +-
>  test/sql-tap/index7.test.lua                  |   2 +-
>  test/sql-tap/join3.test.lua                   |   2 +-
>  test/sql-tap/lua-tables.test.lua              |   2 +-
>  test/sql-tap/lua/sqltester.lua                |  11 +-
>  test/sql-tap/misc1.test.lua                   |  10 +-
>  test/sql-tap/misc5.test.lua                   |   2 +-
>  test/sql-tap/select1.test.lua                 |  10 +-
>  test/sql-tap/select2.test.lua                 |   8 +-
>  test/sql-tap/select4.test.lua                 |   1 -
>  test/sql-tap/select5.test.lua                 |   1 -
>  test/sql-tap/select9.test.lua                 |  12 +-
>  test/sql-tap/selectA.test.lua                 |   8 +-
>  test/sql-tap/selectB.test.lua                 |  14 +-
>  test/sql-tap/selectG.test.lua                 |   1 -
>  test/sql-tap/sort.test.lua                    |   2 +-
>  test/sql-tap/sql-errors.test.lua              |   2 +-
>  test/sql-tap/table.test.lua                   |   3 +-
>  test/sql-tap/tkt-38cb5df375.test.lua          |   1 -
>  test/sql-tap/tkt-91e2e8ba6f.test.lua          |   3 -
>  test/sql-tap/tkt-9a8b09f8e6.test.lua          |   3 -
>  test/sql-tap/tkt-bd484a090c.test.lua          |   3 +-
>  test/sql-tap/tkt2192.test.lua                 |   3 +-
>  test/sql-tap/tkt3493.test.lua                 |   3 -
>  test/sql-tap/trigger2.test.lua                |   4 +-
>  test/sql-tap/triggerA.test.lua                |   1 -
>  test/sql-tap/where2.test.lua                  |   9 +-
>  test/sql-tap/where3.test.lua                  |   2 +-
>  test/sql-tap/where4.test.lua                  |   4 +-
>  test/sql-tap/where5.test.lua                  |   2 +-
>  test/sql-tap/where6.test.lua                  |   2 +-
>  test/sql-tap/where7.test.lua                  |  16 +-
>  test/sql-tap/whereA.test.lua                  |   2 +-
>  test/sql-tap/whereB.test.lua                  |   2 +-
>  test/sql-tap/whereC.test.lua                  |   5 +-
>  test/sql-tap/whereD.test.lua                  |   4 +-
>  test/sql-tap/whereF.test.lua                  |   4 +-
>  test/sql-tap/whereG.test.lua                  |   4 +-
>  test/sql-tap/whereI.test.lua                  |   4 +-
>  test/sql-tap/whereK.test.lua                  |   4 +-
>  test/sql-tap/with1.test.lua                   |  14 +-
>  test/sql-tap/with2.test.lua                   |  18 +-
>  test/sql/lua/sql_tokenizer.lua                |   2 +-
>  test/swim/box.lua                             |   4 +-
>  test/vinyl/large.lua                          |   3 +-
>  test/vinyl/stress.lua                         |  22 +-
>  test/vinyl/txn_proxy.lua                      |   6 +-
>  test/vinyl/upgrade/fill.lua                   |   8 +-
>  test/vinyl/vinyl.lua                          |  17 -
>  test/xlog-py/box.lua                          |   2 +-
>  test/xlog/panic.lua                           |   2 +-
>  .../2.1.3/gh-4771-upgrade-sequence/fill.lua   |  12 +-
>  test/xlog/xlog.lua                            |   2 +-
>  third_party/luajit                            |   2 +-
>  143 files changed, 1135 insertions(+), 1051 deletions(-)
> 
> -- 
> 2.26.2
> 

[1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-July/018632.html
[2]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-July/018634.html
[3]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-June/017304.html

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH] test: fix warnings spotted by luacheck
  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
  1 sibling, 0 replies; 28+ messages in thread
From: Kirill Yukhin @ 2020-10-30 13:59 UTC (permalink / raw)
  To: sergeyb; +Cc: alexander.turenko, tarantool-patches, v.shpilevoy

Hello,

On 16 июл 17:18, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> luacheck is integrated in tarantool CI pipeline and respects .luacheckrc in
> tarantool repo, so jit global is suppressed there.
> 
> Co-authored-by: Igor Munkin <imun@tarantool.org>
> Reviewed-by: Igor Munkin <imun@tarantool.org>

I've checked your patch into luajit repo and bumped a new
version in 1.10, 2.5, 2.6 and master.

--
Regards, Kirill Yukhin

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

end of thread, other threads:[~2020-10-30 13:59 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [Tarantool-patches] [PATCH 09/19] Fix luacheck warnings in test/replication sergeyb
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

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