Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck
@ 2020-04-21 14:00 sergeyb
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 1/10] Add initial luacheck config sergeyb
                   ` (9 more replies)
  0 siblings, 10 replies; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Sergey Bronnikov <sergeyb@tarantool.org>

Changelog v4:

- applied and squashed patches authored by Igor Munkin and Vladislav Shpilevoy
- supressed W212 warnings regarding 'self' arguments
- splitted luacheckrc for several patches and squashed them to appropriate
patches with fixes
- removed supressions for files disabled for checking
- fixed more (~1200) warnings
- luacheckrc size reduced from 190 to 70 lines

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

Sergey Bronnikov (7):
  Add initial luacheck config
  gitlab-ci: enable static analysis with luacheck
  Fix luacheck warnings in extra/dist/tarantoolctl.in
  Fix luacheck warnings in src/lua/
  Fix luacheck warnings in src/box/lua/
  Fix luacheck warnings in test/
  Disabled test/luajit-tap in luacheckrc

Vladislav Shpilevoy (2):
  schema: fix index promotion to functional index
  schema: fix internal symbols dangling in _G

 .gitlab-ci.yml                                |   9 ++
 .luacheckrc                                   |  74 ++++++++++++
 .travis.mk                                    |  15 ++-
 extra/dist/tarantoolctl.in                    |  29 ++---
 src/box/lua/console.lua                       |   6 +-
 src/box/lua/feedback_daemon.lua               |   2 +-
 src/box/lua/key_def.lua                       |   2 +-
 src/box/lua/load_cfg.lua                      |  25 ++--
 src/box/lua/net_box.lua                       |  26 ++--
 src/box/lua/schema.lua                        |  41 ++++---
 src/box/lua/tuple.lua                         |   8 +-
 src/box/lua/upgrade.lua                       |  19 ++-
 src/lua/argparse.lua                          |   6 +-
 src/lua/buffer.lua                            |   4 +-
 src/lua/clock.lua                             |   2 +-
 src/lua/crypto.lua                            |   4 +-
 src/lua/csv.lua                               |   5 +-
 src/lua/digest.lua                            |   2 +-
 src/lua/env.lua                               |   2 +-
 src/lua/fiber.lua                             |   4 +-
 src/lua/fio.lua                               |  25 ++--
 src/lua/help.lua                              |   7 +-
 src/lua/httpc.lua                             |   3 -
 src/lua/init.lua                              |   7 +-
 src/lua/msgpackffi.lua                        |  22 ++--
 src/lua/socket.lua                            |  65 +++++-----
 src/lua/string.lua                            |   1 -
 src/lua/swim.lua                              |  10 +-
 src/lua/tap.lua                               |  74 ++++++------
 src/lua/trigger.lua                           |   3 -
 test/app-tap/cfg.test.lua                     |   2 +-
 test/app-tap/clock.test.lua                   |   4 +-
 test/app-tap/console.test.lua                 |  15 +--
 test/app-tap/console_lua.test.lua             |  22 ++--
 test/app-tap/csv.test.lua                     |  56 ++++-----
 test/app-tap/debug.test.lua                   |  10 +-
 test/app-tap/errno.test.lua                   |   6 +-
 test/app-tap/fail_main.test.lua               |   6 +-
 .../gh-4761-json-per-call-options.test.lua    |  11 +-
 test/app-tap/http_client.test.lua             |  54 ++++-----
 test/app-tap/iconv.test.lua                   |   6 +-
 test/app-tap/init_script.test.lua             |  14 +--
 test/app-tap/inspector.test.lua               |   6 +-
 test/app-tap/json.test.lua                    |   1 -
 test/app-tap/logger.test.lua                  |  23 ++--
 test/app-tap/minimal.test.lua                 |   4 +-
 test/app-tap/module_api.test.lua              |  11 +-
 test/app-tap/msgpackffi.test.lua              |   3 +-
 test/app-tap/pcall.test.lua                   |   6 +-
 test/app-tap/snapshot.test.lua                |  17 ++-
 test/app-tap/string.test.lua                  |  54 ++++-----
 test/app-tap/tap.test.lua                     |  26 ++--
 test/app-tap/tarantoolctl.test.lua            |  76 ++++++------
 test/app-tap/trigger.test.lua                 |  20 ++--
 test/app-tap/yaml.test.lua                    |  16 +--
 test/box-py/box.lua                           |   2 +-
 test/box-tap/auth.test.lua                    |  36 +++---
 test/box-tap/cfg.test.lua                     |  34 +++---
 test/box-tap/cfgup.test.lua                   |   2 +-
 test/box-tap/feedback_daemon.test.lua         |   4 +-
 test/box-tap/gc.test.lua                      |   6 +-
 test/box-tap/key_def.test.lua                 |  58 ++++-----
 test/box-tap/merger.test.lua                  | 112 +++++++++---------
 test/box-tap/on_schema_init.test.lua          |   4 +-
 test/box-tap/schema_mt.test.lua               |  18 +--
 test/box-tap/session.storage.test.lua         |  10 +-
 test/box-tap/session.test.lua                 |  59 ++++-----
 test/box-tap/trigger_atexit.test.lua          |  10 +-
 test/box-tap/trigger_yield.test.lua           |  10 +-
 test/box/box.lua                              |   2 +-
 test/box/hash_multipart.result                |   2 +-
 test/box/hash_multipart.test.lua              |   2 +-
 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                    |   4 +-
 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/require_init.lua                 |   3 -
 test/box/lua/test_init.lua                    |  10 +-
 test/box/lua/utils.lua                        |  13 +-
 test/box/on_schema_init.lua                   |   2 +-
 test/box/proxy.lua                            |   2 +-
 test/box/tiny.lua                             |   2 +-
 test/box/tree_pk.result                       |   4 +-
 test/box/tree_pk.test.lua                     |   4 +-
 test/engine/func_index.result                 |  36 ++++++
 test/engine/func_index.test.lua               |  14 +++
 test/engine/tree_min_max_count.result         |   2 +-
 test/engine/tree_min_max_count.test.lua       |   2 +-
 test/engine_long/suite.lua                    |   4 +-
 test/long_run-py/lua/finalizers.lua           |   8 +-
 test/long_run-py/suite.lua                    |   6 +-
 test/replication-py/master.lua                |   2 +-
 test/replication-py/panic.lua                 |   2 +-
 test/replication-py/replica.lua               |   4 -
 test/replication/lua/fast_replica.lua         |   3 +-
 test/replication/lua/rlimit.lua               |   2 +-
 test/replication/master.lua                   |   2 +-
 test/replication/replicaset_ro_mostly.result  |   2 +-
 .../replication/replicaset_ro_mostly.test.lua |   2 +-
 test/sql-tap/alter.test.lua                   |   4 +-
 test/sql-tap/analyze3.test.lua                |   6 +-
 test/sql-tap/analyze5.test.lua                |   2 +-
 test/sql-tap/analyze9.test.lua                |  30 ++---
 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                  |  22 ++--
 test/sql-tap/func.test.lua                    |   2 +-
 test/sql-tap/func3.test.lua                   |  24 ++--
 test/sql-tap/gh-2723-concurrency.test.lua     |   8 +-
 .../gh-3083-ephemeral-unref-tuples.test.lua   |   2 +-
 .../gh-3307-xfer-optimization-issue.test.lua  |  16 +--
 .../gh-3332-tuple-format-leak.test.lua        |   2 +-
 .../gh-4077-iproto-execute-no-bind.test.lua   |   7 +-
 .../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                |  28 ++---
 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/tkt-fa7bf5ec.test.lua            |   6 +-
 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/sql/savepoints.result                    |   6 +-
 test/sql/savepoints.test.lua                  |   6 +-
 test/sql/triggers.result                      |   2 +-
 test/sql/triggers.test.lua                    |   2 +-
 test/vinyl/large.lua                          |   3 +-
 test/vinyl/txn_proxy.lua                      |   6 +-
 test/vinyl/upgrade/fill.lua                   |   8 +-
 test/vinyl/vinyl.lua                          |   2 +-
 test/wal_off/rtree_benchmark.result           |   2 +-
 test/wal_off/rtree_benchmark.test.lua         |   2 +-
 test/xlog-py/box.lua                          |   2 +-
 test/xlog/panic.lua                           |   2 +-
 test/xlog/reader.result                       |   2 +-
 test/xlog/reader.test.lua                     |   2 +-
 test/xlog/snap_io_rate.test.lua               |   2 +-
 test/xlog/transaction.result                  |   2 +-
 test/xlog/transaction.test.lua                |   2 +-
 .../2.1.3/gh-4771-upgrade-sequence/fill.lua   |  12 +-
 test/xlog/xlog.lua                            |   2 +-
 188 files changed, 1001 insertions(+), 961 deletions(-)
 create mode 100644 .luacheckrc

-- 
2.23.0

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

* [Tarantool-patches] [PATCH v4 1/10] Add initial luacheck config
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 2/10] gitlab-ci: enable static analysis with luacheck sergeyb
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Sergey Bronnikov <sergeyb@tarantool.org>

config includes all files with Lua source code except:
- third_party repositories
- directories with diff-based tests

How-to check:

$ tarantoolctl rocks install luacheck
$ .rocks/bin/luacheck --codes --config .luacheckrc .

Closes #4681

Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
---
 .luacheckrc | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 .luacheckrc

diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 000000000..2683c8c26
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,26 @@
+include_files = {
+    "**/*.lua",
+    "extra/dist/tarantoolctl.in",
+}
+
+exclude_files = {
+    "build/**/*.lua",
+    "src/box/lua/serpent.lua", -- third-party source code
+    "test/app/*.lua",
+    "test/app-tap/lua/serializer_test.lua",
+    "test/box/**/*.lua",
+    "test/engine/*.lua",
+    "test/engine_long/*.lua",
+    "test/long_run-py/**/*.lua",
+    "test/vinyl/*.lua",
+    "test/replication/*.lua",
+    "test/sql/*.lua",
+    "test/swim/*.lua",
+    "test/xlog/*.lua",
+    "test/wal_off/*.lua",
+    "test/var/**/*.lua",
+    "test-run/**/*.lua",
+    "third_party/**/*.lua",
+    ".rocks/**/*.lua",
+    ".git/**/*.lua",
+}
-- 
2.23.0

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

* [Tarantool-patches] [PATCH v4 2/10] gitlab-ci: enable static analysis with luacheck
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 1/10] Add initial luacheck config sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-21 20:04   ` Alexander Tikhonov
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in sergeyb
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #4681
---
 .gitlab-ci.yml |  9 +++++++++
 .travis.mk     | 15 ++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cd710027f..adbd892c8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,5 @@
 stages:
+  - static_analysis
   - test
   - perf
   - cleanup
@@ -96,6 +97,14 @@ variables:
   script:
     - ${GITLAB_MAKE} perf_run
 
+# Static Analysis
+
+luacheck:
+  <<: *docker_test_definition
+  stage: static_analysis
+  script:
+    - ${GITLAB_MAKE} test_debian_luacheck
+
 # Tests
 
 release:
diff --git a/.travis.mk b/.travis.mk
index f709a18b6..d917a1694 100644
--- a/.travis.mk
+++ b/.travis.mk
@@ -77,9 +77,13 @@ deps_buster_clang_8: deps_debian
 # Release
 
 build_debian:
-	cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS}
+	# ENABLE_DIST required to enable tarantoolctl for test_debian_luacheck
+	cmake . -DENABLE_DIST=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS}
 	make -j
 
+build_debian_install: build_debian
+	sudo make install
+
 test_debian_no_deps: build_debian
 	cd test && /usr/bin/python test-run.py --force $(TEST_RUN_EXTRA_PARAMS)
 
@@ -145,6 +149,15 @@ test_static_build: deps_debian_static
 test_static_docker_build:
 	docker build --network=host --build-arg RUN_TESTS=ON -f Dockerfile.staticbuild .
 
+# ###################
+# Static Analysis
+# ###################
+
+test_debian_luacheck: build_debian_install
+	tarantoolctl rocks install luacheck
+	# TODO: run in parallel with LuaLanes
+	.rocks/bin/luacheck --codes --config .luacheckrc .
+
 #######
 # OSX #
 #######
-- 
2.23.0

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

* [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 1/10] Add initial luacheck config sergeyb
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 2/10] gitlab-ci: enable static analysis with luacheck sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-23 11:40   ` Igor Munkin
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 4/10] Fix luacheck warnings in src/lua/ sergeyb
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #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 ++
 extra/dist/tarantoolctl.in | 29 +++++++++++++----------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 2683c8c26..0b7dc2dfe 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -24,3 +24,5 @@ exclude_files = {
     ".rocks/**/*.lua",
     ".git/**/*.lua",
 }
+
+files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
index f5a912ccd..1c980fedc 100755
--- a/extra/dist/tarantoolctl.in
+++ b/extra/dist/tarantoolctl.in
@@ -46,7 +46,6 @@ local instance_dir
 local default_cfg
 local positional_arguments
 local keyword_arguments
-local lua_arguments = arg
 local language
 
 -- function for printing usage reference
@@ -64,13 +63,12 @@ end
 
 local function check_user_level()
     local uid = os.getenv('UID')
-    local udir = nil
     if uid == 0 or os.getenv("NOTIFY_SOCKET") then
         return nil
     end
     -- local dir configuration
     local pwd = os.getenv('PWD')
-    udir = pwd and pwd .. '/.tarantoolctl'
+    local udir = pwd and pwd .. '/.tarantoolctl'
     udir = udir and fio.stat(udir) and udir or nil
     -- or home dir configuration
     local homedir = os.getenv('HOME')
@@ -127,15 +125,15 @@ end
 local function load_default_file(default_file)
     if default_file then
         local env = setmetatable({}, { __index = _G })
-        local ufunc, msg = loadfile(default_file)
+        local ufunc, loaderr = loadfile(default_file)
         -- if load fails - show the last 10 lines of the log file
         if not ufunc then
-            log.error("Failed to load defaults file: %s", msg)
+            log.error("Failed to load defaults file: %s", loaderr)
         end
         debug.setfenv(ufunc, env)
-        local state, msg = pcall(ufunc)
+        local state, err = pcall(ufunc)
         if not state then
-            log.error('Failed to execute defaults file: %s', msg)
+            log.error('Failed to execute defaults file: %s', err)
         end
         default_cfg = env.default_cfg
         instance_dir = env.instance_dir
@@ -790,7 +788,7 @@ end
 local function eval()
     local console_sock_path = uri.parse(console_sock).service
     local filename = arg[3]
-    local code = nil
+    local code
     if filename == nil then
         if stdin_isatty() then
             log.error("Usage:")
@@ -848,7 +846,6 @@ end
 -- xlog / snap file, so even when it stops on LSN >= @a opts.to on
 -- a current file a next file will be processed.
 local function filter_xlog(gen, param, state, opts, cb)
-    local spaces = opts.spaces
     local from, to, spaces = opts.from, opts.to, opts.space
     local show_system, replicas = opts['show-system'], opts.replica
 
@@ -862,7 +859,7 @@ local function filter_xlog(gen, param, state, opts, cb)
         elseif (lsn < from) or (lsn >= to) or
            (not spaces and sid and sid < 512 and not show_system) or
            (spaces and (sid == nil or not find_in_list(sid, spaces))) or
-           (replicas and not find_in_list(rid, replicas)) then
+           (replicas and not find_in_list(rid, replicas)) then -- luacheck: ignore
             -- pass this tuple
         else
             cb(record)
@@ -875,7 +872,7 @@ local function cat()
     local cat_format = opts.format
     local format_cb = cat_formats[cat_format]
     local is_printed = false
-    for id, file in ipairs(positional_arguments) do
+    for _, file in ipairs(positional_arguments) do
         log.error("Processing file '%s'", file)
         local gen, param, state = xlog.pairs(file)
         filter_xlog(gen, param, state, opts, function(record)
@@ -901,7 +898,7 @@ local function play()
     if not remote:wait_connected() then
         error(("Error while connecting to host '%s'"):format(uri))
     end
-    for id, file in ipairs(positional_arguments) do
+    for _, file in ipairs(positional_arguments) do
         log.info(("Processing file '%s'"):format(file))
         local gen, param, state = xlog.pairs(file)
         filter_xlog(gen, param, state, opts, function(record)
@@ -923,7 +920,7 @@ local function play()
 end
 
 local function find_arg(name_arg)
-    for i, key in ipairs(arg) do
+    for _, key in ipairs(arg) do
         if key:find(name_arg) ~= nil then
             return key
         end
@@ -937,7 +934,7 @@ local function rocks()
     local util = require("luarocks.util")
     local command_line = require("luarocks.cmd")
     local options = keyword_arguments
-    local key = nil
+    local key
     if options["only-server"] ~= nil then
         key = find_arg("only%-server")
     else
@@ -954,7 +951,7 @@ local function rocks()
     end
 
     -- Tweak help messages
-    util.see_help = function(command, program)
+    util.see_help = function()
         -- TODO: print extended help message here
         return "See Tarantool documentation for help."
     end
@@ -1321,7 +1318,7 @@ local function usage_command(name, cmd)
     if type(header) == 'string' then
         header = { header }
     end
-    for no, line in ipairs(header) do
+    for _, line in ipairs(header) do
         log.error("    " .. line, name)
     end
 end
-- 
2.23.0

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

* [Tarantool-patches] [PATCH v4 4/10] Fix luacheck warnings in src/lua/
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
                   ` (2 preceding siblings ...)
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-23 14:13   ` Igor Munkin
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/ sergeyb
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #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            |  3 ++
 src/lua/argparse.lua   |  6 ++--
 src/lua/buffer.lua     |  4 +--
 src/lua/clock.lua      |  2 +-
 src/lua/crypto.lua     |  4 +--
 src/lua/csv.lua        |  5 ++-
 src/lua/digest.lua     |  2 +-
 src/lua/env.lua        |  2 +-
 src/lua/fiber.lua      |  4 +--
 src/lua/fio.lua        | 25 +++++++-------
 src/lua/help.lua       |  7 ++--
 src/lua/httpc.lua      |  3 --
 src/lua/init.lua       |  7 ++--
 src/lua/msgpackffi.lua | 22 +++++--------
 src/lua/socket.lua     | 65 ++++++++++++++++++-------------------
 src/lua/string.lua     |  1 -
 src/lua/swim.lua       | 10 +++---
 src/lua/tap.lua        | 74 ++++++++++++++++++++----------------------
 src/lua/trigger.lua    |  3 --
 19 files changed, 117 insertions(+), 132 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 0b7dc2dfe..60aedc842 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -26,3 +26,6 @@ exclude_files = {
 }
 
 files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
+files["src/lua/swim.lua"] = {ignore = {"431"}}
+files["src/lua/fio.lua"] = {ignore = {"231"}}
+files["src/lua/init.lua"] = {globals = {"dostring"}}
diff --git a/src/lua/argparse.lua b/src/lua/argparse.lua
index faa0ae130..f58985425 100644
--- a/src/lua/argparse.lua
+++ b/src/lua/argparse.lua
@@ -90,8 +90,8 @@ local function convert_parameter(name, convert_from, convert_to)
     return convert_from
 end
 
-local function parameters_parse(t_in, options)
-    local t_out, t_in = {}, t_in or {}
+local function parameters_parse(t__in, options)
+    local t_out, t_in = {}, t__in or {}
 
     -- Prepare a lookup table for options. An option name -> a
     -- type name to convert a parameter into or true (which means
@@ -145,7 +145,7 @@ local function parameters_parse(t_in, options)
                 if parameter_has_value(lookup[command]) then
                     -- in case next argument is value of this key (not --arg)
                     local next_arg = t_in[i + 1]
-                    local is_long, is_short, is_dash = parse_param_prefix(next_arg)
+                    is_long, is_short, is_dash = parse_param_prefix(next_arg)
                     if is_dash then
                         skip_param = true
                     elseif is_long == false and not is_short and not is_dash then
diff --git a/src/lua/buffer.lua b/src/lua/buffer.lua
index 9aac82b39..43c7e1170 100644
--- a/src/lua/buffer.lua
+++ b/src/lua/buffer.lua
@@ -182,7 +182,7 @@ local ibuf_methods = {
     unused = ibuf_unused;
 }
 
-local function ibuf_tostring(ibuf)
+local function ibuf_tostring()
     return '<ibuf>'
 end
 local ibuf_mt = {
@@ -193,7 +193,7 @@ local ibuf_mt = {
 
 ffi.metatype(ibuf_t, ibuf_mt);
 
-local function ibuf_new(arg, arg2)
+local function ibuf_new(arg)
     local buf = ffi.new(ibuf_t)
     local slabc = builtin.tarantool_lua_slab_cache()
     builtin.ibuf_create(buf, slabc, READAHEAD)
diff --git a/src/lua/clock.lua b/src/lua/clock.lua
index 60c78663c..fee43ccde 100644
--- a/src/lua/clock.lua
+++ b/src/lua/clock.lua
@@ -33,7 +33,7 @@ clock.bench = function(fun, ...)
     overhead = clock.proc() - overhead
     local start_time = clock.proc()
     local res = {0, fun(...)}
-    res[1] = clock.proc() - start_time - overhead, res
+    res[1] = clock.proc() - start_time - overhead
     return res
 end
 
diff --git a/src/lua/crypto.lua b/src/lua/crypto.lua
index bf3064c70..c0eb0d303 100644
--- a/src/lua/crypto.lua
+++ b/src/lua/crypto.lua
@@ -75,7 +75,7 @@ local function openssl_err_str()
 end
 
 local digests = {}
-for class, name in pairs({
+for class, _ in pairs({
     md2 = 'MD2', md4 = 'MD4', md5 = 'MD5',
     sha1 = 'SHA1', sha224 = 'SHA224',
     sha256 = 'SHA256', sha384 = 'SHA384', sha512 = 'SHA512',
@@ -428,7 +428,7 @@ local public_methods = {
 }
 
 local module_mt = {
-    __serialize = function(s)
+    __serialize = function()
         return public_methods
     end,
     __index = public_methods
diff --git a/src/lua/csv.lua b/src/lua/csv.lua
index 7dff2f213..de6726bb7 100644
--- a/src/lua/csv.lua
+++ b/src/lua/csv.lua
@@ -188,10 +188,10 @@ module.dump = function(t, opts, writable)
     if type(writable) == 'nil' then
         result_table = {}
     end
-    for k, line in pairs(t) do
+    for _, line in pairs(t) do
         local first = true
         local output_tuple = {}
-        for k2, field in pairs(line) do
+        for _, field in pairs(line) do
             local strf = tostring(field)
             local buf_new_size = (strf:len() + 1) * 2
             if buf_new_size > bufsz then
@@ -214,7 +214,6 @@ module.dump = function(t, opts, writable)
         else
             writable:write(table.concat(output_tuple))
         end
-        output_tuple = {}
     end
     ffi.C.csv_destroy(csv)
     csv.realloc(buf, 0)
diff --git a/src/lua/digest.lua b/src/lua/digest.lua
index 6ed91cfa2..7f1aea8d0 100644
--- a/src/lua/digest.lua
+++ b/src/lua/digest.lua
@@ -246,7 +246,7 @@ local m = {
     end
 }
 
-for digest, name in pairs(digest_shortcuts) do
+for digest, _ in pairs(digest_shortcuts) do
     m[digest] = function (str)
         return crypto.digest[digest](str)
     end
diff --git a/src/lua/env.lua b/src/lua/env.lua
index dd1616a84..a31b7098f 100644
--- a/src/lua/env.lua
+++ b/src/lua/env.lua
@@ -28,7 +28,7 @@ os.environ = function()
 end
 
 os.setenv = function(key, value)
-    local rv = nil
+    local rv
     if value ~= nil then
         rv = ffi.C.setenv(key, value, 1)
     else
diff --git a/src/lua/fiber.lua b/src/lua/fiber.lua
index 89c17f63d..b14117714 100644
--- a/src/lua/fiber.lua
+++ b/src/lua/fiber.lua
@@ -39,8 +39,8 @@ local stall = fiber.stall
 fiber.stall = nil
 
 local worker_next_task = nil
-local worker_last_task = nil
-local worker_fiber = nil
+local worker_last_task
+local worker_fiber
 
 --
 -- Worker is a singleton fiber for not urgent delayed execution of
diff --git a/src/lua/fio.lua b/src/lua/fio.lua
index 83fddaa0a..b2b4b4c77 100644
--- a/src/lua/fio.lua
+++ b/src/lua/fio.lua
@@ -329,7 +329,7 @@ fio.abspath = function(path)
         error("Usage: fio.abspath(path)")
     end
     path = path
-    local joined_path = ''
+    local joined_path
     local path_tab = {}
     if string.sub(path, 1, 1) == '/' then
         joined_path = path
@@ -366,7 +366,7 @@ fio.listdir = function(path)
         return t
     end
     local names = string.split(str, "\n")
-    for i, name in ipairs(names) do
+    for _, name in ipairs(names) do
         table.insert(t, name)
     end
     return t
@@ -378,15 +378,15 @@ fio.mktree = function(path, mode)
     end
     path = fio.abspath(path)
 
-    local path = string.gsub(path, '^/', '')
+    path = string.gsub(path, '^/', '')
     local dirs = string.split(path, "/")
 
     local current_dir = "/"
-    for i, dir in ipairs(dirs) do
+    for _, dir in ipairs(dirs) do
         current_dir = fio.pathjoin(current_dir, dir)
         local stat = fio.stat(current_dir)
         if stat == nil then
-            local st, err = fio.mkdir(current_dir, mode)
+            local _, err = fio.mkdir(current_dir, mode)
             -- fio.stat() and fio.mkdir() above are separate calls
             -- and a file system may be changed between them. So
             -- if the error here is due to an existing directory,
@@ -407,20 +407,20 @@ fio.rmtree = function(path)
     if type(path) ~= 'string' then
         error("Usage: fio.rmtree(path)")
     end
-    local status, err
+    local status
     path = fio.abspath(path)
     local ls, err = fio.listdir(path)
     if err ~= nil then
         return nil, err
     end
-    for i, f in ipairs(ls) do
+    for _, f in ipairs(ls) do
         local tmppath = fio.pathjoin(path, f)
         local st = fio.lstat(tmppath)
         if st then
             if st:is_dir() then
-                st, err = fio.rmtree(tmppath)
+                _, err = fio.rmtree(tmppath)
             else
-                st, err = fio.unlink(tmppath)
+                _, err = fio.unlink(tmppath)
             end
             if err ~= nil  then
                 return nil, err
@@ -471,10 +471,10 @@ fio.copytree = function(from, to)
     if reason ~= nil then
         return false, reason
     end
-    for i, f in ipairs(ls) do
+    for _, f in ipairs(ls) do
         local ffrom = fio.pathjoin(from, f)
         local fto = fio.pathjoin(to, f)
-        local st = fio.lstat(ffrom)
+        st = fio.lstat(ffrom)
         if st and st:is_dir() then
             status, reason = fio.copytree(ffrom, fto)
             if reason ~= nil then
@@ -488,7 +488,8 @@ fio.copytree = function(from, to)
             end
         end
         if st:is_link() then
-            local link_to, reason = fio.readlink(ffrom)
+            local link_to
+            link_to, reason = fio.readlink(ffrom)
             if reason ~= nil then
                 return false, reason
             end
diff --git a/src/lua/help.lua b/src/lua/help.lua
index 54ff1b5d0..1b822828b 100644
--- a/src/lua/help.lua
+++ b/src/lua/help.lua
@@ -11,10 +11,7 @@ help = { doc.help }
 tutorial = {}
 tutorial[1] = help[1]
 
-local help_function_data = {};
-local help_object_data = {}
-
-local function help_call(table, param)
+local function help_call()
     return help
 end
 
@@ -22,7 +19,7 @@ setmetatable(help, { __call = help_call })
 
 local screen_id = 1;
 
-local function tutorial_call(table, action)
+local function tutorial_call(action)
     if action == 'start' then
         screen_id = 1;
     elseif action == 'next' or action == 'more' then
diff --git a/src/lua/httpc.lua b/src/lua/httpc.lua
index 6381c6a1a..9336dcee0 100644
--- a/src/lua/httpc.lua
+++ b/src/lua/httpc.lua
@@ -29,8 +29,6 @@
 --  SUCH DAMAGE.
 --
 
-local fiber = require('fiber')
-
 local driver = package.loaded.http.client
 package.loaded.http = nil
 
@@ -112,7 +110,6 @@ local special_characters = {
     [']'] = true,
     ['<'] = true,
     ['>'] = true,
-    ['>'] = true,
     ['@'] = true,
     [','] = true,
     [';'] = true,
diff --git a/src/lua/init.lua b/src/lua/init.lua
index ff3e74c3c..a831549d1 100644
--- a/src/lua/init.lua
+++ b/src/lua/init.lua
@@ -144,9 +144,9 @@ local function gen_search_func(path_fn, templates, need_traverse)
 
         local searchpaths = {}
 
-        for _, path in ipairs(paths) do
+        for _, p in ipairs(paths) do
             for _, template in pairs(templates) do
-                table.insert(searchpaths, fio.pathjoin(path, template))
+                table.insert(searchpaths, fio.pathjoin(p, template))
             end
         end
 
@@ -176,7 +176,8 @@ local function gen_loader_func(search_fn, load_fn)
         if not file then
             return err
         end
-        local loaded, err = load_fn(file, name)
+        local loaded
+        loaded, err = load_fn(file, name)
         if err == nil then
             return loaded
         else
diff --git a/src/lua/msgpackffi.lua b/src/lua/msgpackffi.lua
index f01ffaef0..793f47854 100644
--- a/src/lua/msgpackffi.lua
+++ b/src/lua/msgpackffi.lua
@@ -302,10 +302,6 @@ local function encode(obj)
     return r
 end
 
-local function encode_ibuf(obj, ibuf)
-    encode_r(ibuf, obj, 0)
-end
-
 on_encode(ffi.typeof('uint8_t'), encode_int)
 on_encode(ffi.typeof('uint16_t'), encode_int)
 on_encode(ffi.typeof('uint32_t'), encode_int)
@@ -332,7 +328,6 @@ local decode_r
 
 -- See similar constants in utils.cc
 local DBL_INT_MAX = 1e14 - 1
-local DBL_INT_MIN = -1e14 + 1
 
 local function decode_u8(data)
     local num = ffi.cast(uint8_ptr_t, data[0])[0]
@@ -477,8 +472,7 @@ end
 local function decode_array(data, size)
     assert (type(size) == "number")
     local arr = {}
-    local i
-    for i=1,size,1 do
+    for _ = 1, size do
         table.insert(arr, decode_r(data))
     end
     if not msgpack.cfg.decode_save_metatables then
@@ -490,8 +484,7 @@ end
 local function decode_map(data, size)
     assert (type(size) == "number")
     local map = {}
-    local i
-    for i=1,size,1 do
+    for _ = 1, size do
         local key = decode_r(data);
         local val = decode_r(data);
         map[key] = val
@@ -504,11 +497,15 @@ end
 
 local ext_decoder = {
     -- MP_UNKNOWN_EXTENSION
-    [0] = function(data, len) error("unsupported extension type") end,
+    [0] = function() error("unsupported extension type") end,
     -- MP_DECIMAL
     [1] = function(data, len) local num = ffi.new("decimal_t") builtin.decimal_unpack(data, len, num) return num end,
     -- MP_UUID
-    [2] = function(data, len) local uuid = ffi.new("struct tt_uuid") builtin.uuid_unpack(data, len, uuid) return uuid end,
+    [2] = function(data, len)
+        local uuid = ffi.new("struct tt_uuid")
+        builtin.uuid_unpack(data, len, uuid)
+        return uuid
+    end,
 }
 
 local function decode_ext(data)
@@ -516,7 +513,6 @@ local function decode_ext(data)
     -- mp_decode_extl and mp_decode_decimal
     -- need type code
     data[0] = data[0] - 1
-    local old_data = data[0]
     local len = builtin.mp_decode_extl(data, t)
     local fun = ext_decoder[t[0]]
     if type(fun) == 'function' then
@@ -603,7 +599,7 @@ local function check_offset(offset, len)
     if offset == nil then
         return 1
     end
-    local offset = ffi.cast('ptrdiff_t', offset)
+    offset = ffi.cast('ptrdiff_t', offset)
     if offset < 1 or offset > len then
         error(string.format("offset = %d is out of bounds [1..%d]",
             tonumber(offset), len))
diff --git a/src/lua/socket.lua b/src/lua/socket.lua
index a334ad45b..317acfe8e 100644
--- a/src/lua/socket.lua
+++ b/src/lua/socket.lua
@@ -172,7 +172,7 @@ local function get_iflags(table, flags)
     if type(flags) ~= 'table' then
         flags = { flags }
     end
-    for i, f in pairs(flags) do
+    for _, f in pairs(flags) do
         if table[f] == nil then
             return nil
         end
@@ -660,7 +660,7 @@ local function check_delimiter(self, limit, eols)
     end
 
     local shortest
-    for i, eol in ipairs(eols) do
+    for _, eol in ipairs(eols) do
         local data = ffi.C.memmem(rbuf.rpos, rbuf:size(), eol, #eol)
         if data ~= nil then
             local len = ffi.cast('char *', data) - rbuf.rpos + #eol
@@ -706,16 +706,16 @@ local function read(self, limit, timeout, check, ...)
         local res = sysread(self, data, rbuf:unused())
         if res == 0 then -- eof
             self._errno = nil
-            local len = rbuf:size()
-            local data = ffi.string(rbuf.rpos, len)
+            len = rbuf:size()
+            data = ffi.string(rbuf.rpos, len)
             rbuf.rpos = rbuf.rpos + len
             return data
         elseif res ~= nil then
             rbuf.wpos = rbuf.wpos + res
-            local len = check(self, limit, ...)
+            len = check(self, limit, ...)
             if len ~= nil then
                 self._errno = nil
-                local data = ffi.string(rbuf.rpos, len)
+                data = ffi.string(rbuf.rpos, len)
                 rbuf.rpos = rbuf.rpos + len
                 return data
             end
@@ -1039,7 +1039,7 @@ local function tcp_connect(host, port, timeout)
         boxerrno(0)
         return s
     end
-    local timeout = timeout or TIMEOUT_INFINITY
+    timeout = timeout or TIMEOUT_INFINITY
     local stop = fiber.clock() + timeout
     local dns = getaddrinfo(host, port, timeout, { type = 'SOCK_STREAM',
         protocol = 'tcp' })
@@ -1047,7 +1047,7 @@ local function tcp_connect(host, port, timeout)
         boxerrno(boxerrno.EINVAL)
         return nil
     end
-    for i, remote in pairs(dns) do
+    for _, remote in pairs(dns) do
         timeout = stop - fiber.clock()
         if timeout <= 0 then
             boxerrno(boxerrno.ETIMEDOUT)
@@ -1078,8 +1078,8 @@ local function tcp_server_handler(server, sc, from)
     end
 end
 
-local function tcp_server_loop(server, s, addr)
-    fiber.name(format("%s/%s:%s", server.name, addr.host, addr.port), {truncate = true})
+local function tcp_server_loop(server, s, address)
+    fiber.name(format("%s/%s:%s", server.name, address.host, address.port), {truncate = true})
     log.info("started")
     while socket_readable(s) do
         local sc, from = socket_accept(s)
@@ -1104,15 +1104,15 @@ local function tcp_server_usage()
     error('Usage: socket.tcp_server(host, port, handler | opts)')
 end
 
-local function tcp_server_do_bind(s, addr)
-    if socket_bind(s, addr.host, addr.port) then
-        if addr.family == 'AF_UNIX' then
+local function tcp_server_do_bind(s, address)
+    if socket_bind(s, address.host, address.port) then
+        if address.family == 'AF_UNIX' then
             -- Make close() remove the unix socket file created
             -- by bind(). Note, this must be done before closing
             -- the socket fd so that no other tcp server can
             -- reuse the same path before we remove the file.
             s.close = function(self)
-                fio.unlink(addr.port)
+                fio.unlink(address.port)
                 return socket_close(self)
             end
         end
@@ -1121,12 +1121,12 @@ local function tcp_server_do_bind(s, addr)
     return false
 end
 
-local function tcp_server_bind_addr(s, addr)
-    if tcp_server_do_bind(s, addr) then
+local function tcp_server_bind_addr(s, address)
+    if tcp_server_do_bind(s, address) then
         return true
     end
 
-    if addr.family ~= 'AF_UNIX' then
+    if address.family ~= 'AF_UNIX' then
         return false
     end
 
@@ -1136,7 +1136,7 @@ local function tcp_server_bind_addr(s, addr)
 
     local save_errno = boxerrno()
 
-    local sc = tcp_connect(addr.host, addr.port)
+    local sc = tcp_connect(address.host, address.port)
     if sc ~= nil then
         sc:close()
         boxerrno(save_errno)
@@ -1148,13 +1148,13 @@ local function tcp_server_bind_addr(s, addr)
         return false
     end
 
-    log.info("tcp_server: remove dead UNIX socket: %s", addr.port)
-    if not fio.unlink(addr.port) then
+    log.info("tcp_server: remove dead UNIX socket: %s", address.port)
+    if not fio.unlink(address.port) then
         log.warn("tcp_server: %s", boxerrno.strerror())
         boxerrno(save_errno)
         return false
     end
-    return tcp_server_do_bind(s, addr)
+    return tcp_server_do_bind(s, address)
 end
 
 
@@ -1172,8 +1172,8 @@ local function tcp_server_bind(host, port, prepare, timeout)
         end
     end
 
-    for _, addr in ipairs(dns) do
-        local s = socket_new(addr.family, addr.type, addr.protocol)
+    for _, address in ipairs(dns) do
+        local s = socket_new(address.family, address.type, address.protocol)
         if s ~= nil then
             local backlog
             if prepare then
@@ -1181,13 +1181,13 @@ local function tcp_server_bind(host, port, prepare, timeout)
             else
                 socket_setsockopt(s, 'SOL_SOCKET', 'SO_REUSEADDR', 1) -- ignore error
             end
-            if not tcp_server_bind_addr(s, addr) or not s:listen(backlog) then
+            if not tcp_server_bind_addr(s, address) or not s:listen(backlog) then
                 local save_errno = boxerrno()
                 socket_close(s)
                 boxerrno(save_errno)
                 return nil
             end
-            return s, addr
+            return s, address
        end
     end
     -- DNS resolved successfully, but addresss family is not supported
@@ -1211,12 +1211,12 @@ local function tcp_server(host, port, opts, timeout)
         tcp_server_usage()
     end
     server.name = server.name or 'server'
-    local s, addr = tcp_server_bind(host, port, server.prepare, timeout)
+    local s, address = tcp_server_bind(host, port, server.prepare, timeout)
     if not s then
         return nil
     end
-    fiber.create(tcp_server_loop, server, s, addr)
-    return s, addr
+    fiber.create(tcp_server_loop, server, s, address)
+    return s, address
 end
 
 socket_mt   = {
@@ -1311,10 +1311,9 @@ local function lsocket_tcp_getpeername(self)
     return peer.host, tostring(peer.port), peer.family:match("AF_(.*)"):lower()
 end
 
-local function lsocket_tcp_settimeout(self, value, mode)
+local function lsocket_tcp_settimeout(self, value)
     check_socket(self)
     self.timeout = value
-    -- mode is effectively ignored
     return 1
 end
 
@@ -1467,7 +1466,7 @@ local function lsocket_tcp_receive(self, pattern, prefix)
         local result = { prefix }
         local deadline = fiber.clock() + (self.timeout or TIMEOUT_INFINITY)
         repeat
-            local data = read(self, LIMIT_INFINITY, timeout, check_infinity)
+            data = read(self, LIMIT_INFINITY, timeout, check_infinity)
             if data == nil then
                 if not errno_is_transient[self._errno] then
                     return nil, socket_error(self)
@@ -1535,7 +1534,7 @@ lsocket_tcp_mt.__index.send = lsocket_tcp_send;
 -- TCP Constructor and Shortcuts
 --
 
-local function lsocket_tcp()
+local function lsocket_tcp(self)
     local s = socket_new('AF_INET', 'SOCK_STREAM', 'tcp')
     if not s then
         return nil, socket_error(self)
@@ -1559,7 +1558,7 @@ local function lsocket_bind(host, port, backlog)
     if host == nil or port == nil then
         error("Usage: luasocket.bind(host, port [, backlog])")
     end
-    local function prepare(s) return backlog end
+    local function prepare() return backlog end
     local s = tcp_server_bind(host, port, prepare)
     if not s then
         return nil, boxerrno.strerror()
diff --git a/src/lua/string.lua b/src/lua/string.lua
index 6e12c59ae..d3a846645 100644
--- a/src/lua/string.lua
+++ b/src/lua/string.lua
@@ -233,7 +233,6 @@ local function string_startswith(inp, head, _start, _end)
         return false
     end
     _start = _start - 1
-    _end = _start + head_len - 1
     return memcmp(c_char_ptr(inp) + _start, c_char_ptr(head), head_len) == 0
 end
 
diff --git a/src/lua/swim.lua b/src/lua/swim.lua
index 0859915c9..8e3b0ab13 100644
--- a/src/lua/swim.lua
+++ b/src/lua/swim.lua
@@ -371,7 +371,7 @@ end
 --
 local function swim_member_payload_str(m)
     local ptr = swim_check_member(m, 'member:payload_str()')
-    local cdata, size = swim_member_payload_raw(ptr)
+    local _, size = swim_member_payload_raw(ptr)
     if size > 0 then
         return ffi.string(swim_member_payload_raw(ptr))
     end
@@ -462,7 +462,7 @@ local swim_member_mt = {
         is_dropped = swim_member_is_dropped,
     },
     __serialize = swim_member_serialize,
-    __newindex = function(m)
+    __newindex = function()
         return error('swim_member is a read-only object')
     end
 }
@@ -793,9 +793,9 @@ local function swim_on_member_event_new(s, callback, ctx)
     -- trigger will never be GC-ed.
     s = setmetatable({s}, {__mode = 'v'})
     return function(member_ptr, event_mask)
-        local s = s[1]
-        if s then
-            local m = swim_wrap_member(s, member_ptr)
+        local si = s[1]
+        if si then
+            local m = swim_wrap_member(si, member_ptr)
             local event = setmetatable({event_mask}, swim_member_event_mt)
             return callback(m, event, ctx)
         end
diff --git a/src/lua/tap.lua b/src/lua/tap.lua
index 94b080d5a..094eb883f 100644
--- a/src/lua/tap.lua
+++ b/src/lua/tap.lua
@@ -53,7 +53,6 @@ local function ok(test, cond, message, extra)
     io.write(string.format("not ok - %s\n", message))
     extra = extra or {}
     if test.trace then
-        local frame = debug.getinfo(3, "Sl")
         extra.trace = traceback()
         extra.filename = extra.trace[#extra.trace].filename
         extra.line = extra.trace[#extra.trace].line
@@ -76,9 +75,6 @@ local function skip(test, message, extra)
     ok(test, true, message.." # skip", extra)
 end
 
-
-local nan = 0/0
-
 local function cmpdeeply(got, expected, extra)
     if type(expected) == "number" or type(got) == "number" then
         extra.got = got
@@ -190,38 +186,38 @@ local function isboolean(test, v, message, extra)
     return is(test, type(v), 'boolean', message, extra)
 end
 
-local function isfunction(test, v, message, extra)
-    return is(test, type(v), 'function', message, extra)
+local function isfunction(testcase, v, message, extra)
+    return is(testcase, type(v), 'function', message, extra)
 end
 
-local function isudata(test, v, utype, message, extra)
+local function isudata(testcase, v, utype, message, extra)
     extra = extra or {}
     extra.expected = 'userdata<'..utype..'>'
     if type(v) == 'userdata' then
         extra.got = 'userdata<'..getmetatable(v)..'>'
-        return ok(test, getmetatable(v) == utype, message, extra)
+        return ok(testcase, getmetatable(v) == utype, message, extra)
     else
         extra.got = type(v)
-        return fail(test, message, extra)
+        return fail(testcase, message, extra)
     end
 end
 
-local function iscdata(test, v, ctype, message, extra)
+local function iscdata(testcase, v, ctype, message, extra)
     extra = extra or {}
     extra.expected = ffi.typeof(ctype)
     if type(v) == 'cdata' then
         extra.got = ffi.typeof(v)
-        return ok(test, ffi.istype(ctype, v), message, extra)
+        return ok(testcase, ffi.istype(ctype, v), message, extra)
     else
         extra.got = type(v)
-        return fail(test, message, extra)
+        return fail(testcase, message, extra)
     end
 end
 
 local test_mt
 local function test(parent, name, fun, ...)
     local level = parent ~= nil and parent.level + 1 or 0
-    local test = setmetatable({
+    local testcase = setmetatable({
         parent  = parent;
         name    = name;
         level   = level;
@@ -232,48 +228,48 @@ local function test(parent, name, fun, ...)
         strict = false;
     }, test_mt)
     if fun ~= nil then
-        test:diag('%s', test.name)
-        fun(test, ...)
-        test:diag('%s: end', test.name)
-        return test:check()
+        testcase:diag('%s', testcase.name)
+        fun(testcase, ...)
+        testcase:diag('%s: end', testcase.name)
+        return testcase:check()
     else
-        return test
+        return testcase
     end
 end
 
-local function plan(test, planned)
-    test.planned = planned
-    io.write(string.rep(' ', 4 * test.level), string.format("1..%d\n", planned))
+local function plan(testcase, planned)
+    testcase.planned = planned
+    io.write(string.rep(' ', 4 * testcase.level), string.format("1..%d\n", planned))
 end
 
-local function check(test)
-    if test.checked then
+local function check(testcase)
+    if testcase.checked then
         error('check called twice')
     end
-    test.checked = true
-    if test.planned ~= test.total then
-        if test.parent ~= nil then
-            ok(test.parent, false, "bad plan", { planned = test.planned;
-                run = test.total})
+    testcase.checked = true
+    if testcase.planned ~= testcase.total then
+        if testcase.parent ~= nil then
+            ok(testcase.parent, false, "bad plan", { planned = testcase.planned;
+                run = testcase.total})
         else
-            diag(test, string.format("bad plan: planned %d run %d",
-                test.planned, test.total))
+            diag(testcase, string.format("bad plan: planned %d run %d",
+                testcase.planned, testcase.total))
         end
-    elseif test.failed > 0 then
-        if test.parent ~= nil then
-            ok(test.parent, false, "failed subtests", {
-                failed = test.failed;
-                planned = test.planned;
+    elseif testcase.failed > 0 then
+        if testcase.parent ~= nil then
+            ok(testcase.parent, false, "failed subtests", {
+                failed = testcase.failed;
+                planned = testcase.planned;
             })
         else
-            diag(test, "failed subtest: %d", test.failed)
+            diag(testcase, "failed subtest: %d", testcase.failed)
         end
     else
-        if test.parent ~= nil then
-            ok(test.parent, true, test.name)
+        if testcase.parent ~= nil then
+            ok(testcase.parent, true, testcase.name)
         end
     end
-    return test.planned == test.total and test.failed == 0
+    return testcase.planned == testcase.total and testcase.failed == 0
 end
 
 test_mt = {
diff --git a/src/lua/trigger.lua b/src/lua/trigger.lua
index 76a582c47..1330ecdd4 100644
--- a/src/lua/trigger.lua
+++ b/src/lua/trigger.lua
@@ -1,7 +1,4 @@
 local fun = require('fun')
-local log = require('log')
-
-local table_clear = require('table.clear')
 
 --
 -- Checks that argument is a callable, i.e. a function or a table
-- 
2.23.0

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

* [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
                   ` (3 preceding siblings ...)
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 4/10] Fix luacheck warnings in src/lua/ sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-23 22:54   ` Igor Munkin
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 6/10] Fix luacheck warnings in test/ sergeyb
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #4681

Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
---
 .luacheckrc                     |  8 ++++++++
 src/box/lua/console.lua         |  6 +++---
 src/box/lua/feedback_daemon.lua |  2 +-
 src/box/lua/key_def.lua         |  2 +-
 src/box/lua/load_cfg.lua        | 25 +++++++++++------------
 src/box/lua/net_box.lua         | 26 ++++++++----------------
 src/box/lua/schema.lua          | 35 ++++++++++++++++-----------------
 src/box/lua/tuple.lua           |  8 +++-----
 src/box/lua/upgrade.lua         | 19 +++++++++---------
 9 files changed, 62 insertions(+), 69 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 60aedc842..64692b27c 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -25,7 +25,15 @@ exclude_files = {
     ".git/**/*.lua",
 }
 
+files["**/*.lua"] = {
+    globals = {"box", "_TARANTOOL", "help", "tutorial"},
+    ignore = {"212/self", "122"}
+}
 files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
 files["src/lua/swim.lua"] = {ignore = {"431"}}
 files["src/lua/fio.lua"] = {ignore = {"231"}}
 files["src/lua/init.lua"] = {globals = {"dostring"}}
+files["src/box/lua/console.lua"] = {ignore = {"212"}}
+files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
+files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
+files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua
index 2add9a79d..5fd8b5e4e 100644
--- a/src/box/lua/console.lua
+++ b/src/box/lua/console.lua
@@ -465,7 +465,7 @@ local text_connection_mt = {
                 -- Make sure it is exactly "\set output" command.
                 if operators[items[1]] == set_param and
                     param_handlers[items[2]] == set_output then
-                    local err, fmt, opts = parse_output(items[3])
+                    local err, fmt = parse_output(items[3])
                     if not err then
                         self.fmt = fmt
                         self.eos = output_eos[fmt]
@@ -489,7 +489,7 @@ local text_connection_mt = {
                     break
                 end
                 if fmt == "yaml" then
-                    local handle, prefix = yaml.decode(rc, {tag_only = true})
+                    local handle = yaml.decode(rc, {tag_only = true})
                     if not handle then
                         -- Can not fail - tags are encoded with no
                         -- user participation and are correct always.
@@ -869,7 +869,7 @@ local function listen(uri)
         host = u.host
         port = u.service or 3313
     end
-    local s, addr = socket.tcp_server(host, port, { handler = client_handler,
+    local s = socket.tcp_server(host, port, { handler = client_handler,
         name = 'console'})
     if not s then
         error(string.format('failed to create server %s:%s: %s',
diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua
index ad71a3fe2..06bf3f281 100644
--- a/src/box/lua/feedback_daemon.lua
+++ b/src/box/lua/feedback_daemon.lua
@@ -60,7 +60,7 @@ local function guard_loop(self)
             self.fiber = fiber.create(feedback_loop, self)
             log.verbose("%s restarted", PREFIX)
         end
-        local st, err = pcall(fiber.sleep, self.interval)
+        local st = pcall(fiber.sleep, self.interval)
         if not st then
             -- fiber was cancelled
             break
diff --git a/src/box/lua/key_def.lua b/src/box/lua/key_def.lua
index 586005709..a1b61441e 100644
--- a/src/box/lua/key_def.lua
+++ b/src/box/lua/key_def.lua
@@ -15,5 +15,5 @@ ffi.metatype(key_def_t, {
     __index = function(self, key)
         return methods[key]
     end,
-    __tostring = function(key_def) return "<struct key_def &>" end,
+    __tostring = function() return "<struct key_def &>" end,
 })
diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index b671eb7a2..0926c7380 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -22,7 +22,7 @@ local function locked(f)
 end
 
 -- all available options
-local default_cfg = {
+local default_config = {
     listen              = nil,
     memtx_memory        = 256 * 1024 *1024,
     strip_core          = true,
@@ -87,7 +87,7 @@ local default_cfg = {
 
 -- types of available options
 -- could be comma separated lua types or 'any' if any type is allowed
-local template_cfg = {
+local template_config = {
     listen              = 'string, number',
     memtx_memory        = 'number',
     strip_core          = 'boolean',
@@ -170,7 +170,7 @@ local function normalize_uri_list(port_list)
 end
 
 -- options that require special handling
-local modify_cfg = {
+local modify_config = {
     listen             = normalize_uri,
     replication        = normalize_uri_list,
 }
@@ -335,7 +335,7 @@ end
 -- value of the old option, value of the new if present. It
 -- returns two values - value to replace the old option and to
 -- replace the new one.
-local translate_cfg = {
+local translate_config = {
     snapshot_count = {'checkpoint_count'},
     snapshot_period = {'checkpoint_interval'},
     slab_alloc_arena = {'memtx_memory', function(old)
@@ -430,7 +430,6 @@ local function prepare_cfg(cfg, default_cfg, template_cfg, modify_cfg, prefix)
         else
             local good_types = string.gsub(template_cfg[k], ' ', '');
             if (string.find(',' .. good_types .. ',', ',' .. type(v) .. ',') == nil) then
-                good_types = string.gsub(good_types, ',', ', ');
                 box.error(box.error.CFG, readable_name, "should be one of types "..
                     template_cfg[k])
             end
@@ -473,8 +472,8 @@ local function compare_cfg(cfg1, cfg2)
 end
 
 local function reload_cfg(oldcfg, cfg)
-    cfg = upgrade_cfg(cfg, translate_cfg)
-    local newcfg = prepare_cfg(cfg, default_cfg, template_cfg, modify_cfg)
+    cfg = upgrade_cfg(cfg, translate_config)
+    local newcfg = prepare_cfg(cfg, default_config, template_config, modify_config)
     local ordered_cfg = {}
     -- iterate over original table because prepare_cfg() may store NILs
     for key, val in pairs(cfg) do
@@ -527,16 +526,16 @@ for k, v in pairs(box) do
 end
 
 setmetatable(box, {
-    __index = function(table, index)
+    __index = function()
         error(debug.traceback("Please call box.cfg{} first"))
         error("Please call box.cfg{} first")
      end
 })
 
 local function load_cfg(cfg)
-    cfg = upgrade_cfg(cfg, translate_cfg)
-    cfg = prepare_cfg(cfg, default_cfg, template_cfg, modify_cfg)
-    apply_default_cfg(cfg, default_cfg);
+    cfg = upgrade_cfg(cfg, translate_config)
+    cfg = prepare_cfg(cfg, default_config, template_config, modify_config)
+    apply_default_cfg(cfg, default_config);
     -- Save new box.cfg
     box.cfg = cfg
     if not pcall(private.cfg_check)  then
@@ -551,7 +550,7 @@ local function load_cfg(cfg)
     box_configured = nil
     box.cfg = setmetatable(cfg,
         {
-            __newindex = function(table, index)
+            __newindex = function()
                 error('Attempt to modify a read-only table')
             end,
             __call = locked(reload_cfg),
@@ -563,7 +562,7 @@ local function load_cfg(cfg)
             if not dynamic_cfg_skip_at_load[key] then
                 fun()
             end
-            if not compare_cfg(val, default_cfg[key]) then
+            if not compare_cfg(val, default_config[key]) then
                 if log_cfg_option[key] ~= nil then
                     val = log_cfg_option[key](val)
                 end
diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
index 07fa54c38..1e351bb31 100644
--- a/src/box/lua/net_box.lua
+++ b/src/box/lua/net_box.lua
@@ -38,10 +38,6 @@ local IPROTO_STATUS_KEY    = 0x00
 local IPROTO_ERRNO_MASK    = 0x7FFF
 local IPROTO_SYNC_KEY      = 0x01
 local IPROTO_SCHEMA_VERSION_KEY = 0x05
-local IPROTO_METADATA_KEY = 0x32
-local IPROTO_SQL_INFO_KEY = 0x42
-local SQL_INFO_ROW_COUNT_KEY = 0
-local IPROTO_FIELD_NAME_KEY = 0
 local IPROTO_DATA_KEY      = 0x30
 local IPROTO_ERROR_KEY     = 0x31
 local IPROTO_ERROR_STACK   = 0x52
@@ -155,7 +151,7 @@ local function next_id(id) return band(id + 1, 0x7FFFFFFF) end
 -- @retval two non-nils A connected socket and a decoded greeting.
 --
 local function establish_connection(host, port, timeout)
-    local timeout = timeout or DEFAULT_CONNECT_TIMEOUT
+    timeout = timeout or DEFAULT_CONNECT_TIMEOUT
     local begin = fiber.clock()
     local s = socket.tcp_connect(host, port, timeout)
     if not s then
@@ -425,7 +421,7 @@ local function create_transport(host, port, user, password, callback,
         state = new_state
         last_errno = new_errno
         last_error = new_error
-        callback('state_changed', new_state, new_errno, new_error)
+        callback('state_changed', new_state, new_error)
         state_cond:broadcast()
         if state == 'error' or state == 'error_reconnect' or
            state == 'closed' then
@@ -647,7 +643,7 @@ local function create_transport(host, port, user, password, callback,
 
     local function send_and_recv_iproto(timeout)
         local data_len = recv_buf.wpos - recv_buf.rpos
-        local required = 0
+        local required
         if data_len < 5 then
             required = 5
         else
@@ -711,7 +707,8 @@ local function create_transport(host, port, user, password, callback,
                      "please use require('console').connect() instead")
             local setup_delimiter = 'require("console").delimiter("$EOF$")\n'
             method_encoder.inject(send_buf, nil, setup_delimiter)
-            local err, response = send_and_recv_console()
+            local response
+            err, response = send_and_recv_console()
             if err then
                 return error_sm(err, response)
             elseif response ~= '---\n...\n' then
@@ -729,7 +726,6 @@ local function create_transport(host, port, user, password, callback,
     end
 
     console_sm = function(rid)
-        local delim = '\n...\n'
         local err, response = send_and_recv_console()
         if err then
             return error_sm(err, response)
@@ -803,8 +799,7 @@ local function create_transport(host, port, user, password, callback,
                 local status = hdr[IPROTO_STATUS_KEY]
                 local response_schema_version = hdr[IPROTO_SCHEMA_VERSION_KEY]
                 if status ~= 0 then
-                    local body
-                    body, body_end = decode(body_rpos)
+                    local body = decode(body_rpos)
                     return error_sm(E_NO_CONNECTION, body[IPROTO_ERROR_KEY])
                 end
                 if schema_version == nil then
@@ -813,8 +808,7 @@ local function create_transport(host, port, user, password, callback,
                     -- schema changed while fetching schema; restart loader
                     return iproto_schema_sm()
                 end
-                local body
-                body, body_end = decode(body_rpos)
+                local body = decode(body_rpos)
                 response[id] = body[IPROTO_DATA_KEY]
             end
         until response[select1_id] and response[select2_id] and
@@ -830,14 +824,11 @@ local function create_transport(host, port, user, password, callback,
         local err, hdr, body_rpos, body_end = send_and_recv_iproto()
         if err then return error_sm(err, hdr) end
         dispatch_response_iproto(hdr, body_rpos, body_end)
-        local status = hdr[IPROTO_STATUS_KEY]
         local response_schema_version = hdr[IPROTO_SCHEMA_VERSION_KEY]
         if response_schema_version > 0 and
            response_schema_version ~= schema_version then
             -- schema_version has been changed - start to load a new version.
             -- Sic: self.schema_version will be updated only after reload.
-            local body
-            body, body_end = decode(body_rpos)
             set_state('fetch_schema')
             return iproto_schema_sm(schema_version)
         end
@@ -954,7 +945,7 @@ local function new_sm(host, port, opts, connection, greeting)
     local remote = {host = host, port = port, opts = opts, state = 'initial'}
     local function callback(what, ...)
         if what == 'state_changed' then
-            local state, errno, err = ...
+            local state, err = ...
             local was_connected = remote._is_connected
             if state == 'active' then
                 if not was_connected then
@@ -1601,7 +1592,6 @@ this_module.self = {
             rollback()
             return box.error() -- re-throw
         end
-        local result
         if obj ~= nil then
             return handle_eval_result(pcall(proc, obj, unpack(args)))
         else
diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
index 85fcca562..de47b807e 100644
--- a/src/box/lua/schema.lua
+++ b/src/box/lua/schema.lua
@@ -2,7 +2,6 @@
 --
 local ffi = require('ffi')
 local msgpack = require('msgpack')
-local msgpackffi = require('msgpackffi')
 local fun = require('fun')
 local log = require('log')
 local fio = require('fio')
@@ -210,7 +209,7 @@ local function revoke_object_privs(object_type, object_id)
     local _vpriv = box.space[box.schema.VPRIV_ID]
     local _priv = box.space[box.schema.PRIV_ID]
     local privs = _vpriv.index.object:select{object_type, object_id}
-    for k, tuple in pairs(privs) do
+    for _, tuple in pairs(privs) do
         local uid = tuple.grantee
         _priv:delete{uid, object_type, object_id}
     end
@@ -274,7 +273,6 @@ local function check_param_table(table, template)
             local haystack = ',' .. good_types .. ','
             local needle = ',' .. param_type(v) .. ','
             if (string.find(haystack, needle) == nil) then
-                good_types = string.gsub(good_types, ',', ', ')
                 box.error(box.error.ILLEGAL_PARAMS,
                           "options parameter '" .. k ..
                           "' should be one of types: " .. template[k])
@@ -582,9 +580,9 @@ end
 --
 local function format_field_resolve(format, path, what)
     assert(type(path) == 'number' or type(path) == 'string')
-    local idx = nil
+    local idx
     local relative_path = nil
-    local field_name = nil
+    local field_name
     -- Path doesn't require resolve.
     if type(path) == 'number' then
         idx = path
@@ -844,7 +842,7 @@ local function space_sequence_alter_prepare(format, parts, options,
             if id == nil then
                 box.error(box.error.NO_SUCH_SEQUENCE, new_sequence.id)
             end
-            local tuple = _space_sequence.index.sequence:select(id)[1]
+            tuple = _space_sequence.index.sequence:select(id)[1]
             if tuple ~= nil and tuple.is_generated then
                 box.error(box.error.ALTER_SPACE, space_name,
                           "can not attach generated sequence")
@@ -1144,7 +1142,7 @@ box.schema.index.alter = function(space_id, index_id, options)
         local can_update_field = {id = true, name = true, type = true }
         local can_update = true
         local cant_update_fields = ''
-        for k,v in pairs(options) do
+        for k, _ in pairs(options) do
             if not can_update_field[k] then
                 can_update = false
                 cant_update_fields = cant_update_fields .. ' ' .. k
@@ -1188,7 +1186,7 @@ box.schema.index.alter = function(space_id, index_id, options)
     if options.type == nil then
         options.type = tuple.type
     end
-    for k, t in pairs(index_options) do
+    for k, _ in pairs(index_options) do
         if options[k] ~= nil then
             index_opts[k] = options[k]
         end
@@ -1281,7 +1279,6 @@ end
 
 -- global struct port instance to use by select()/get()
 local port_tuple = ffi.new('struct port_tuple')
-local port_tuple_entry_t = ffi.typeof('struct port_tuple_entry')
 
 -- Helper function to check space:method() usage
 local function check_space_arg(space, method)
@@ -1499,7 +1496,8 @@ end
 
 base_index_mt.get_ffi = function(index, key)
     check_index_arg(index, 'get')
-    local key, key_end = tuple_encode(key)
+    local key_end
+    key, key_end = tuple_encode(key)
     if builtin.box_index_get(index.space_id, index.id,
                              key, key_end, ptuple) ~= 0 then
         return box.error() -- error
@@ -1532,7 +1530,8 @@ end
 
 base_index_mt.select_ffi = function(index, key, opts)
     check_index_arg(index, 'select')
-    local key, key_end = tuple_encode(key)
+    local key_end
+    key, key_end = tuple_encode(key)
     local iterator, offset, limit = check_select_opts(opts, key + 1 >= key_end)
 
     local port = ffi.cast('struct port *', port_tuple)
@@ -1554,7 +1553,7 @@ end
 
 base_index_mt.select_luac = function(index, key, opts)
     check_index_arg(index, 'select')
-    local key = keify(key)
+    key = keify(key)
     local iterator, offset, limit = check_select_opts(opts, #key == 0)
     return internal.select(index.space_id, index.id, iterator,
         offset, limit, key)
@@ -2489,20 +2488,20 @@ local function drop(uid, opts)
     -- recursive delete of user data
     local _vpriv = box.space[box.schema.VPRIV_ID]
     local spaces = box.space[box.schema.VSPACE_ID].index.owner:select{uid}
-    for k, tuple in pairs(spaces) do
+    for _, tuple in pairs(spaces) do
         box.space[tuple.id]:drop()
     end
     local funcs = box.space[box.schema.VFUNC_ID].index.owner:select{uid}
-    for k, tuple in pairs(funcs) do
+    for _, tuple in pairs(funcs) do
         box.schema.func.drop(tuple.id)
     end
     -- if this is a role, revoke this role from whoever it was granted to
     local grants = _vpriv.index.object:select{'role', uid}
-    for k, tuple in pairs(grants) do
+    for _, tuple in pairs(grants) do
         revoke(tuple.grantee, tuple.grantee, uid)
     end
     local sequences = box.space[box.schema.VSEQUENCE_ID].index.owner:select{uid}
-    for k, tuple in pairs(sequences) do
+    for _, tuple in pairs(sequences) do
         box.schema.sequence.drop(tuple.id)
     end
     -- xxx: hack, we have to revoke session and usage privileges
@@ -2514,7 +2513,7 @@ local function drop(uid, opts)
     end
     local privs = _vpriv.index.primary:select{uid}
 
-    for k, tuple in pairs(privs) do
+    for _, tuple in pairs(privs) do
         -- we need an additional box.session.su() here, because of
         -- unnecessary check for privilege PRIV_REVOKE in priv_def_check()
         box.session.su("admin", revoke, uid, uid, tuple.privilege,
@@ -2680,7 +2679,7 @@ box.once = function(key, func, ...)
         box.error(box.error.ILLEGAL_PARAMS, "Usage: box.once(key, func, ...)")
     end
 
-    local key = "once"..key
+    key = "once"..key
     if box.space._schema:get{key} ~= nil then
         return
     end
diff --git a/src/box/lua/tuple.lua b/src/box/lua/tuple.lua
index f97aa1579..1b958425f 100644
--- a/src/box/lua/tuple.lua
+++ b/src/box/lua/tuple.lua
@@ -1,7 +1,6 @@
 -- tuple.lua (internal file)
 
 local ffi = require('ffi')
-local yaml = require('yaml')
 local msgpackffi = require('msgpackffi')
 local fun = require('fun')
 local buffer = require('buffer')
@@ -81,7 +80,6 @@ local tuple_encode = function(obj)
         encode_r(tmpbuf, obj, 1)
     elseif type(obj) == "table" then
         encode_array(tmpbuf, #obj)
-        local i
         for i = 1, #obj, 1 do
             encode_r(tmpbuf, obj[i], 1)
         end
@@ -232,7 +230,7 @@ local function tuple_update(tuple, expr)
         error("Usage: tuple:update({ { op, field, arg}+ })")
     end
     local pexpr, pexpr_end = tuple_encode(expr)
-    local tuple = builtin.box_tuple_update(tuple, pexpr, pexpr_end)
+    tuple = builtin.box_tuple_update(tuple, pexpr, pexpr_end)
     if tuple == nil then
         return box.error()
     end
@@ -245,7 +243,7 @@ local function tuple_upsert(tuple, expr)
         error("Usage: tuple:upsert({ { op, field, arg}+ })")
     end
     local pexpr, pexpr_end = tuple_encode(expr)
-    local tuple = builtin.box_tuple_upsert(tuple, pexpr, pexpr_end)
+    tuple = builtin.box_tuple_upsert(tuple, pexpr, pexpr_end)
     if tuple == nil then
         return box.error()
     end
@@ -339,7 +337,7 @@ ffi.metatype(tuple_t, {
 
 ffi.metatype(tuple_iterator_t, {
     __call = tuple_iterator_next;
-    __tostring = function(it) return "<tuple iterator>" end;
+    __tostring = function() return "<tuple iterator>" end;
 })
 
 -- Free methods, which are not needed anymore.
diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua
index 075cc236e..208b53f15 100644
--- a/src/box/lua/upgrade.lua
+++ b/src/box/lua/upgrade.lua
@@ -52,10 +52,9 @@ end
 local function truncate(space)
     local pk = space.index[0]
     while pk:len() > 0 do
-        local state, t
-        for state, t in pk:pairs() do
+        for _, t in pk:pairs() do
             local key = {}
-            for _k2, parts in ipairs(pk.parts) do
+            for _, parts in ipairs(pk.parts) do
                 table.insert(key, t[parts.fieldno])
             end
             space:delete(key)
@@ -173,7 +172,7 @@ local function initial_1_7_5()
     format[5] = {name='field_count', type='unsigned'}
     format[6] = {name='flags', type='map'}
     format[7] = {name='format', type='array'}
-    local def = _space:insert{_space.id, ADMIN, '_space', 'memtx', 0, MAP, format}
+    _space:insert{_space.id, ADMIN, '_space', 'memtx', 0, MAP, format}
     -- space name is unique
     log.info("create index primary on _space")
     _index:insert{_space.id, 0, 'primary', 'tree', { unique = true }, {{0, 'unsigned'}}}
@@ -194,7 +193,7 @@ local function initial_1_7_5()
     format[4] = {name = 'type', type = 'string'}
     format[5] = {name = 'opts', type = 'map'}
     format[6] = {name = 'parts', type = 'array'}
-    def = _space:insert{_index.id, ADMIN, '_index', 'memtx', 0, MAP, format}
+    _space:insert{_index.id, ADMIN, '_index', 'memtx', 0, MAP, format}
     -- index name is unique within a space
     log.info("create index primary on _index")
     _index:insert{_index.id, 0, 'primary', 'tree', {unique = true}, {{0, 'unsigned'}, {1, 'unsigned'}}}
@@ -211,7 +210,7 @@ local function initial_1_7_5()
     format[2] = {name='owner', type='unsigned'}
     format[3] = {name='name', type='string'}
     format[4] = {name='setuid', type='unsigned'}
-    def = _space:insert{_func.id, ADMIN, '_func', 'memtx', 0, MAP, format}
+    _space:insert{_func.id, ADMIN, '_func', 'memtx', 0, MAP, format}
     -- function name and id are unique
     log.info("create index _func:primary")
     _index:insert{_func.id, 0, 'primary', 'tree', {unique = true}, {{0, 'unsigned'}}}
@@ -231,7 +230,7 @@ local function initial_1_7_5()
     format[3] = {name='name', type='string'}
     format[4] = {name='type', type='string'}
     format[5] = {name='auth', type='map'}
-    def = _space:insert{_user.id, ADMIN, '_user', 'memtx', 0, MAP, format}
+    _space:insert{_user.id, ADMIN, '_user', 'memtx', 0, MAP, format}
     -- user name and id are unique
     log.info("create index _func:primary")
     _index:insert{_user.id, 0, 'primary', 'tree', {unique = true}, {{0, 'unsigned'}}}
@@ -251,7 +250,7 @@ local function initial_1_7_5()
     format[3] = {name='object_type', type='string'}
     format[4] = {name='object_id', type='unsigned'}
     format[5] = {name='privilege', type='unsigned'}
-    def = _space:insert{_priv.id, ADMIN, '_priv', 'memtx', 0, MAP, format}
+    _space:insert{_priv.id, ADMIN, '_priv', 'memtx', 0, MAP, format}
     -- user id, object type and object id are unique
     log.info("create index primary on _priv")
     _index:insert{_priv.id, 0, 'primary', 'tree', {unique = true}, {{1, 'unsigned'}, {2, 'string'}, {3, 'unsigned'}}}
@@ -580,7 +579,7 @@ local function upgrade_to_2_1_0()
     -- Now, abscent field means NULL, so we can safely set second
     -- field in format, marking it nullable.
     log.info("Add nullable value field to space _schema")
-    local format = {}
+    format = {}
     format[1] = {type='string', name='key'}
     format[2] = {type='any', name='value', is_nullable=true}
     box.space._schema:format(format)
@@ -734,7 +733,7 @@ local function upgrade_collation_to_2_1_3()
 
     local id = 4
     for _, collation in ipairs(coll_lst) do
-        for i, strength in ipairs(coll_strengths) do
+        for _, strength in ipairs(coll_strengths) do
             local coll_name = 'unicode_' .. collation.name .. "_" .. strength.s
             log.info("creating collation %s", coll_name)
             box.space._collation:replace{id, coll_name, ADMIN, "ICU", collation.loc_str, strength.opt }
-- 
2.23.0

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

* [Tarantool-patches] [PATCH v4 6/10] Fix luacheck warnings in test/
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
                   ` (4 preceding siblings ...)
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/ sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-27 14:38   ` Igor Munkin
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 7/10] schema: fix index promotion to functional index sergeyb
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #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                                   |  34 ++++++
 test/app-tap/cfg.test.lua                     |   2 +-
 test/app-tap/clock.test.lua                   |   4 +-
 test/app-tap/console.test.lua                 |  15 +--
 test/app-tap/console_lua.test.lua             |  22 ++--
 test/app-tap/csv.test.lua                     |  56 ++++-----
 test/app-tap/debug.test.lua                   |  10 +-
 test/app-tap/errno.test.lua                   |   6 +-
 test/app-tap/fail_main.test.lua               |   6 +-
 .../gh-4761-json-per-call-options.test.lua    |  11 +-
 test/app-tap/http_client.test.lua             |  54 ++++-----
 test/app-tap/iconv.test.lua                   |   6 +-
 test/app-tap/init_script.test.lua             |  14 +--
 test/app-tap/inspector.test.lua               |   6 +-
 test/app-tap/json.test.lua                    |   1 -
 test/app-tap/logger.test.lua                  |  23 ++--
 test/app-tap/minimal.test.lua                 |   4 +-
 test/app-tap/module_api.test.lua              |  11 +-
 test/app-tap/msgpackffi.test.lua              |   3 +-
 test/app-tap/pcall.test.lua                   |   6 +-
 test/app-tap/snapshot.test.lua                |  17 ++-
 test/app-tap/string.test.lua                  |  54 ++++-----
 test/app-tap/tap.test.lua                     |  26 ++--
 test/app-tap/tarantoolctl.test.lua            |  76 ++++++------
 test/app-tap/trigger.test.lua                 |  20 ++--
 test/app-tap/yaml.test.lua                    |  16 +--
 test/box-py/box.lua                           |   2 +-
 test/box-tap/auth.test.lua                    |  36 +++---
 test/box-tap/cfg.test.lua                     |  34 +++---
 test/box-tap/cfgup.test.lua                   |   2 +-
 test/box-tap/feedback_daemon.test.lua         |   4 +-
 test/box-tap/gc.test.lua                      |   6 +-
 test/box-tap/key_def.test.lua                 |  58 ++++-----
 test/box-tap/merger.test.lua                  | 112 +++++++++---------
 test/box-tap/on_schema_init.test.lua          |   4 +-
 test/box-tap/schema_mt.test.lua               |  18 +--
 test/box-tap/session.storage.test.lua         |  10 +-
 test/box-tap/session.test.lua                 |  59 ++++-----
 test/box-tap/trigger_atexit.test.lua          |  10 +-
 test/box-tap/trigger_yield.test.lua           |  10 +-
 test/box/box.lua                              |   2 +-
 test/box/hash_multipart.result                |   2 +-
 test/box/hash_multipart.test.lua              |   2 +-
 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                    |   4 +-
 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/require_init.lua                 |   3 -
 test/box/lua/test_init.lua                    |  10 +-
 test/box/lua/utils.lua                        |  13 +-
 test/box/on_schema_init.lua                   |   2 +-
 test/box/proxy.lua                            |   2 +-
 test/box/tiny.lua                             |   2 +-
 test/box/tree_pk.result                       |   4 +-
 test/box/tree_pk.test.lua                     |   4 +-
 test/engine/tree_min_max_count.result         |   2 +-
 test/engine/tree_min_max_count.test.lua       |   2 +-
 test/engine_long/suite.lua                    |   4 +-
 test/long_run-py/lua/finalizers.lua           |   8 +-
 test/long_run-py/suite.lua                    |   6 +-
 test/replication-py/master.lua                |   2 +-
 test/replication-py/panic.lua                 |   2 +-
 test/replication-py/replica.lua               |   4 -
 test/replication/lua/fast_replica.lua         |   3 +-
 test/replication/lua/rlimit.lua               |   2 +-
 test/replication/master.lua                   |   2 +-
 test/replication/replicaset_ro_mostly.result  |   2 +-
 .../replication/replicaset_ro_mostly.test.lua |   2 +-
 test/sql-tap/alter.test.lua                   |   4 +-
 test/sql-tap/analyze3.test.lua                |   6 +-
 test/sql-tap/analyze5.test.lua                |   2 +-
 test/sql-tap/analyze9.test.lua                |  30 ++---
 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                  |  22 ++--
 test/sql-tap/func.test.lua                    |   2 +-
 test/sql-tap/func3.test.lua                   |  24 ++--
 test/sql-tap/gh-2723-concurrency.test.lua     |   8 +-
 .../gh-3083-ephemeral-unref-tuples.test.lua   |   2 +-
 .../gh-3307-xfer-optimization-issue.test.lua  |  16 +--
 .../gh-3332-tuple-format-leak.test.lua        |   2 +-
 .../gh-4077-iproto-execute-no-bind.test.lua   |   7 +-
 .../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                |  28 ++---
 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/tkt-fa7bf5ec.test.lua            |   6 +-
 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/sql/savepoints.result                    |   6 +-
 test/sql/savepoints.test.lua                  |   6 +-
 test/sql/triggers.result                      |   2 +-
 test/sql/triggers.test.lua                    |   2 +-
 test/vinyl/large.lua                          |   3 +-
 test/vinyl/txn_proxy.lua                      |   6 +-
 test/vinyl/upgrade/fill.lua                   |   8 +-
 test/vinyl/vinyl.lua                          |   2 +-
 test/wal_off/rtree_benchmark.result           |   2 +-
 test/wal_off/rtree_benchmark.test.lua         |   2 +-
 test/xlog-py/box.lua                          |   2 +-
 test/xlog/panic.lua                           |   2 +-
 test/xlog/reader.result                       |   2 +-
 test/xlog/reader.test.lua                     |   2 +-
 test/xlog/snap_io_rate.test.lua               |   2 +-
 test/xlog/transaction.result                  |   2 +-
 test/xlog/transaction.test.lua                |   2 +-
 .../2.1.3/gh-4771-upgrade-sequence/fill.lua   |  12 +-
 test/xlog/xlog.lua                            |   2 +-
 157 files changed, 704 insertions(+), 740 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 64692b27c..cec1f4ffe 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -37,3 +37,37 @@ files["src/box/lua/console.lua"] = {ignore = {"212"}}
 files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
 files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
 files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
+files["test/app/lua/fiber.lua"] = {globals = {"box_fiber_run_test"}}
+files["test/app-tap/console.test.lua"] = {globals = {"long_func"}}
+files["test/app-tap/lua/require_mod.lua"] = {globals = {"exports"}}
+files["test/app-tap/module_api.test.lua"] = {ignore = {"311"}}
+files["test/app-tap/string.test.lua"] = {globals = {"utf8"}}
+files["test/app-tap/tarantoolctl.test.lua"] = {ignore = {"113", "421"}}
+files["test/box-tap/session.test.lua"] = {
+	globals = {"active_connections", "session", "space", "f1", "f2"},
+	ignore = {"211"}
+}
+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 = {"space_field_types", "iterate", "arithmetic", "table_shuffle",
+	"table_generate", "tuple_to_string", "check_space", "space_bsize",
+	"create_iterator", "setmap", "sort"}}
+files["test/box/lua/bitset.lua"] = {
+	globals = {"create_space", "fill", "delete", "clear", "drop_space",
+	"dump", "test_insert_delete"}
+}
+files["test/box/lua/fifo.lua"] = {globals = {"fifomax", "find_or_create_fifo", "fifo_push", "fifo_top"}}
+files["test/box/lua/identifier.lua"] = {globals = {"run_test"}}
+files["test/box/lua/require_mod.lua"] = {globals = {"exports"}}
+files["test/luajit-tap/gh-4476-fix-string-find-recording.test.lua"] = {ignore = {"231"}}
+files["test/luajit-tap/or-232-unsink-64-kptr.test.lua"] = {ignore = {"542"}}
+files["test/replication/lua/fast_replica.lua"] = {
+	globals = {"join", "start_all", "stop_all", "wait_all",
+	"drop_all", "drop_all", "vclock_diff", "unregister",
+	"delete", "start", "stop", "call_all", "drop", "wait"},
+	ignore = {"212", "213"}
+}
+files["test/sql-tap/*.lua"] = {ignore = {"611", "612", "613", "614", "621", "631", "211", "113", "111"}}
+files["test/sql-tap/lua/sqltester.lua"] = {globals = {"table_match_regex_p"}}
+files["test/sql-tap/e_expr.test.lua"] = {ignore = {"512"}}
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 4feadfa5e..e81b48a80 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(80)
 
@@ -59,7 +59,7 @@ test:is(client:read(";"), 'true;', "pushed message")
 client:write('\\set output lua\n')
 client:read(";")
 
-long_func_f = nil
+local long_func_f
 function long_func()
     long_func_f = fiber.self()
     box.session.push('push')
@@ -95,12 +95,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")
@@ -233,13 +230,13 @@ 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)
+s = console.listen('console://unix/:'..CONSOLE_SOCKET)
 addr = s:name()
 test:is(addr.family, 'AF_UNIX', 'console.listen uri support')
 test:is(addr.host, 'unix/', 'console.listen uri support')
@@ -279,7 +276,7 @@ box.session.on_disconnect(console_on_disconnect)
 box.session.on_auth(console_on_auth)
 
 -- check on_connect/on_disconnect/on_auth triggers
-local server = console.listen('console://unix/:'..CONSOLE_SOCKET)
+server = console.listen('console://unix/:'..CONSOLE_SOCKET)
 client = socket.tcp_connect("unix/", CONSOLE_SOCKET)
 _ = client:read(128)
 client:write("1\n")
diff --git a/test/app-tap/console_lua.test.lua b/test/app-tap/console_lua.test.lua
index 3ed6aad97..263e86c54 100755
--- a/test/app-tap/console_lua.test.lua
+++ b/test/app-tap/console_lua.test.lua
@@ -13,7 +13,7 @@ local CONSOLE_SOCKET = 'console-lua.sock'
 --
 -- Set Lua output mode.
 local function set_lua_output(client, opts)
-    local opts = opts or {}
+    opts = opts or {}
     local mode = opts.block and 'lua,block' or 'lua'
     client:write(('\\set output %s\n'):format(mode))
     assert(client:read(EOL), 'true' .. EOL, 'set lua output mode')
@@ -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(test_obj, client, statements, name)
+    test_obj:test(name, function(test)
         test:plan(2 * #statements)
 
         for _, stmt in ipairs(statements) do
@@ -75,15 +75,15 @@ 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(test_obj, client, input, exp_output, name)
+    test_obj:test(name, function(test)
         test:plan(2)
 
         local res = client:write(input .. '\n')
         test:ok(res ~= nil, ('-> [[%s]]'):format(input))
 
         local exp = exp_output .. EOL
-        local res = client:read(EOL)
+        res = client:read(EOL)
         test:is(res, exp, ('<- [[%s]]'):format(exp:gsub('\n', '\\n')))
     end)
 end
@@ -134,15 +134,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..4a13edf2a 100755
--- a/test/app-tap/errno.test.lua
+++ b/test/app-tap/errno.test.lua
@@ -3,10 +3,10 @@
 local tap = require('tap')
 local errno = require('errno')
 
-local test = tap.test("errno")
+local suite = tap.test("errno")
 
-test:plan(1)
-test:test("primary", function(test)
+suite:plan(1)
+suite:test("primary", function(test)
     test:plan(10)
     test:is(type(errno), "table", "type of table")
     test:ok(errno.EINVAL ~= nil, "errno.EINVAL is available")
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..a8c02dd2f 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..1c5bf853b 100755
--- a/test/app-tap/http_client.test.lua
+++ b/test/app-tap/http_client.test.lua
@@ -3,13 +3,13 @@
 local tap = require('tap')
 local client = require('http.client')
 local json = require('json')
-local test = tap.test("curl")
+local suite = tap.test("curl")
 local fiber = require('fiber')
 local socketlib = require('socket')
 local os = require('os')
 
 local TARANTOOL_SRC_DIR = os.getenv("TARANTOOL_SRC_DIR") or "../.."
-test:diag("TARANTOOL_SRC_DIR=%s", TARANTOOL_SRC_DIR)
+suite:diag("TARANTOOL_SRC_DIR=%s", TARANTOOL_SRC_DIR)
 
 local function merge(...)
     local res = {}
@@ -42,7 +42,7 @@ local function start_server(test, sock_family, sock_addr)
     test:is(server:read("*l"), "heartbeat", "server started")
     test:diag("trying to connect to %s", url)
     local r
-    for i=1,10 do
+    for _=1,10 do
         r = client.get(url, merge(opts, {timeout = 0.01}))
         if r.status == 200 then
             break
@@ -82,7 +82,7 @@ local function test_http_client(test, url, opts)
         "content-length > 0")
     test:is(client.get("http://localhost:1/").status, 595, 'cannot connect')
 
-    local r = client.request('GET', url, nil, opts)
+    r = client.request('GET', url, nil, opts)
     test:is(r.status, 200, 'request')
 
     -- XXX: enable after resolving of gh-4180: httpc: redirects
@@ -120,7 +120,7 @@ end
 --
 local function test_http_client_headers_redefine(test, url, opts)
     test:plan(9)
-    local opts = table.deepcopy(opts)
+    opts = table.deepcopy(opts)
     -- Test defaults
     opts.headers = {['Connection'] = nil, ['Accept'] = nil}
     local r = client.post(url, nil, opts)
@@ -132,7 +132,7 @@ local function test_http_client_headers_redefine(test, url, opts)
     opts.headers={['Connection'] = 'close'}
     opts.keepalive_idle = 2
     opts.keepalive_interval = 1
-    local r = client.get(url, opts)
+    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',
@@ -140,7 +140,7 @@ local function test_http_client_headers_redefine(test, url, opts)
     -- Test that user-defined Connection and Acept headers
     -- are used
     opts.headers={['Connection'] = 'Keep-Alive', ['Accept'] = 'text/html'}
-    local r = client.get(url, opts)
+    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')
@@ -164,7 +164,7 @@ local function test_cancel_and_errinj(test, url, opts)
     local errinj = box.error.injection
     errinj.set('ERRINJ_HTTP_RESPONSE_ADD_WAIT', true)
     local topts = merge(opts, {timeout = 1200})
-    f = fiber.create(func, topts)
+    fiber.create(func, topts)
     r = ch:get()
     test:is(r.status, 200, "No hangs in errinj")
     errinj.set('ERRINJ_HTTP_RESPONSE_ADD_WAIT', false)
@@ -180,7 +180,6 @@ local function test_post_and_get(test, url, opts)
     local my_body = { key = "value" }
     local json_body = json.encode(my_body)
     local responses = {}
-    local data = {a = 'b'}
     headers['Content-Type'] = 'application/json'
     local fibers = 7
     local ch = fiber.channel(fibers)
@@ -213,7 +212,7 @@ local function test_post_and_get(test, url, opts)
         responses.absent_get = http:get(url .. 'absent', opts)
         ch:put(1)
     end)
-    for i=1,fibers do
+    for _=1,fibers do
         ch:get()
     end
     local r = responses.good_get
@@ -270,7 +269,7 @@ local function test_errors(test)
     test:ok(not status and string.find(json.encode(err),
                         "Unsupported protocol"),
                         "POST: exception on bad protocol")
-    local r = http:get("http://do_not_exist_8ffad33e0cb01e6a01a03d00089e71e5b2b7e9930dfcba.ru")
+    http:get("http://do_not_exist_8ffad33e0cb01e6a01a03d00089e71e5b2b7e9930dfcba.ru")
 end
 
 -- gh-3679 Check that opts.headers values can be strings only.
@@ -355,7 +354,7 @@ local function test_request_headers(test, url, opts)
     local http = client:new()
 
     for _, case in ipairs(cases) do
-        local opts = merge(table.copy(opts), case.opts)
+        opts = merge(table.copy(opts), case.opts)
         local ok, err = pcall(http.get, http, url, opts)
         if case.postrequest_check ~= nil then
             case.postrequest_check(opts)
@@ -395,7 +394,7 @@ local function test_headers(test, url, opts)
     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")
     opts["max_header_name_length"] = 64
-    local r = http:get(url .. 'headers', opts)
+    r = http:get(url .. 'headers', opts)
     test:is(r.headers["very_very_very_long_headers_name1"], "true", "truncated max_header_name_length")
     opts["max_header_name_length"] = nil
 
@@ -406,13 +405,13 @@ 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}))
+    r = http:post(url, nil, merge(opts, {headers = headers}))
     test: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},
@@ -425,7 +424,6 @@ local function test_special_methods(test, url, opts)
     local responses = {}
     local fibers = 7
     local ch = fiber.channel(fibers)
-    local _
     fiber.create(function()
         responses.patch_data = http:patch(url, "{\"key\":\"val\"}", opts)
         ch:put(1)
@@ -454,7 +452,7 @@ local function test_special_methods(test, url, opts)
         responses.custom_data = http:request("CUSTOM", url, nil, opts)
         ch:put(1)
     end)
-    for i = 1, fibers do
+    for _ = 1, fibers do
         ch:get()
     end
 
@@ -483,10 +481,6 @@ end
 
 local function test_concurrent(test, url, opts)
     test:plan(3)
-    local http = client.new()
-    local headers = { my_header = "1", my_header2 = "2" }
-    local my_body = { key = "value" }
-    local json_body = json.encode(my_body)
     local num_test = 10
     local num_load = 10
     local curls   = { }
@@ -497,7 +491,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 +509,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 +534,11 @@ local function test_concurrent(test, url, opts)
     end
     local ok_sockets_added = true
     local ok_active = true
-    local ok_timeout = true
     local ok_req = true
 
     -- Join test
     local rest = num_test
     while true do
-        local ticks = 0
         for i = 1, num_load do
             local obj = curls[i]
             -- checking that stats in concurrent are ok
@@ -582,7 +574,7 @@ local function test_concurrent(test, url, opts)
     test:ok(ok_active, "no active requests")
 end
 
-function run_tests(test, sock_family, sock_addr)
+local function run_tests(test, sock_family, sock_addr)
     test:plan(11)
     local server, url, opts = start_server(test, sock_family, sock_addr)
     test:test("http.client", test_http_client, url, opts)
@@ -611,9 +603,9 @@ function run_tests(test, sock_family, sock_addr)
     stop_server(test, server)
 end
 
-test:plan(2)
+suite:plan(2)
 
-test:test("http over AF_INET", function(test)
+suite:test("http over AF_INET", function(test)
     local s = socketlib('AF_INET', 'SOCK_STREAM', 0)
     s:bind('127.0.0.1', 0)
     local host = s:name().host
@@ -622,7 +614,7 @@ test:test("http over AF_INET", function(test)
     run_tests(test, 'AF_INET', string.format("%s:%d", host, port))
 end)
 
-test:test("http over AF_UNIX", function(test)
+suite:test("http over AF_UNIX", function(test)
     local path = os.tmpname()
     os.remove(path)
     local status = pcall(client.get, 'http://localhost/', {unix_socket = path})
@@ -634,4 +626,4 @@ test:test("http over AF_UNIX", function(test)
     os.remove(path)
 end)
 
-os.exit(test:check() == true and 0 or -1)
+os.exit(suite:check() == true and 0 or -1)
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 155f149a7..5831ffa77 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
@@ -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..3f2d3fab9 100755
--- a/test/app-tap/inspector.test.lua
+++ b/test/app-tap/inspector.test.lua
@@ -1,9 +1,7 @@
 #!/usr/bin/env tarantool
 
-local socket = require('socket')
-
-test_run = require('test_run')
-inspector = test_run.new()
+local test_run = require('test_run')
+local inspector = 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 492d5ea0b..56db1d2c7 100755
--- a/test/app-tap/logger.test.lua
+++ b/test/app-tap/logger.test.lua
@@ -26,7 +26,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
@@ -45,7 +45,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")
@@ -56,34 +56,34 @@ file:close()
 
 test:ok(log.pid() >= 0, "pid()")
 
--- logger uses 'debug', try to set it to nil
-debug = nil
+-- luacheck: ignore (logger uses 'debug', try to set it to nil)
+local 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")
@@ -91,7 +91,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")
 
@@ -101,13 +101,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()
@@ -120,7 +121,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/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..e0f2bf75f 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
     })
@@ -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,8 @@ local test = require('tap').test("module_api", function(test)
         end
     end
 
-    local status, msg = pcall(module.check_error)
+    local msg
+    status, 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/snapshot.test.lua b/test/app-tap/snapshot.test.lua
index 587f8279b..bd5270702 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..bf1be5c9e 100755
--- a/test/app-tap/string.test.lua
+++ b/test/app-tap/string.test.lua
@@ -1,11 +1,11 @@
 #!/usr/bin/env tarantool
 
 local tap = require('tap')
-local test = tap.test("string extensions")
+local suite = tap.test("string extensions")
 
-test:plan(7)
+suite:plan(7)
 
-test:test("split", function(test)
+suite:test("split", function(test)
     test:plan(10)
 
     -- testing basic split (works over gsplit)
@@ -46,7 +46,7 @@ test:test("split", function(test)
 end)
 
 -- gh-2214 - string.ljust()/string.rjust() Lua API
-test:test("ljust/rjust/center", function(test)
+suite:test("ljust/rjust/center", function(test)
     test:plan(18)
 
     test:is(("help"):ljust(0),  "help", "ljust, length 0, do nothing")
@@ -78,7 +78,7 @@ test:test("ljust/rjust/center", function(test)
 end)
 
 -- gh-2215 - string.startswith()/string.endswith() Lua API
-test:test("startswith/endswith", function(test)
+suite:test("startswith/endswith", function(test)
     test:plan(21)
 
     test:ok((""):startswith(""),      "empty+empty startswith")
@@ -108,13 +108,13 @@ test:test("startswith/endswith", function(test)
     test:ok(err and err:match("%(string expected, got table%)"), "wrong params")
 end)
 
-test:test("hex", function(test)
+suite:test("hex", function(test)
     test:plan(2)
     test:is(string.hex("hello"), "68656c6c6f", "hex non-empty string")
     test:is(string.hex(""), "", "hex empty string")
 end)
 
-test:test("fromhex", function(test)
+suite: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")
@@ -127,13 +127,13 @@ test:test("fromhex", function(test)
     local _, err = pcall(string.fromhex, "aaa")
     test:ok(err and err:match("(even amount of chars expected," ..
                               " got odd amount)"))
-    local _, err = pcall(string.fromhex, "qq")
+    _, err = pcall(string.fromhex, "qq")
     test:ok(err and err:match("(hex string expected, got non hex chars)"))
-    local _, err = pcall(string.fromhex, 795)
+    _, err = pcall(string.fromhex, 795)
     test:ok(err and err:match("(string expected, got number)"))
 end)
 
-test:test("strip", function(test)
+suite:test("strip", function(test)
     test:plan(45)
     local str = "  Hello world! "
     test:is(string.strip(str), "Hello world!", "strip (without chars)")
@@ -205,7 +205,7 @@ test:test("strip", function(test)
     test:ok(err and err:match("#2 to '.-%.rstrip' %(string expected, got number%)"), "rstrip err 2")
 end)
 
-test:test("unicode", function(test)
+suite:test("unicode", function(test)
     test:plan(104)
     local str = 'хеЛлоу вОрЛд ё Ё я Я э Э ъ Ъ hElLo WorLd 1234 i I İ 勺#☢༺'
     local upper_res = 'ХЕЛЛОУ ВОРЛД Ё Ё Я Я Э Э Ъ Ъ HELLO WORLD 1234 I I İ 勺#☢༺'
@@ -216,10 +216,10 @@ test:test("unicode", function(test)
     test:is(s, lower_res, 'default locale lower')
     test:is(utf8.upper(''), '', 'empty string upper')
     test:is(utf8.lower(''), '', 'empty string lower')
-    local err
-    s, err = pcall(utf8.upper, true)
+    local err, _
+    _, err = pcall(utf8.upper, true)
     test:isnt(err:find('Usage'), nil, 'upper usage is checked')
-    s, err = pcall(utf8.lower, true)
+    _, err = pcall(utf8.lower, true)
     test:isnt(err:find('Usage'), nil, 'lower usage is checked')
 
     test:is(utf8.isupper('a'), false, 'isupper("a")')
@@ -247,9 +247,9 @@ test:test("unicode", function(test)
     test:isnil(c, 'middle of symbol offset is error')
     test:is(err, 4, 'error on 4 byte')
     test:is(utf8.len(s, 5), 4, 'start 5')
-    c, err = utf8.len(s, 6)
+    _, err = utf8.len(s, 6)
     test:is(err, 6, 'error on 6 byte')
-    c, err = utf8.len(s, 0)
+    _, err = utf8.len(s, 0)
     test:is(err, 'position is out of string', 'range is out of string')
     test:is(utf8.len(s, #s), 1, 'start from the end')
     test:is(utf8.len(s, #s + 1), 0, 'position is out of string')
@@ -262,14 +262,14 @@ test:test("unicode", function(test)
     test:is(utf8.len(s, 1, -7), 4, 'end -7')
     test:is(utf8.len(s, 2, -7), 3, '[2, -7]')
     test:is(utf8.len(s, 3, -7), 2, '[3, -7]')
-    c, err = utf8.len(s, 4, -7)
+    _, err = utf8.len(s, 4, -7)
     test:is(err, 4, '[4, -7] is error - start from the middle of symbol')
     test:is(utf8.len(s, 10, -100), 0, 'it is ok to be out of str by end pos')
     test:is(utf8.len(s, 10, -10), 0, 'it is ok to swap end and start pos')
     test:is(utf8.len(''), 0, 'empty len')
     test:is(utf8.len(s, -6, -1), 3, 'pass both negative offsets')
     test:is(utf8.len(s, 3, 3), 1, "end in the middle on the same symbol as start")
-    c, err = utf8.len('a\xF4')
+    _, err = utf8.len('a\xF4')
     test:is(err, 2, "invalid unicode in the middle of the string")
 
     local chars = {}
@@ -279,11 +279,11 @@ test:test("unicode", function(test)
         table.insert(codes, code)
     end
     test:is(table.concat(chars), s, "next and char works")
-    c, err = pcall(utf8.char, 'kek')
+    _, err = pcall(utf8.char, 'kek')
     test:isnt(err:find('bad argument'), nil, 'char usage is checked')
-    c, err = pcall(utf8.next, true)
+    _, err = pcall(utf8.next, true)
     test:isnt(err:find('Usage'), nil, 'next usage is checked')
-    c, err = pcall(utf8.next, '1234', true)
+    _, err = pcall(utf8.next, '1234', true)
     test:isnt(err:find('bad argument'), nil, 'next usage is checked')
     local offset
     offset, c = utf8.next('')
@@ -338,15 +338,15 @@ test:test("unicode", function(test)
     test:is(utf8.sub(s, -2, 2), '', 'sub [-2:2]')
     test:is(utf8.sub(s, -1, 8), '8', 'sub [-1:8]')
 
-    c, err = pcall(utf8.sub)
+    _, err = pcall(utf8.sub)
     test:isnt(err:find('Usage'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, true)
+    _, err = pcall(utf8.sub, true)
     test:isnt(err:find('Usage'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, '123')
+    _, err = pcall(utf8.sub, '123')
     test:isnt(err:find('Usage'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, '123', true)
+    _, err = pcall(utf8.sub, '123', true)
     test:isnt(err:find('bad argument'), nil, 'usage is checked')
-    c, err = pcall(utf8.sub, '123', 1, true)
+    _, err = pcall(utf8.sub, '123', 1, true)
     test:isnt(err:find('bad argument'), nil, 'usage is checked')
 
     local s1 = '☢'
@@ -370,4 +370,4 @@ test:test("unicode", function(test)
     test:is(utf8.upper(''), '', 'upper empty')
 end)
 
-os.exit(test:check() == true and 0 or -1)
+os.exit(suite: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 4d7059559..6c3cfd450 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')
@@ -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)
@@ -478,10 +468,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)
@@ -497,7 +487,7 @@ else
     end
 end
 
-test:test('filter_xlog', function(test)
+test:test('filter_xlog', function(testcase)
     local xlog_data = {
         -- [1] =
         {
@@ -615,13 +605,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
@@ -642,7 +632,7 @@ test:test('filter_xlog', function(test)
                 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..63056edb5 100755
--- a/test/app-tap/trigger.test.lua
+++ b/test/app-tap/trigger.test.lua
@@ -7,14 +7,14 @@ box.cfg{
 }
 
 local trigger = require('internal.trigger')
-local test = require('tap').test('trigger')
+local suite = require('tap').test('trigger')
 
-test:plan(3)
+suite:plan(3)
 
 local trigger_list = trigger.new("sweet trigger")
-test:ok(trigger_list ~= nil, "test that trigger list is created")
+suite:ok(trigger_list ~= nil, "test that trigger list is created")
 
-test:test("simple trigger test", function(test)
+suite:test("simple trigger test", function(test)
     test:plan(10)
 
     local cnt = 0
@@ -45,12 +45,12 @@ test:test("simple trigger test", function(test)
 
 
     -- Check that we've failed to delete trigger
-    local stat, err = pcall(getmetatable(trigger_list).__call, trigger_list,
+    local _, err = pcall(getmetatable(trigger_list).__call, trigger_list,
                             nil, trigger_cnt)
     test:ok(string.find(err, "is not found"), "check error")
 end)
 
-test:test("errored trigger test", function(test)
+suite:test("errored trigger test", function(test)
     test:plan(6)
 
     --
@@ -69,19 +69,19 @@ test:test("errored trigger test", function(test)
     test:is(cnt, 1, "check simple trigger")
     -- Append errored trigger
     trigger_list(trigger_errored)
-    local status = pcall(function() trigger_list:run() end)
+    pcall(function() trigger_list:run() end)
     test:is(cnt, 2, "check simple+error trigger")
     -- Flush triggers
     table_clear(trigger_list)
     test:is(#trigger_list(), 0, "successfull flush")
     -- Append first trigger
     trigger_list(trigger_errored)
-    local status = pcall(function() trigger_list:run() end)
+    pcall(function() trigger_list:run() end)
     test:is(cnt, 2, "check error trigger")
     -- Append errored trigger
     trigger_list(trigger_cnt)
-    local status = pcall(function() trigger_list:run() end)
+    pcall(function() trigger_list:run() end)
     test:is(cnt, 2, "check error+simple trigger")
 end)
 
-os.exit(test:check() == true and 0 or -1)
+os.exit(suite: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")
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"),
diff --git a/test/box-tap/auth.test.lua b/test/box-tap/auth.test.lua
index 4e9879408..6c14d1981 100755
--- a/test/box-tap/auth.test.lua
+++ b/test/box-tap/auth.test.lua
@@ -18,22 +18,24 @@ 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)
     counter = counter + 1
+    msg = 'user ' .. user_name .. ' is there'
 end
 -- get user name as argument
-function auth_trigger2(user_name)
+local function auth_trigger2(user_name)
     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)
+    succeeded = success
+    msg = 'user ' .. user_name .. ' is there'
 end
 -- set trigger
 local handle = session.on_auth(auth_trigger)
@@ -57,68 +59,61 @@ 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
 succeeded = true
-local conn = netbox.connect('test:pas@' .. HOST .. ':' .. PORT)
+conn = netbox.connect('test:pas@' .. HOST .. ':' .. PORT)
 while counter < 1 do fiber.sleep(0.001) end
 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
-local conn = netbox.connect('test2:@' .. HOST .. ':' .. PORT)
+conn = netbox.connect('test2:@' .. HOST .. ':' .. PORT)
 while counter < 1 do fiber.sleep(0.001) end
 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
-local conn = netbox.connect('test2@' .. HOST .. ':' .. PORT)
+conn = netbox.connect('test2@' .. HOST .. ':' .. PORT)
 while counter < 1 do fiber.sleep(0.001) end
 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
-local conn = netbox.connect(HOST, PORT, {user='test2'})
+conn = netbox.connect(HOST, PORT, {user='test2'})
 while counter < 1 do fiber.sleep(0.001) end
 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
-local conn = netbox.connect('guest@' .. HOST .. ':' .. PORT)
+conn = netbox.connect('guest@' .. HOST .. ':' .. PORT)
 while counter < 1 do fiber.sleep(0.001) end
 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
-local conn = netbox.connect('guest:@' .. HOST .. ':' .. PORT)
+conn = netbox.connect('guest:@' .. HOST .. ':' .. PORT)
 while counter < 1 do fiber.sleep(0.001) end
 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,17 +123,15 @@ 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
-local conn = netbox.connect(HOST, PORT, {user='guest'})
+conn = netbox.connect(HOST, PORT, {user='guest'})
 while counter < 1 do fiber.sleep(0.001) end
 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 +141,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..85b18a37a 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()
+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()
+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..493a37ae0 100755
--- a/test/box-tap/cfgup.test.lua
+++ b/test/box-tap/cfgup.test.lua
@@ -6,7 +6,7 @@ local tap = require('tap')
 local test = tap.test('cfg')
 test:plan(3)
 
-config = {
+local config = {
 	pid_file = '1.pid',
     log="tarantool.log"
 }
diff --git a/test/box-tap/feedback_daemon.test.lua b/test/box-tap/feedback_daemon.test.lua
index 9e6c59efc..6399a05a8 100755
--- a/test/box-tap/feedback_daemon.test.lua
+++ b/test/box-tap/feedback_daemon.test.lua
@@ -38,7 +38,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
@@ -111,7 +111,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..c3437507d 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,10 +19,10 @@ 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()
+    gc = box.info.gc()
     test:is(gc.checkpoint_is_in_progress, true, "checkpoint is in progress")
     box.error.injection.set("ERRINJ_SNAP_COMMIT_DELAY", false)
 end
diff --git a/test/box-tap/key_def.test.lua b/test/box-tap/key_def.test.lua
index d7dbf5b88..a5806cc33 100755
--- a/test/box-tap/key_def.test.lua
+++ b/test/box-tap/key_def.test.lua
@@ -179,9 +179,9 @@ local key_def_new_cases = {
     }
 }
 
-local test = tap.test('key_def')
+local suite = tap.test('key_def')
 
-test:plan(#key_def_new_cases - 1 + 7)
+suite:plan(#key_def_new_cases - 1 + 7)
 for _, case in ipairs(key_def_new_cases) do
     if type(case) == 'function' then
         case()
@@ -195,10 +195,10 @@ for _, case in ipairs(key_def_new_cases) do
         if case.exp_err == nil then
             ok = ok and type(res) == 'cdata' and
                 ffi.istype('struct key_def', res)
-            test:ok(ok, case[1])
+            suite:ok(ok, case[1])
         else
             local err = tostring(res) -- cdata -> string
-            test:is_deeply({ok, err}, {false, case.exp_err}, case[1])
+            suite:is_deeply({ok, err}, {false, case.exp_err}, case[1])
         end
     end
 end
@@ -206,7 +206,7 @@ end
 -- Prepare source data for test cases.
 
 -- Case: extract_key().
-test:test('extract_key()', function(test)
+suite:test('extract_key()', function(test)
     test:plan(13)
 
     local key_def_a = key_def_lib.new({
@@ -232,7 +232,7 @@ test:test('extract_key()', function(test)
     }):extract_key(box.tuple.new({{a = {b = 'foo'}}})):totable()
     test:is_deeply(res, {'foo'}, 'JSON path (tuple argument)')
 
-    local res = key_def_lib.new({
+    res = key_def_lib.new({
         {type = 'string', fieldno = 1, path = 'a.b'},
     }):extract_key({{a = {b = 'foo'}}}):totable()
     test:is_deeply(res, {'foo'}, 'JSON path (table argument)')
@@ -265,13 +265,13 @@ test:test('extract_key()', function(test)
         'short tuple with a non-nullable part (case 1)')
 
     -- Same as before, but a max fieldno is over tuple:len() + 1.
-    local exp_err = 'Tuple field [2] required by space format is missing'
-    local key_def = key_def_lib.new({
+    exp_err = 'Tuple field [2] required by space format is missing'
+    key_def = key_def_lib.new({
         {type = 'string', fieldno = 1},
         {type = 'string', fieldno = 2},
         {type = 'string', fieldno = 3},
     })
-    local ok, err = pcall(key_def.extract_key, key_def,
+    ok, err = pcall(key_def.extract_key, key_def,
         box.tuple.new({'foo'}))
     test:is_deeply({ok, tostring(err)}, {false, exp_err},
         'short tuple with a non-nullable part (case 2)')
@@ -280,36 +280,36 @@ test:test('extract_key()', function(test)
     --
     -- * is_nullable = true;
     -- * has_optional_parts = false.
-    local exp_err = 'Tuple field [2] required by space format is missing'
-    local key_def = key_def_lib.new({
+    exp_err = 'Tuple field [2] required by space format is missing'
+    key_def = key_def_lib.new({
         {type = 'string', fieldno = 1, is_nullable = true},
         {type = 'string', fieldno = 2},
     })
-    local ok, err = pcall(key_def.extract_key, key_def,
+    ok, err = pcall(key_def.extract_key, key_def,
         box.tuple.new({'foo'}))
     test:is_deeply({ok, tostring(err)}, {false, exp_err},
         'short tuple with a non-nullable part (case 3)')
 
     -- A tuple has a field that does not match corresponding key
     -- part type.
-    local exp_err = 'Supplied key type of part 2 does not match index ' ..
+    exp_err = 'Supplied key type of part 2 does not match index ' ..
                     'part type: expected string'
-    local key_def = key_def_lib.new({
+    key_def = key_def_lib.new({
         {type = 'string', fieldno = 1},
         {type = 'string', fieldno = 2},
         {type = 'string', fieldno = 3},
     })
-    local ok, err = pcall(key_def.extract_key, key_def, {'one', 'two', 3})
+    ok, err = pcall(key_def.extract_key, key_def, {'one', 'two', 3})
     test:is_deeply({ok, tostring(err)}, {false, exp_err},
         'wrong field type')
 
-    local key_def = key_def_lib.new({
+    key_def = key_def_lib.new({
         {type = 'number', fieldno = 1, path='a'},
         {type = 'number', fieldno = 1, path='b'},
         {type = 'number', fieldno = 1, path='c', is_nullable=true},
         {type = 'number', fieldno = 3, is_nullable=true},
     })
-    local ok, err = pcall(key_def.extract_key, key_def,
+    ok, err = pcall(key_def.extract_key, key_def,
                           box.tuple.new({1, 1, 22}))
     test:is_deeply({ok, tostring(err)},
                 {false, 'Tuple field [1]a required by space format is missing'},
@@ -326,7 +326,7 @@ test:test('extract_key()', function(test)
 end)
 
 -- Case: compare().
-test:test('compare()', function(test)
+suite:test('compare()', function(test)
     test:plan(8)
 
     local key_def_a = key_def_lib.new({
@@ -360,7 +360,7 @@ test:test('compare()', function(test)
 end)
 
 -- Case: compare_with_key().
-test:test('compare_with_key()', function(test)
+suite:test('compare_with_key()', function(test)
     test:plan(2)
 
     local key_def_b = key_def_lib.new({
@@ -372,12 +372,12 @@ test:test('compare_with_key()', function(test)
     local key = {1, 22}
     test:is(key_def_b:compare_with_key(tuple_a:totable(), key), 0, 'table')
 
-    local key = box.tuple.new({1, 22})
+    key = box.tuple.new({1, 22})
     test:is(key_def_b:compare_with_key(tuple_a, key), 0, 'tuple')
 end)
 
 -- Case: totable().
-test:test('totable()', function(test)
+suite:test('totable()', function(test)
     test:plan(2)
 
     local parts_a = {
@@ -393,12 +393,12 @@ test:test('totable()', function(test)
     local exp = set_key_part_defaults(parts_a)
     test:is_deeply(key_def_a:totable(), exp, 'case 1')
 
-    local exp = set_key_part_defaults(parts_b)
+    exp = set_key_part_defaults(parts_b)
     test:is_deeply(key_def_b:totable(), exp, 'case 2')
 end)
 
 -- Case: __serialize().
-test:test('__serialize()', function(test)
+suite:test('__serialize()', function(test)
     test:plan(2)
 
     local parts_a = {
@@ -414,12 +414,12 @@ test:test('__serialize()', function(test)
     local exp = set_key_part_defaults(parts_a)
     test:is(json.encode(key_def_a), json.encode(exp), 'case 1')
 
-    local exp = set_key_part_defaults(parts_b)
+    exp = set_key_part_defaults(parts_b)
     test:is(json.encode(key_def_b), json.encode(exp), 'case 2')
 end)
 
 -- Case: tostring().
-test:test('tostring()', function(test)
+suite:test('tostring()', function(test)
     test:plan(2)
 
     local parts_a = {
@@ -438,7 +438,7 @@ test:test('tostring()', function(test)
 end)
 
 -- Case: merge().
-test:test('merge()', function(test)
+suite:test('merge()', function(test)
     test:plan(6)
 
     local key_def_a = key_def_lib.new({
@@ -464,7 +464,7 @@ test:test('merge()', function(test)
         'case 1: verify with :extract_key()')
 
     local key_def_ba = key_def_b:merge(key_def_a)
-    local exp_parts = fun.iter(key_def_b:totable())
+    exp_parts = fun.iter(key_def_b:totable())
         :chain(fun.iter(key_def_a:totable())):totable()
     test:is_deeply(key_def_ba:totable(), exp_parts,
         'case 2: verify with :totable()')
@@ -473,7 +473,7 @@ test:test('merge()', function(test)
 
     -- Intersecting parts + NULL parts.
     local key_def_cb = key_def_c:merge(key_def_b)
-    local exp_parts = key_def_c:totable()
+    exp_parts = key_def_c:totable()
     exp_parts[#exp_parts + 1] = {type = 'number', fieldno = 3,
         is_nullable = false}
     test:is_deeply(key_def_cb:totable(), exp_parts,
@@ -482,4 +482,4 @@ test:test('merge()', function(test)
         {1, 1, box.NULL, 22}, 'case 3: verify with :extract_key()')
 end)
 
-os.exit(test:check() and 0 or 1)
+os.exit(suite:check() and 0 or 1)
diff --git a/test/box-tap/merger.test.lua b/test/box-tap/merger.test.lua
index ee9eaeaed..da063ee4c 100755
--- a/test/box-tap/merger.test.lua
+++ b/test/box-tap/merger.test.lua
@@ -39,7 +39,7 @@ end
 
 -- Get buffer with data encoded without last 'trunc' bytes.
 local function truncated_msgpack_buffer(data, trunc)
-    local data = msgpackffi.encode(data)
+    data = msgpackffi.encode(data)
     data = data:sub(1, data:len() - trunc)
     local len = data:len()
     local buf = buffer.ibuf()
@@ -370,7 +370,7 @@ local function fetch_source_iterator(input_type, tuples)
 end
 
 local function prepare_data(schema, tuple_count, source_count, opts)
-    local opts = opts or {}
+    opts = opts or {}
     local input_type = opts.input_type
     local use_table_as_tuple = opts.use_table_as_tuple
     local use_fetch_source = opts.use_fetch_source
@@ -471,7 +471,7 @@ end
 local function run_merger(test, schema, tuple_count, source_count, opts)
     fiber.yield()
 
-    local opts = opts or {}
+    opts = opts or {}
 
     -- Prepare data.
     local sources, exp_result = prepare_data(schema, tuple_count, source_count,
@@ -516,8 +516,8 @@ local function run_merger(test, schema, tuple_count, source_count, opts)
         :format(tuple_count, source_count, test_case_opts_str(opts)))
 end
 
-local function run_case(test, schema, opts)
-    local opts = opts or {}
+local function run_case(testcase, schema, opts)
+    opts = opts or {}
 
     local case_name = ('testing on schema %s%s'):format(
         schema.name, test_case_opts_str(opts))
@@ -535,7 +535,7 @@ local function run_case(test, schema, opts)
         return
     end
 
-    test:test(case_name, function(test)
+    testcase:test(case_name, function(test)
         test:plan(4)
 
         -- Check with small buffer count.
@@ -556,12 +556,12 @@ test:plan(#bad_source_new_calls + #bad_chunks + #bad_merger_new_calls +
 box.cfg{}
 
 for _, case in ipairs(bad_source_new_calls) do
-    test:test(case[1], function(test)
+    test:test(case[1], function(testcase)
         local funcs = case.funcs
-        test:plan(#funcs)
+        testcase:plan(#funcs)
         for _, func in ipairs(funcs) do
             local ok, err = pcall(merger[func], unpack(case.params))
-            test:ok(ok == false and err:match(case.exp_err), func)
+            testcase:ok(ok == false and err:match(case.exp_err), func)
         end
     end)
 end
@@ -602,8 +602,8 @@ for _, schema in ipairs(schemas) do
     schema.key_def = key_def_lib.new(schema.parts)
 end
 
-test:test('use a source in two mergers', function(test)
-    test:plan(5)
+test:test('use a source in two mergers', function(testcase)
+    testcase:plan(5)
 
     local data = {{'a'}, {'b'}, {'c'}}
     local source = merger.new_source_fromtable(data)
@@ -611,16 +611,16 @@ test:test('use a source in two mergers', function(test)
     local i2 = merger.new(key_def, {source}):pairs()
 
     local t1 = i1:head():totable()
-    test:is_deeply(t1, data[1], 'tuple 1 from merger 1')
+    testcase:is_deeply(t1, data[1], 'tuple 1 from merger 1')
 
     local t3 = i2:head():totable()
-    test:is_deeply(t3, data[3], 'tuple 3 from merger 2')
+    testcase:is_deeply(t3, data[3], 'tuple 3 from merger 2')
 
     local t2 = i1:head():totable()
-    test:is_deeply(t2, data[2], 'tuple 2 from merger 1')
+    testcase:is_deeply(t2, data[2], 'tuple 2 from merger 1')
 
-    test:ok(i1:is_null(), 'merger 1 ends')
-    test:ok(i2:is_null(), 'merger 2 ends')
+    testcase:ok(i1:is_null(), 'merger 1 ends')
+    testcase:ok(i2:is_null(), 'merger 2 ends')
 end)
 
 local function reusable_source_gen(param)
@@ -640,37 +640,37 @@ local function reusable_source_gen(param)
     return box.NULL, chunk
 end
 
-local function verify_reusable_source(test, source)
-    test:plan(3)
+local function verify_reusable_source(suite, source)
+    suite:plan(3)
 
     local exp = {{1}, {2}}
     local res = source:pairs():map(box.tuple.totable):totable()
-    test:is_deeply(res, exp, '1st use')
+    suite:is_deeply(res, exp, '1st use')
 
-    local exp = {{3}, {4}, {5}}
-    local res = source:pairs():map(box.tuple.totable):totable()
-    test:is_deeply(res, exp, '2nd use')
+    exp = {{3}, {4}, {5}}
+    res = source:pairs():map(box.tuple.totable):totable()
+    suite:is_deeply(res, exp, '2nd use')
 
-    local exp = {}
-    local res = source:pairs():map(box.tuple.totable):totable()
-    test:is_deeply(res, exp, 'end')
+    exp = {}
+    res = source:pairs():map(box.tuple.totable):totable()
+    suite:is_deeply(res, exp, 'end')
 end
 
-test:test('reuse a tuple source', function(test)
+test:test('reuse a tuple source', function(testcase)
     local tuples = {{1}, {2}, nil, {3}, {4}, {5}}
     local source = merger.new_tuple_source(reusable_source_gen,
         {chunks = tuples})
-    verify_reusable_source(test, source)
+    verify_reusable_source(testcase, source)
 end)
 
-test:test('reuse a table source', function(test)
+test:test('reuse a table source', function(testcase)
     local chunks = {{{1}}, {{2}}, {}, nil, {{3}}, {{4}}, {}, {{5}}}
     local source = merger.new_table_source(reusable_source_gen,
         {chunks = chunks})
-    verify_reusable_source(test, source)
+    verify_reusable_source(testcase, source)
 end)
 
-test:test('reuse a buffer source', function(test)
+test:test('reuse a buffer source', function(testcase)
     local chunks_tbl = {{{1}}, {{2}}, {}, nil, {{3}}, {{4}}, {}, {{5}}}
     local chunks = {}
     for i = 1, table.maxn(chunks_tbl) do
@@ -683,43 +683,43 @@ test:test('reuse a buffer source', function(test)
     end
     local source = merger.new_buffer_source(reusable_source_gen,
         {chunks = chunks})
-    verify_reusable_source(test, source)
+    verify_reusable_source(testcase, source)
 end)
 
-test:test('use limit', function(test)
-    test:plan(6)
+test:test('use limit', function(suite)
+    suite:plan(6)
 
     local data = {{'a'}, {'b'}}
 
     local source = merger.new_source_fromtable(data)
     local m = merger.new(key_def, {source})
     local res = m:select({limit = 0})
-    test:is(#res, 0, 'table output with limit 0')
+    suite:is(#res, 0, 'table output with limit 0')
 
-    local source = merger.new_source_fromtable(data)
-    local m = merger.new(key_def, {source})
-    local res = m:select({limit = 1})
-    test:is(#res, 1, 'table output with limit 1')
-    test:is_deeply(res[1]:totable(), data[1], 'tuple content')
+    source = merger.new_source_fromtable(data)
+    m = merger.new(key_def, {source})
+    res = m:select({limit = 1})
+    suite:is(#res, 1, 'table output with limit 1')
+    suite:is_deeply(res[1]:totable(), data[1], 'tuple content')
 
-    local source = merger.new_source_fromtable(data)
-    local m = merger.new(key_def, {source})
+    source = merger.new_source_fromtable(data)
+    m = merger.new(key_def, {source})
     local output_buffer = buffer.ibuf()
     m:select({buffer = output_buffer, limit = 0})
-    local res = msgpackffi.decode(output_buffer.rpos)
-    test:is(#res, 0, 'buffer output with limit 0')
+    res = msgpackffi.decode(output_buffer.rpos)
+    suite:is(#res, 0, 'buffer output with limit 0')
 
-    local source = merger.new_source_fromtable(data)
-    local m = merger.new(key_def, {source})
+    source = merger.new_source_fromtable(data)
+    m = merger.new(key_def, {source})
     output_buffer:recycle()
     m:select({buffer = output_buffer, limit = 1})
-    local res = msgpackffi.decode(output_buffer.rpos)
-    test:is(#res, 1, 'buffer output with limit 1')
-    test:is_deeply(res[1], data[1], 'tuple content')
+    res = msgpackffi.decode(output_buffer.rpos)
+    suite:is(#res, 1, 'buffer output with limit 1')
+    suite:is_deeply(res[1], data[1], 'tuple content')
 end)
 
-test:test('cascade mergers', function(test)
-    test:plan(2)
+test:test('cascade mergers', function(suite)
+    suite:plan(2)
 
     local data = {{'a'}, {'b'}}
 
@@ -728,7 +728,7 @@ test:test('cascade mergers', function(test)
     local m2 = merger.new(key_def, {m1})
 
     local res = m2:pairs():map(box.tuple.totable):totable()
-    test:is_deeply(res, data, 'same key_def')
+    suite:is_deeply(res, data, 'same key_def')
 
     local key_def_unicode = key_def_lib.new({{
         fieldno = 1,
@@ -736,12 +736,12 @@ test:test('cascade mergers', function(test)
         collation = 'unicode',
     }})
 
-    local source = merger.new_source_fromtable(data)
-    local m1 = merger.new(key_def, {source})
-    local m2 = merger.new(key_def_unicode, {m1})
+    source = merger.new_source_fromtable(data)
+    m1 = merger.new(key_def, {source})
+    m2 = merger.new(key_def_unicode, {m1})
 
-    local res = m2:pairs():map(box.tuple.totable):totable()
-    test:is_deeply(res, data, 'different key_defs')
+    res = m2:pairs():map(box.tuple.totable):totable()
+    suite:is_deeply(res, data, 'different key_defs')
 end)
 
 -- Merging cases.
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..c098fcc3e 100755
--- a/test/box-tap/schema_mt.test.lua
+++ b/test/box-tap/schema_mt.test.lua
@@ -21,6 +21,7 @@ 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)
+  print(space)
   return args
 end
 test:is(sp1:myfunc(123), 123, 'space_mt can be extended')
@@ -42,12 +43,15 @@ test:isnt(getmetatable(sp1_pk).__index, getmetatable(sp2_pk).__index, 'engines d
 -- extend base index metatable, or extend engine specific.
 --
 function box.schema.index_mt.common_func(index, args)
+  print(index)
   return args
 end
 function box.schema.vinyl_index_mt.vinyl_func(index, args)
+  print(index)
   return args
 end
 function box.schema.memtx_index_mt.memtx_func(index, args)
+  print(index)
   return args
 end
 test:is(box.schema.index_mt.common_func, box.schema.vinyl_index_mt.common_func,
@@ -77,14 +81,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..09095f99f 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,26 @@ 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, _
+_, 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 +50,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 +71,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 +96,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 +123,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 +144,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')
 
@@ -163,7 +164,7 @@ test:is(
     inspector:cmd('start server session'),
     true, 'instance started'
 )
-local uri = inspector:eval('session', 'box.cfg.listen')[1]
+uri = inspector:eval('session', 'box.cfg.listen')[1]
 conn = net.box.connect(uri)
 test:ok(conn:eval("return box.session.exists(box.session.id())"), "remote session exist check")
 test:isnt(conn:eval("return box.session.peer(box.session.id())"), nil, "remote session peer check")
@@ -187,7 +188,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
 
diff --git a/test/box/box.lua b/test/box/box.lua
index 6fad07015..2cf399f96 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')
 
diff --git a/test/box/hash_multipart.result b/test/box/hash_multipart.result
index e94313b62..e6915652f 100644
--- a/test/box/hash_multipart.result
+++ b/test/box/hash_multipart.result
@@ -62,7 +62,7 @@ test_run:cmd("setopt delimiter ';'")
 function select_all()
     local result = {}
     local tuple, v
-    for tuple, v in hash:pairs() do
+    for _, v in hash:pairs() do
         table.insert(result, v)
     end
     return result
diff --git a/test/box/hash_multipart.test.lua b/test/box/hash_multipart.test.lua
index c0a871bee..c572d13b6 100644
--- a/test/box/hash_multipart.test.lua
+++ b/test/box/hash_multipart.test.lua
@@ -24,7 +24,7 @@ test_run:cmd("setopt delimiter ';'")
 function select_all()
     local result = {}
     local tuple, v
-    for tuple, v in hash:pairs() do
+    for _, v in hash:pairs() do
         table.insert(result, v)
     end
     return result
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..8b6f9b31c 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"),
@@ -7,4 +7,4 @@ box.cfg{
 }
 
 require('console').listen(os.getenv('ADMIN'))
-box.schema.user.grant('guest', 'read,write,execute', 'universe')
\ No newline at end of file
+box.schema.user.grant('guest', 'read,write,execute', 'universe')
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..c42840aaf 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/require_init.lua b/test/box/lua/require_init.lua
index c9ab07dce..8a2b477cc 100644
--- a/test/box/lua/require_init.lua
+++ b/test/box/lua/require_init.lua
@@ -1,5 +1,2 @@
 #!/usr/bin/env tarantool
 box.load_cfg()
-mod = require("require_mod")
-package_path = package.path
-package_cpath = package.cpath
diff --git a/test/box/lua/test_init.lua b/test/box/lua/test_init.lua
index 88cc3acdc..3823a0d13 100644
--- a/test/box/lua/test_init.lua
+++ b/test/box/lua/test_init.lua
@@ -1,15 +1,15 @@
 #!/usr/bin/env tarantool
 box.load_cfg()
 -- testing start-up script
-floor = require("math").floor
+require("math").floor
 
 --
 -- Access to box.cfg from start-up script
 --
 
-box_cfg = box.cfg()
+local box_cfg = box.cfg()
 
-function print_config()
+local function print_config()
 	return box_cfg
 end
 
@@ -24,10 +24,10 @@ local function do_insert()
     box.space[0]:insert{1, 2, 4, 8}
 end
 
-space = box.schema.create_space('tweedledum', { id = 0 })
+local space = box.schema.create_space('tweedledum', { id = 0 })
 space:create_index('primary', { type = 'hash' })
 
-fiber = box.fiber.create(do_insert)
+local fiber = box.fiber.create(do_insert)
 box.fiber.resume(fiber)
 
 --
diff --git a/test/box/lua/utils.lua b/test/box/lua/utils.lua
index 5f859fd19..fd562b767 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
@@ -205,17 +204,17 @@ function space_bsize(s)
 end
 
 function create_iterator(obj, key, opts)
-    local iter, key, state = obj:pairs(key, opts)
+    local iter, state
+    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..f74d6d7fe 100644
--- a/test/box/on_schema_init.lua
+++ b/test/box/on_schema_init.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 function test_before_replace_trig(old, new)
     -- return multiple values so that the stack fills earlier.
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"),
diff --git a/test/box/tree_pk.result b/test/box/tree_pk.result
index df3c78bed..f2a4f5352 100644
--- a/test/box/tree_pk.result
+++ b/test/box/tree_pk.result
@@ -153,8 +153,8 @@ test_run:cmd("setopt delimiter ';'")
 ...
 function crossjoin(space0, space1, limit)
     local result = {}
-    for state, v0 in space0:pairs() do
-        for state, v1 in space1:pairs() do
+    for _, v0 in space0:pairs() do
+        for _, v1 in space1:pairs() do
             if limit <= 0 then
                 return result
             end
diff --git a/test/box/tree_pk.test.lua b/test/box/tree_pk.test.lua
index 1190ab424..86041a642 100644
--- a/test/box/tree_pk.test.lua
+++ b/test/box/tree_pk.test.lua
@@ -58,8 +58,8 @@ test_run = env.new()
 test_run:cmd("setopt delimiter ';'")
 function crossjoin(space0, space1, limit)
     local result = {}
-    for state, v0 in space0:pairs() do
-        for state, v1 in space1:pairs() do
+    for _, v0 in space0:pairs() do
+        for _, v1 in space1:pairs() do
             if limit <= 0 then
                 return result
             end
diff --git a/test/engine/tree_min_max_count.result b/test/engine/tree_min_max_count.result
index f55732aa6..9f1595a20 100644
--- a/test/engine/tree_min_max_count.result
+++ b/test/engine/tree_min_max_count.result
@@ -1189,7 +1189,7 @@ space6:drop()
 ---
 ...
 -- min max count after many inserts
-string = require('string')
+local string = require('string')
 ---
 ...
 space7 = box.schema.space.create('space7', { engine = engine })
diff --git a/test/engine/tree_min_max_count.test.lua b/test/engine/tree_min_max_count.test.lua
index 0633c56b3..19b5fe92d 100644
--- a/test/engine/tree_min_max_count.test.lua
+++ b/test/engine/tree_min_max_count.test.lua
@@ -337,7 +337,7 @@ space6:drop()
 
 -- min max count after many inserts
 
-string = require('string')
+local string = require('string')
 
 space7 = box.schema.space.create('space7', { engine = engine })
 index7 = space7:create_index('primary', { type = 'tree', parts = {1, 'scalar'} })
diff --git a/test/engine_long/suite.lua b/test/engine_long/suite.lua
index 9ac2bff9f..6fe25472c 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
@@ -69,7 +68,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
diff --git a/test/long_run-py/lua/finalizers.lua b/test/long_run-py/lua/finalizers.lua
index 69146a323..cb6400363 100644
--- a/test/long_run-py/lua/finalizers.lua
+++ b/test/long_run-py/lua/finalizers.lua
@@ -1,19 +1,17 @@
 #!/usr/bin/env tarantool
 
-function on_gc(t)
+local function on_gc()
 end;
 
-function test_finalizers()
+local function test_finalizers()
     local result = {}
     local i = 1
     local ffi = require('ffi')
     while true do
-        result[i] = ffi.gc(ffi.cast('void *', 0), on_gc)
+        local result[i] = ffi.gc(ffi.cast('void *', 0), on_gc)
         i = i + 1
     end
-    return "done"
 end;
 
 test_finalizers()
 test_finalizers()
-
diff --git a/test/long_run-py/suite.lua b/test/long_run-py/suite.lua
index 0b33dec7d..c2ea97279 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
@@ -72,7 +71,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
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
diff --git a/test/replication/lua/fast_replica.lua b/test/replication/lua/fast_replica.lua
index 8c772c41f..68148d6a0 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
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/replicaset_ro_mostly.result b/test/replication/replicaset_ro_mostly.result
index a471779d3..e509e0da0 100644
--- a/test/replication/replicaset_ro_mostly.result
+++ b/test/replication/replicaset_ro_mostly.result
@@ -35,7 +35,7 @@ test_run:cmd("setopt delimiter ';'")
 - true
 ...
 function create_cluster_uuid(servers, uuids)
-    for i, name in ipairs(servers) do
+    for _, name in ipairs(servers) do
         test_run:cmd(create_cluster_cmd1:format(name, name))
     end
     for i, name in ipairs(servers) do
diff --git a/test/replication/replicaset_ro_mostly.test.lua b/test/replication/replicaset_ro_mostly.test.lua
index 19cd1fe4a..e06e29c8e 100644
--- a/test/replication/replicaset_ro_mostly.test.lua
+++ b/test/replication/replicaset_ro_mostly.test.lua
@@ -16,7 +16,7 @@ create_cluster_cmd2 = 'start server %s with args="%s", wait_load=False, wait=Fal
 
 test_run:cmd("setopt delimiter ';'")
 function create_cluster_uuid(servers, uuids)
-    for i, name in ipairs(servers) do
+    for _, name in ipairs(servers) do
         test_run:cmd(create_cluster_cmd1:format(name, name))
     end
     for i, name in ipairs(servers) do
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/analyze3.test.lua b/test/sql-tap/analyze3.test.lua
index dcbea1da5..5c9c28601 100755
--- a/test/sql-tap/analyze3.test.lua
+++ b/test/sql-tap/analyze3.test.lua
@@ -23,15 +23,15 @@ testprefix = "analyze3"
 ------------------------------------------------------------------------
 -- Test Organization:
 --
--- analyze3-1.*: Test that the values of bound parameters are considered 
+-- analyze3-1.*: Test that the values of bound parameters are considered
 --               in the same way as constants when planning queries that
 --               use range constraints.
 --
--- analyze3-2.*: Test that the values of bound parameters are considered 
+-- analyze3-2.*: Test that the values of bound parameters are considered
 --               in the same way as constants when planning queries that
 --               use LIKE expressions in the WHERE clause.
 --
--- analyze3-3.*: Test that binding to a variable does not invalidate the 
+-- analyze3-3.*: Test that binding to a variable does not invalidate the
 --               query plan when there is no way in which replanning the
 --               query may produce a superior outcome.
 --
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..7e8a88380 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
@@ -416,7 +416,7 @@ local get_pk = function (space, record)
     return pkey
 end
 
-local inject_stat_error_func = function (space_name)
+local inject_stat_error_func1 = function (space_name)
     local space = box.space[space_name]
     local record = space:select({"T1", "I1", nil}, {limit = 1})[1]
     space:delete(get_pk(space, record))
@@ -427,7 +427,7 @@ local inject_stat_error_func = function (space_name)
     return 0
 end
 
-box.internal.sql_create_function("inject_stat_error", "INT", inject_stat_error_func)
+box.internal.sql_create_function("inject_stat_error", "INT", inject_stat_error_func1)
 
 test:do_execsql_test(
     7.1,
@@ -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\""
@@ -1073,7 +1073,7 @@ test:do_execsql_test(
         -- </15.4>
     })
 
-local inject_stat_error_func = function (space_name)
+local inject_stat_error_func2 = function (space_name)
     local space = box.space[space_name]
     local stats = space:select()
     for _, stat in pairs(stats) do
@@ -1087,7 +1087,7 @@ local inject_stat_error_func = function (space_name)
     return 0
 end
 
-box.internal.sql_create_function("inject_stat_error", "INT", inject_stat_error_func)
+box.internal.sql_create_function("inject_stat_error", "INT", inject_stat_error_func2)
 
 
 test:do_execsql_test(
@@ -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..794e5a3b6 100755
--- a/test/sql-tap/date.test.lua
+++ b/test/sql-tap/date.test.lua
@@ -2,6 +2,7 @@
 test = require("sqltester")
 -- test:plan(1279)
 test:plan(0)
+local enable_broken_tests = false
 
 --!./tcltestrunner.lua
 -- 2003 October 31
@@ -29,7 +30,7 @@ test:plan(0)
 
 -- Disabled until #3694 is resolved.
 --
-if false then
+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..6df27401e 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -36,14 +36,14 @@ local function do_qexpr_test(tn, expr, value)
         {value })
 end
 
-local function matchfunc(a, b)
+local function matchfunc1(a, b)
     return (a == b)
 end
 
 local function regexfunc(a, b)
     return (a == b)
 end
-box.internal.sql_create_function("MATCH", "INT", matchfunc)
+box.internal.sql_create_function("MATCH", "INT", matchfunc1)
 box.internal.sql_create_function("REGEXP", "INT", regexfunc)
 
 -- Set up three global variables:
@@ -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(sql)
         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
@@ -2413,14 +2413,14 @@ test:do_test(
 --
 
 local matchargs = {  }
-local function matchfunc(...)
+local function matchfunc2(...)
     local args = {...}
-    for i, v in ipairs(args) do
+    for _, v in ipairs(args) do
         table.insert(matchargs, v)
     end
     return 1
 end
-box.internal.sql_create_function("MATCH", "INT", matchfunc, 2)
+box.internal.sql_create_function("MATCH", "INT", matchfunc2, 2)
 
 test:do_execsql_test(
     "e_expr-19.2.1",
@@ -2905,9 +2905,9 @@ test:do_test(
 -- x=w1 THEN r1 WHEN x=w2 THEN r2 ELSE r3 END
 --
 local evalcount = 0
-local function ceval(x)
+local function ceval(t)
     evalcount = evalcount + 1
-    return x
+    return t
 end
 box.internal.sql_create_function("CEVAL", "BLOB", ceval)
 evalcount = 0
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..a1d04ed94 100755
--- a/test/sql-tap/func3.test.lua
+++ b/test/sql-tap/func3.test.lua
@@ -288,19 +288,19 @@ test:do_test(
 --
 -- gh-3929: sql: ANSI aliases for LENGTH().
 --
-suits = {}
-suits[1] = {str = '123456789', len = 9}
-suits[2] = {str = '\x80', len = 1}
-suits[3] = {str = '\x61\x62\x63', len = 3}
-suits[4] = {str = '\x7f\x80\x81', len = 3}
-suits[5] = {str = '\x61\xc0', len = 2}
-suits[6] = {str = '\x61\xc0\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80', len = 12}
-suits[7] = {str = '\xc0\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80', len = 11}
-suits[8] = {str = '\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80', len = 10}
-suits[9] = {str = '\x80\x80\x80\x80\x80\xf0\x80\x80\x80\x80', len = 7}
-suits[10] = {str = '\x80\x80\x80\x80\x80\xf0\x80\x80\x80\xff', len = 7}
+local suites = {}
+suites[1] = {str = '123456789', len = 9}
+suites[2] = {str = '\x80', len = 1}
+suites[3] = {str = '\x61\x62\x63', len = 3}
+suites[4] = {str = '\x7f\x80\x81', len = 3}
+suites[5] = {str = '\x61\xc0', len = 2}
+suites[6] = {str = '\x61\xc0\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80', len = 12}
+suites[7] = {str = '\xc0\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80', len = 11}
+suites[8] = {str = '\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80', len = 10}
+suites[9] = {str = '\x80\x80\x80\x80\x80\xf0\x80\x80\x80\x80', len = 7}
+suites[10] = {str = '\x80\x80\x80\x80\x80\xf0\x80\x80\x80\xff', len = 7}
 
-for k,v in pairs(suits) do
+for k,v in pairs(suites) do
     test:do_execsql_test(
         "func3-6."..k,
         "SELECT CHAR_LENGTH('"..v.str.."'), CHARACTER_LENGTH('"..v.str.."');",
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..c3dba4381 100755
--- a/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
+++ b/test/sql-tap/gh-3307-xfer-optimization-issue.test.lua
@@ -1,23 +1,23 @@
 #!/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)
-    local opts = opts or {}
+local function do_xfer_test(test_query, 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_query, 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_query, test_name, func, exp, opts)
+    do_xfer_test(test_query, test.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_query, test_name, func, exp, opts)
+    do_xfer_test(test_query, test.do_catchsql_test, test_name, func, exp, opts)
 end
 
 test:do_catchsql_xfer_test(
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/gh-4077-iproto-execute-no-bind.test.lua b/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua
index d4b597e35..2f71a68ea 100755
--- a/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua
+++ b/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua
@@ -41,10 +41,11 @@ local size = msgpack.encode(header:len() + body:len())
 sock:write(size .. header .. body)
 
 -- Read response.
-local size = msgpack.decode(sock:read(5))
+size = msgpack.decode(sock:read(5))
 local header_body = sock:read(size)
-local header, header_len = msgpack.decode(header_body)
-local body = msgpack.decode(header_body:sub(header_len))
+local header_len
+header, header_len = msgpack.decode(header_body)
+body = msgpack.decode(header_body:sub(header_len))
 sock:close()
 
 -- Verify response.
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..957da9746 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -9,7 +9,7 @@ local sql_tokenizer = require('sql_tokenizer')
 local ok, test_run = pcall(require, 'test_run')
 test_run = ok and test_run.new() or nil
 
-local function flatten(arr)
+local function flatten_func(array)
     local result = { }
 
     local function flatten(arr)
@@ -23,7 +23,7 @@ local function flatten(arr)
             end
         end
     end
-    flatten(arr)
+    flatten(array)
     return result
 end
 
@@ -118,7 +118,8 @@ end
 test.is_deeply_regex = is_deeply_regex
 
 local function do_test(self, label, func, expect)
-    local ok, result = pcall(func)
+    local result
+    ok, result = pcall(func)
     if ok then
         if result == nil then result = { } end
 
@@ -166,7 +167,7 @@ local function execsql(self, sql)
     local result = execsql_one_by_one(sql)
     if type(result) ~= 'table' then return end
 
-    result = flatten(result)
+    result = flatten_func(result)
     for i, c in ipairs(result) do
         if c == nil then
             result[i] = ""
@@ -176,8 +177,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 +257,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 +272,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 +379,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
@@ -394,11 +394,11 @@ test.do_eqp_test = function (self, label, sql, result)
     test:do_test(
         label,
         function()
-            local result = execsql_one_by_one("EXPLAIN QUERY PLAN "..sql)
-            for k,v in pairs(result) do
-                result[k] = v:totable()
+            local res = execsql_one_by_one("EXPLAIN QUERY PLAN "..sql)
+            for k,v in pairs(res) do
+                res[k] = v:totable()
             end
-            return result
+            return res
         end,
         result)
 end
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 db0881caa..3e2ed72f7 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/tkt-fa7bf5ec.test.lua b/test/sql-tap/tkt-fa7bf5ec.test.lua
index 7152e028c..25d44c9d3 100755
--- a/test/sql-tap/tkt-fa7bf5ec.test.lua
+++ b/test/sql-tap/tkt-fa7bf5ec.test.lua
@@ -20,9 +20,9 @@ test:plan(1)
 -- The problem described by this ticket was that the sqlExprCompare()
 -- function was saying that expressions (x='a') and (x='A') were identical
 -- because it was using sqlStrICmp() instead of strcmp() to compare string
--- literals.  That was causing the query optimizer for aggregate queries to 
--- believe that both count() operations were identical, and thus only 
--- computing the first count() and making a copy of the result for the 
+-- literals.  That was causing the query optimizer for aggregate queries to
+-- believe that both count() operations were identical, and thus only
+-- computing the first count() and making a copy of the result for the
 -- second count().
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
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(
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)
diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result
index 509c33e59..b0915f398 100644
--- a/test/sql/savepoints.result
+++ b/test/sql/savepoints.result
@@ -102,12 +102,12 @@ collision_sv_2 = function()
     box.begin()
     box.execute('SAVEPOINT t1;')
     box.execute('SAVEPOINT t2;')
-    local _,err = box.execute('SAVEPOINT t1;')
+    local _, err = box.execute('SAVEPOINT t1;')
     assert(err == nil)
     box.execute('RELEASE SAVEPOINT t1;')
-    local _,err = box.execute('RELEASE SAVEPOINT t1;')
+    _, err = box.execute('RELEASE SAVEPOINT t1;')
     assert(err ~= nil)
-    local _, err = box.execute('ROLLBACK TO t2;')
+    _, err = box.execute('ROLLBACK TO t2;')
     assert(err == nil)
 end;
 ---
diff --git a/test/sql/savepoints.test.lua b/test/sql/savepoints.test.lua
index f1b15c748..eb7bea37d 100644
--- a/test/sql/savepoints.test.lua
+++ b/test/sql/savepoints.test.lua
@@ -65,12 +65,12 @@ collision_sv_2 = function()
     box.begin()
     box.execute('SAVEPOINT t1;')
     box.execute('SAVEPOINT t2;')
-    local _,err = box.execute('SAVEPOINT t1;')
+    local _, err = box.execute('SAVEPOINT t1;')
     assert(err == nil)
     box.execute('RELEASE SAVEPOINT t1;')
-    local _,err = box.execute('RELEASE SAVEPOINT t1;')
+    _, err = box.execute('RELEASE SAVEPOINT t1;')
     assert(err ~= nil)
-    local _, err = box.execute('ROLLBACK TO t2;')
+    _, err = box.execute('ROLLBACK TO t2;')
     assert(err == nil)
 end;
 collision_sv_2();
diff --git a/test/sql/triggers.result b/test/sql/triggers.result
index ceecb8ef2..e70d72947 100644
--- a/test/sql/triggers.result
+++ b/test/sql/triggers.result
@@ -11,7 +11,7 @@ _ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
 ...
 -- Get invariant part of the tuple; name and opts don't change.
- function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
+ function immutable_part(data) local r = {} for _, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
 ---
 ...
 --
diff --git a/test/sql/triggers.test.lua b/test/sql/triggers.test.lua
index f5c8a3961..bc694ebc4 100644
--- a/test/sql/triggers.test.lua
+++ b/test/sql/triggers.test.lua
@@ -4,7 +4,7 @@ engine = test_run:get_cfg('engine')
 _ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- Get invariant part of the tuple; name and opts don't change.
- function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
+ function immutable_part(data) local r = {} for _, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
 
 --
 -- gh-3273: Move Triggers to server
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/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..02b5c010b 100644
--- a/test/vinyl/vinyl.lua
+++ b/test/vinyl/vinyl.lua
@@ -15,7 +15,7 @@ box.cfg {
     vinyl_max_tuple_size = 1024 * 1024 * 6,
 }
 
-function box_info_sort(data)
+local function box_info_sort(data)
     if type(data)~='table' then
         return data
     end
diff --git a/test/wal_off/rtree_benchmark.result b/test/wal_off/rtree_benchmark.result
index 8e01c9f2a..8deefca82 100644
--- a/test/wal_off/rtree_benchmark.result
+++ b/test/wal_off/rtree_benchmark.result
@@ -163,7 +163,7 @@ for i = 1, 0 do
    for j = 1, dimension do
       table.insert(rect, 180*math.random())
    end
-   for k,v in pairs(s.index.spatial:select(rect, {limit = n_neighbors, iterator = 'NEIGHBOR'})) do
+   for _,_ in pairs(s.index.spatial:select(rect, {limit = n_neighbors, iterator = 'NEIGHBOR'})) do
       n = n + 1
    end
 end;
diff --git a/test/wal_off/rtree_benchmark.test.lua b/test/wal_off/rtree_benchmark.test.lua
index 6fae977c9..6bdc0a758 100644
--- a/test/wal_off/rtree_benchmark.test.lua
+++ b/test/wal_off/rtree_benchmark.test.lua
@@ -96,7 +96,7 @@ for i = 1, 0 do
    for j = 1, dimension do
       table.insert(rect, 180*math.random())
    end
-   for k,v in pairs(s.index.spatial:select(rect, {limit = n_neighbors, iterator = 'NEIGHBOR'})) do
+   for _,_ in pairs(s.index.spatial:select(rect, {limit = n_neighbors, iterator = 'NEIGHBOR'})) do
       n = n + 1
    end
 end;
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"),
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/reader.result b/test/xlog/reader.result
index 9985aa2ac..74ac3579e 100644
--- a/test/xlog/reader.result
+++ b/test/xlog/reader.result
@@ -40,7 +40,7 @@ trun:cmd("setopt delimiter ';'")
 ...
 function collect_results(file)
     local val = {}
-    for k, v in xlog(file) do
+    for _, v in xlog(file) do
         table.insert(val, setmetatable(v, { __serialize = "map"}))
     end
     return val
diff --git a/test/xlog/reader.test.lua b/test/xlog/reader.test.lua
index 327af54dd..707ba394b 100644
--- a/test/xlog/reader.test.lua
+++ b/test/xlog/reader.test.lua
@@ -21,7 +21,7 @@ pattern_ok_v13 = fio.pathjoin(pattern_prefix, "v13/")
 trun:cmd("setopt delimiter ';'")
 function collect_results(file)
     local val = {}
-    for k, v in xlog(file) do
+    for _, v in xlog(file) do
         table.insert(val, setmetatable(v, { __serialize = "map"}))
     end
     return val
diff --git a/test/xlog/snap_io_rate.test.lua b/test/xlog/snap_io_rate.test.lua
index f71296269..5626ea1f4 100644
--- a/test/xlog/snap_io_rate.test.lua
+++ b/test/xlog/snap_io_rate.test.lua
@@ -9,6 +9,6 @@ for i = 0, 127 do box.space.snap:replace({i, digest.urandom(512 * 1024)}) end
 t1 = fiber.time()
 box.snapshot()
 t2 = fiber.time()
-t2 - t1 > 64 / box.cfg.snap_io_rate_limit * 0.95
+assert(t2 - t1 > 64 / box.cfg.snap_io_rate_limit * 0.95)
 
 box.space.snap:drop()
diff --git a/test/xlog/transaction.result b/test/xlog/transaction.result
index 63adb0f25..d45b60b0a 100644
--- a/test/xlog/transaction.result
+++ b/test/xlog/transaction.result
@@ -16,7 +16,7 @@ test_run:cmd("setopt delimiter ';'")
 ...
 function read_xlog(file)
     local val = {}
-    for k, v in xlog(file) do
+    for _, v in xlog(file) do
         table.insert(val, setmetatable(v, { __serialize = "map"}))
     end
     return val
diff --git a/test/xlog/transaction.test.lua b/test/xlog/transaction.test.lua
index 2d8090b4c..5fdeec625 100644
--- a/test/xlog/transaction.test.lua
+++ b/test/xlog/transaction.test.lua
@@ -6,7 +6,7 @@ test_run = env.new()
 test_run:cmd("setopt delimiter ';'")
 function read_xlog(file)
     local val = {}
-    for k, v in xlog(file) do
+    for _, v in xlog(file) do
         table.insert(val, setmetatable(v, { __serialize = "map"}))
     end
     return val
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.23.0

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

* [Tarantool-patches] [PATCH v4 7/10] schema: fix index promotion to functional index
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
                   ` (5 preceding siblings ...)
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 6/10] Fix luacheck warnings in test/ sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-23 23:24   ` Igor Munkin
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G sergeyb
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>

When index:alter() was called on a non-functional index with
specified 'func', it led to accessing a not declared variable in
schema.lua.
---
 src/box/lua/schema.lua          |  2 +-
 test/engine/func_index.result   | 36 +++++++++++++++++++++++++++++++++
 test/engine/func_index.test.lua | 14 +++++++++++++
 3 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
index de47b807e..0beb66510 100644
--- a/src/box/lua/schema.lua
+++ b/src/box/lua/schema.lua
@@ -1210,7 +1210,7 @@ box.schema.index.alter = function(space_id, index_id, options)
                    index_opts, parts}
     if index_opts.func ~= nil then
         local _func_index = box.space[box.schema.FUNC_INDEX_ID]
-        _func_index:insert{space_id, iid, index_opts.func}
+        _func_index:insert{space_id, index_id, index_opts.func}
     end
     space_sequence_alter_commit(sequence_proxy)
 end
diff --git a/test/engine/func_index.result b/test/engine/func_index.result
index a827c929f..8e7767dce 100644
--- a/test/engine/func_index.result
+++ b/test/engine/func_index.result
@@ -847,3 +847,39 @@ s:drop()
 box.func.extr:drop()
  | ---
  | ...
+
+--
+-- Function is added at alter.
+--
+s = box.schema.space.create('withdata', {engine = engine})
+ | ---
+ | ...
+lua_code = [[function(tuple) return {tuple[2] >= 0 and tuple[2] or -tuple[2]} end]]
+ | ---
+ | ...
+box.schema.func.create('second_field_module', {body = lua_code, is_deterministic = true, is_sandboxed = true})
+ | ---
+ | ...
+pk = s:create_index('pk')
+ | ---
+ | ...
+sk = s:create_index('sk', {parts = {{2, 'unsigned'}}})
+ | ---
+ | ...
+sk:alter({func = 'second_field_module', parts = {{1, 'unsigned'}}})
+ | ---
+ | ...
+s:insert({1, -3})
+ | ---
+ | - [1, -3]
+ | ...
+sk:get{3}
+ | ---
+ | - [1, -3]
+ | ...
+s:drop()
+ | ---
+ | ...
+box.schema.func.drop('second_field_module')
+ | ---
+ | ...
diff --git a/test/engine/func_index.test.lua b/test/engine/func_index.test.lua
index 5db588c1f..3b48bb478 100644
--- a/test/engine/func_index.test.lua
+++ b/test/engine/func_index.test.lua
@@ -294,3 +294,17 @@ idx:get({3})
 
 s:drop()
 box.func.extr:drop()
+
+--
+-- Function is added at alter.
+--
+s = box.schema.space.create('withdata', {engine = engine})
+lua_code = [[function(tuple) return {tuple[2] >= 0 and tuple[2] or -tuple[2]} end]]
+box.schema.func.create('second_field_module', {body = lua_code, is_deterministic = true, is_sandboxed = true})
+pk = s:create_index('pk')
+sk = s:create_index('sk', {parts = {{2, 'unsigned'}}})
+sk:alter({func = 'second_field_module', parts = {{1, 'unsigned'}}})
+s:insert({1, -3})
+sk:get{3}
+s:drop()
+box.schema.func.drop('second_field_module')
-- 
2.23.0

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

* [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
                   ` (6 preceding siblings ...)
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 7/10] schema: fix index promotion to functional index sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-21 14:13   ` Oleg Babin
  2020-04-21 19:52   ` Igor Munkin
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 9/10] Disabled test/luajit-tap in luacheckrc sergeyb
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck sergeyb
  9 siblings, 2 replies; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>

A couple of functions were mistakenly declared as 'function'
instead of 'local function' in schema.lua. That led to their
presence in the global namespace.
---
 src/box/lua/schema.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
index 0beb66510..4d0451848 100644
--- a/src/box/lua/schema.lua
+++ b/src/box/lua/schema.lua
@@ -350,7 +350,7 @@ end
 -- box.commit yields, so it's defined as Lua/C binding
 -- box.rollback and box.rollback_to_savepoint yields as well
 
-function update_format(format)
+local function update_format(format)
     local result = {}
     for i, given in ipairs(format) do
         local field = {}
@@ -2639,7 +2639,7 @@ box.schema.role.drop = function(name, opts)
     return drop(uid)
 end
 
-function role_check_grant_revoke_of_sys_priv(priv)
+local function role_check_grant_revoke_of_sys_priv(priv)
     priv = string.lower(priv)
     if (type(priv) == 'string' and (priv:match("session") or priv:match("usage"))) or
         (type(priv) == "number" and (bit.band(priv, 8) ~= 0 or bit.band(priv, 16) ~= 0)) then
-- 
2.23.0

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

* [Tarantool-patches] [PATCH v4 9/10] Disabled test/luajit-tap in luacheckrc
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
                   ` (7 preceding siblings ...)
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-24 10:16   ` Igor Munkin
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck sergeyb
  9 siblings, 1 reply; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Sergey Bronnikov <sergeyb@tarantool.org>

temporarily disabled luajit-tap tests while patch with fixes not applied
---
 .luacheckrc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.luacheckrc b/.luacheckrc
index cec1f4ffe..b8ee14b50 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -19,6 +19,7 @@ exclude_files = {
     "test/xlog/*.lua",
     "test/wal_off/*.lua",
     "test/var/**/*.lua",
+    "test/luajit-tap",
     "test-run/**/*.lua",
     "third_party/**/*.lua",
     ".rocks/**/*.lua",
-- 
2.23.0

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

* [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck
  2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
                   ` (8 preceding siblings ...)
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 9/10] Disabled test/luajit-tap in luacheckrc sergeyb
@ 2020-04-21 14:00 ` sergeyb
  2020-04-21 19:33   ` Igor Munkin
  2020-04-23  6:24   ` Sergey Bronnikov
  9 siblings, 2 replies; 39+ messages in thread
From: sergeyb @ 2020-04-21 14:00 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

From: Sergey Bronnikov <sergeyb@tarantool.org>

---
 .../lj-494-table-chain-infinite-loop.test.lua | 26 +++++++++----------
 1 file changed, 13 insertions(+), 13 deletions(-)

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
-- 
2.18.2

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

* Re: [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G sergeyb
@ 2020-04-21 14:13   ` Oleg Babin
  2020-04-21 14:45     ` Sergey Bronnikov
  2020-04-21 19:52   ` Igor Munkin
  1 sibling, 1 reply; 39+ messages in thread
From: Oleg Babin @ 2020-04-21 14:13 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Hi! Thanks for the patch. It closes this issue - 
https://github.com/tarantool/tarantool/issues/4812

I think you could add it to commit message.

On 21/04/2020 17:00, sergeyb@tarantool.org wrote:
 > From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
 >
 > A couple of functions were mistakenly declared as 'function'
 > instead of 'local function' in schema.lua. That led to their
 > presence in the global namespace.

---
Oleg Babin

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

* Re: [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G
  2020-04-21 14:13   ` Oleg Babin
@ 2020-04-21 14:45     ` Sergey Bronnikov
  0 siblings, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-04-21 14:45 UTC (permalink / raw)
  To: Oleg Babin; +Cc: tarantool-patches

Hi!

On 17:13 Tue 21 Apr , Oleg Babin wrote:
> Hi! Thanks for the patch. It closes this issue -
> https://github.com/tarantool/tarantool/issues/4812
> 
> I think you could add it to commit message.

Oleg, updated commit message in the branch.
Thanks!

> On 21/04/2020 17:00, sergeyb@tarantool.org wrote:
> > From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> >
> > A couple of functions were mistakenly declared as 'function'
> > instead of 'local function' in schema.lua. That led to their
> > presence in the global namespace.

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

* Re: [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck sergeyb
@ 2020-04-21 19:33   ` Igor Munkin
  2020-04-22 10:14     ` Sergey Bronnikov
  2020-04-23  6:24   ` Sergey Bronnikov
  1 sibling, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-21 19:33 UTC (permalink / raw)
  To: sergeyb; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Sergey,

Thanks for the patch! Please adjust the commit subject considering our
contributors guide[1]. Since the commit is for tarantool/luajit repo I
propose the following:
| test: fix warnings spotted by luacheck

Also, It would be nice to mention in commit message that luacheck is
integrated in tarantool CI pipeline that respect .luacheckrc in
tarantool repo (since jit global is suppressed there).

Furthermore I applied your patch and as a result of manual luacheck run
in test directory I faced the following warnings:
| $ luacheck *.lua --globals=jit
| Checking gh-3196-incorrect-string-length.test.lua OK
| Checking gh-4427-ffi-sandwich.test.lua            OK
| Checking gh-4476-fix-string-find-recording.test.lua 1 warning
|
|     gh-4476-fix-string-find-recording.test.lua:54:11: variable s is never accessed
|
| Checking gh-4773-tonumber-fail-on-NUL-char.test.lua OK
| Checking lj-494-table-chain-infinite-loop.test.lua OK
| Checking lj-505-fold-no-strref-for-ptrdiff.test.lua OK
| Checking lj-524-fold-conv-respect-src-irt.test.lua OK
| Checking lj-flush-on-trace.test.lua               OK
| Checking or-232-unsink-64-kptr.test.lua           1 warning
|
|     or-232-unsink-64-kptr.test.lua:34:18: empty if branch
|
| Checking utils.lua                                OK
|
| Total: 2 warnings / 0 errors in 10 files

Here is the diff with the fix:

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

diff --git a/test/gh-4476-fix-string-find-recording.test.lua b/test/gh-4476-fix-string-find-recording.test.lua
index 209090a..ef2bb97 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/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

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

I see no warnings after applying this diff.

On 21.04.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> ---
>  .../lj-494-table-chain-infinite-loop.test.lua | 26 +++++++++----------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 

<snipped>

> -- 
> 2.18.2
> 

[1]: https://www.tarantool.io/en/doc/2.2/dev_guide/developer_guidelines/

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G sergeyb
  2020-04-21 14:13   ` Oleg Babin
@ 2020-04-21 19:52   ` Igor Munkin
  2020-04-23 23:27     ` Igor Munkin
  1 sibling, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-21 19:52 UTC (permalink / raw)
  To: sergeyb; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Vlad,

Thanks for the patch! LGTM (feel free to push out of order as obvious).

Side note: I don't know whether we need a test for it (a simple lookup
for <update_format> and <role_check_grant_revoke_of_sys_priv> in _G) but
on the second thought it looks excess and out of the common practice.

On 21.04.20, sergeyb@tarantool.org wrote:
> From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> 
> A couple of functions were mistakenly declared as 'function'
> instead of 'local function' in schema.lua. That led to their
> presence in the global namespace.
> ---
>  src/box/lua/schema.lua | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

<snipped>

> -- 
> 2.23.0
> 

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 2/10] gitlab-ci: enable static analysis with luacheck
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 2/10] gitlab-ci: enable static analysis with luacheck sergeyb
@ 2020-04-21 20:04   ` Alexander Tikhonov
  2020-04-22  8:09     ` Sergey Bronnikov
  2020-04-22  8:11     ` Kirill Yukhin
  0 siblings, 2 replies; 39+ messages in thread
From: Alexander Tikhonov @ 2020-04-21 20:04 UTC (permalink / raw)
  To: sergeyb; +Cc: tarantool-patches, v.shpilevoy, o.piskunov

[-- Attachment #1: Type: text/plain, Size: 3065 bytes --]


Sergey, thank you for the patch, I have some questions on it.

Do we really want to have separate stage before the man stages with testing ? As I see you want to have the ability to avoid of testing if the initial luacheck test fails, but does it mean that issues found by the luacheck will always need changes in the code that always will change the rest of the jobs, I mean is it strong dependency between this check and the others that we can’t do the rest of the testing w/o luacheck ? We had the opinion that our testing should produce fails as fast as possible that is why we decided to remove different stages, and we can see the early fails as fast as possible, because currently all the testing start together from the very start, but in your fix will have more that 2+ minutes delay before it, while we had strong suggestion from Kirill Y. to make the testing fast as much as possible and try to make it parallel up to 2 minutes. Right, for now we have overall time of testing up to 20 minutes, but in general fastest jobs finishes in 1+ minutes and we can see the issues much faster than waiting the whole testing process.

  
>Вторник, 21 апреля 2020, 17:02 +03:00 от sergeyb@tarantool.org:
> 
>From: Sergey Bronnikov < sergeyb@tarantool.org >
>
>Closes #4681
>---
> .gitlab-ci.yml | 9 +++++++++
> .travis.mk | 15 ++++++++++++++-
> 2 files changed, 23 insertions(+), 1 deletion(-)
>
>diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
>index cd710027f..adbd892c8 100644
>--- a/.gitlab-ci.yml
>+++ b/.gitlab-ci.yml
>@@ -1,4 +1,5 @@
> stages:
>+ - static_analysis
>   - test
>   - perf
>   - cleanup
>@@ -96,6 +97,14 @@ variables:
>   script:
>     - ${GITLAB_MAKE} perf_run
> 
>+# Static Analysis
>+
>+luacheck:
>+ <<: *docker_test_definition
>+ stage: static_analysis
>+ script:
>+ - ${GITLAB_MAKE} test_debian_luacheck
>+
> # Tests
> 
> release:
>diff --git a/.travis.mk b/.travis.mk
>index f709a18b6..d917a1694 100644
>--- a/.travis.mk
>+++ b/.travis.mk
>@@ -77,9 +77,13 @@ deps_buster_clang_8: deps_debian
> # Release
> 
> build_debian:
>- cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS}
>+ # ENABLE_DIST required to enable tarantoolctl for test_debian_luacheck
>+ cmake . -DENABLE_DIST=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS}
>  make -j
> 
>+build_debian_install: build_debian
>+ sudo make install
>+
> test_debian_no_deps: build_debian
>  cd test && /usr/bin/python test-run.py --force $(TEST_RUN_EXTRA_PARAMS)
> 
>@@ -145,6 +149,15 @@ test_static_build: deps_debian_static
> test_static_docker_build:
>  docker build --network=host --build-arg RUN_TESTS=ON -f Dockerfile.staticbuild .
> 
>+# ###################
>+# Static Analysis
>+# ###################
>+
>+test_debian_luacheck: build_debian_install
>+ tarantoolctl rocks install luacheck
>+ # TODO: run in parallel with LuaLanes
>+ .rocks/bin/luacheck --codes --config .luacheckrc .
>+
> #######
> # OSX #
> #######
>--
>2.23.0
>  
 
 
--
Alexander Tikhonov
 

[-- Attachment #2: Type: text/html, Size: 3877 bytes --]

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

* Re: [Tarantool-patches] [PATCH v4 2/10] gitlab-ci: enable static analysis with luacheck
  2020-04-21 20:04   ` Alexander Tikhonov
@ 2020-04-22  8:09     ` Sergey Bronnikov
  2020-04-22  8:11     ` Kirill Yukhin
  1 sibling, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-04-22  8:09 UTC (permalink / raw)
  To: Alexander Tikhonov; +Cc: tarantool-patches, v.shpilevoy, o.piskunov

Hi,

On 23:04 Tue 21 Apr , Alexander Tikhonov wrote:
>
> Sergey, thank you for the patch, I have some questions on it.

We already started discussion on this topic in a previous patch review -
https://lists.tarantool.org/pipermail/tarantool-patches/2020-April/015672.html
Let's continue discussion there.

> Do we really want to have separate stage before the man stages with
> testing ? As I see you want to have the ability to avoid of testing if
> the initial luacheck test fails, but does it mean that issues found by
> the luacheck will always need changes in the code that always will
> change the rest of the jobs, I mean is it strong dependency between this
> check and the others that we can’t do the rest of the testing w/o
> luacheck ? We had the opinion that our testing should produce fails as
> fast as possible that is why we decided to remove different stages, and
> we can see the early fails as fast as possible, because currently all
> the testing start together from the very start, but in your fix will
> have more that 2+ minutes delay before it, while we had strong
> suggestion from Kirill Y. to make the testing fast as much as possible
> and try to make it parallel up to 2 minutes. Right, for now we have
> overall time of testing up to 20 minutes, but in general fastest jobs
> finishes in 1+ minutes and we can see the issues much faster than
> waiting the whole testing process.
>
>
> >Вторник, 21 апреля 2020, 17:02 +03:00 от sergeyb@tarantool.org:
> > 
> >From: Sergey Bronnikov < sergeyb@tarantool.org >
> >
> >Closes #4681
> >---
> > .gitlab-ci.yml | 9 +++++++++
> > .travis.mk | 15 ++++++++++++++-
> > 2 files changed, 23 insertions(+), 1 deletion(-)
> >
> >diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> >index cd710027f..adbd892c8 100644
> >--- a/.gitlab-ci.yml
> >+++ b/.gitlab-ci.yml
> >@@ -1,4 +1,5 @@
> > stages:
> >+ - static_analysis
> >   - test
> >   - perf
> >   - cleanup
> >@@ -96,6 +97,14 @@ variables:
> >   script:
> >     - ${GITLAB_MAKE} perf_run
> > 
> >+# Static Analysis
> >+
> >+luacheck:
> >+ <<: *docker_test_definition
> >+ stage: static_analysis
> >+ script:
> >+ - ${GITLAB_MAKE} test_debian_luacheck
> >+
> > # Tests
> > 
> > release:
> >diff --git a/.travis.mk b/.travis.mk
> >index f709a18b6..d917a1694 100644
> >--- a/.travis.mk
> >+++ b/.travis.mk
> >@@ -77,9 +77,13 @@ deps_buster_clang_8: deps_debian
> > # Release
> > 
> > build_debian:
> >- cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS}
> >+ # ENABLE_DIST required to enable tarantoolctl for test_debian_luacheck
> >+ cmake . -DENABLE_DIST=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_WERROR=ON ${CMAKE_EXTRA_PARAMS}
> >  make -j
> > 
> >+build_debian_install: build_debian
> >+ sudo make install
> >+
> > test_debian_no_deps: build_debian
> >  cd test && /usr/bin/python test-run.py --force $(TEST_RUN_EXTRA_PARAMS)
> > 
> >@@ -145,6 +149,15 @@ test_static_build: deps_debian_static
> > test_static_docker_build:
> >  docker build --network=host --build-arg RUN_TESTS=ON -f Dockerfile.staticbuild .
> > 
> >+# ###################
> >+# Static Analysis
> >+# ###################
> >+
> >+test_debian_luacheck: build_debian_install
> >+ tarantoolctl rocks install luacheck
> >+ # TODO: run in parallel with LuaLanes
> >+ .rocks/bin/luacheck --codes --config .luacheckrc .
> >+
> > #######
> > # OSX #
> > #######
> >--
> >2.23.0
> >  
>  
>  
> --
> Alexander Tikhonov

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

* Re: [Tarantool-patches] [PATCH v4 2/10] gitlab-ci: enable static analysis with luacheck
  2020-04-21 20:04   ` Alexander Tikhonov
  2020-04-22  8:09     ` Sergey Bronnikov
@ 2020-04-22  8:11     ` Kirill Yukhin
  1 sibling, 0 replies; 39+ messages in thread
From: Kirill Yukhin @ 2020-04-22  8:11 UTC (permalink / raw)
  To: Alexander Tikhonov; +Cc: tarantool-patches, v.shpilevoy, o.piskunov

Hello,

On 21 апр 23:04, Alexander Tikhonov wrote:
> 
> Sergey, thank you for the patch, I have some questions on it.
> 
> Do we really want to have separate stage before the man stages with testing ? As I see you want to have the ability to avoid of testing if the initial luacheck test fails, but does it mean that issues found by the luacheck will always need changes in the code that always will change the rest of the jobs, I mean is it strong dependency between this check and the others that we can’t do the rest of the testing w/o luacheck ? We had the opinion that our testing should produce fails as fast as possible that is why we decided to remove different stages, and we can see the early fails as fast as possible, because currently all the testing start together from the very start, but in your fix will have more that 2+ minutes delay before it, while we had strong suggestion from Kirill Y. to make the testing fast as much as possible and try to make it parallel up to 2 minutes. Right, for now we have overall time of testing up to 20 minutes, but in general fastest jobs finishes in 1+ minutes and we can see the issues much faster than waiting the whole testing process.

Please use lines of sane length.

--
Regards, Kirill Yukhin

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

* Re: [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck
  2020-04-21 19:33   ` Igor Munkin
@ 2020-04-22 10:14     ` Sergey Bronnikov
  0 siblings, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-04-22 10:14 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Hello,

On 22:33 Tue 21 Apr , Igor Munkin wrote:
> Sergey,
> 
> Thanks for the patch! Please adjust the commit subject considering our
> contributors guide[1]. Since the commit is for tarantool/luajit repo I
> propose the following:
> | test: fix warnings spotted by luacheck

Updated on the branch.

> Also, It would be nice to mention in commit message that luacheck is
> integrated in tarantool CI pipeline that respect .luacheckrc in
> tarantool repo (since jit global is suppressed there).
> 
> Furthermore I applied your patch and as a result of manual luacheck run
> in test directory I faced the following warnings:

Applied on the branch, thanks!

<snipped>

Sergey

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

* Re: [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck sergeyb
  2020-04-21 19:33   ` Igor Munkin
@ 2020-04-23  6:24   ` Sergey Bronnikov
  2020-04-23 10:03     ` Igor Munkin
  1 sibling, 1 reply; 39+ messages in thread
From: Sergey Bronnikov @ 2020-04-23  6:24 UTC (permalink / raw)
  To: tarantool-patches, imun, v.shpilevoy; +Cc: o.piskunov

GH branch:
https://github.com/tarantool/luajit/tree/ligurio/gh-4681-fix-luacheck-warnings

On 17:00 Tue 21 Apr , sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>

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

* Re: [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck
  2020-04-23  6:24   ` Sergey Bronnikov
@ 2020-04-23 10:03     ` Igor Munkin
  2020-04-23 10:30       ` Sergey Bronnikov
  0 siblings, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-23 10:03 UTC (permalink / raw)
  To: Sergey Bronnikov; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Sergey,

Thank you for the changes! Sorry for nitpicking, but I still have
several comments regarding commit message:

| test: fix warnings spotted by luacheck
|
| luacheck is integrated in tarantool CI pipeline and respect .luacheckrc in

Typo: s/respect/respects/.

| tarantool repo, so jit global is suppressed there.
|
| Reviewed-by: Igor Munkin <imun@tarantool.org>
| Co-authored-by: Igor Munkin <imun@tarantool.org>

Minor: I failed to find strict rules about the ordering misc-by tags,
but here[1] I follows the kernel example[2] where Co-developed-by tag
(or Co-authored-by alternative) goes prior to Reviewed-by one. I guess
it would be nice to use a single sort order for the tags. But again, I
find no rule and tag practice is even optional (it's not mentioned in
our contributors guide), so feel free to ignore this comment.

|

Otherwise, LGTM, thanks!

On 23.04.20, Sergey Bronnikov wrote:
> GH branch:
> https://github.com/tarantool/luajit/tree/ligurio/gh-4681-fix-luacheck-warnings
> 
> On 17:00 Tue 21 Apr , sergeyb@tarantool.org wrote:
> > From: Sergey Bronnikov <sergeyb@tarantool.org>

[1]: https://github.com/tarantool/luajit/commit/4f4fd9e
[2]: https://github.com/torvalds/linux/commit/56df70a

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck
  2020-04-23 10:03     ` Igor Munkin
@ 2020-04-23 10:30       ` Sergey Bronnikov
  0 siblings, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-04-23 10:30 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

On 13:03 Thu 23 Apr , Igor Munkin wrote:
> Sergey,
> 
> Thank you for the changes! Sorry for nitpicking, but I still have
> several comments regarding commit message:
> 
> | test: fix warnings spotted by luacheck
> |
> | luacheck is integrated in tarantool CI pipeline and respect .luacheckrc in
> 
> Typo: s/respect/respects/.

Updated in a branch.

> | tarantool repo, so jit global is suppressed there.
> |
> | Reviewed-by: Igor Munkin <imun@tarantool.org>
> | Co-authored-by: Igor Munkin <imun@tarantool.org>
> 
> Minor: I failed to find strict rules about the ordering misc-by tags,
> but here[1] I follows the kernel example[2] where Co-developed-by tag
> (or Co-authored-by alternative) goes prior to Reviewed-by one. I guess
> it would be nice to use a single sort order for the tags. But again, I
> find no rule and tag practice is even optional (it's not mentioned in
> our contributors guide), so feel free to ignore this comment.

Perhaps it make sense. Updated in a branch.

<snipped>

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

* Re: [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in sergeyb
@ 2020-04-23 11:40   ` Igor Munkin
  2020-04-24  8:02     ` Sergey Bronnikov
  0 siblings, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-23 11:40 UTC (permalink / raw)
  To: sergeyb; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Sergey,

Thanks for the patch, LGTM!

On 21.04.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Closes #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 ++
>  extra/dist/tarantoolctl.in | 29 +++++++++++++----------------
>  2 files changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 2683c8c26..0b7dc2dfe 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -24,3 +24,5 @@ exclude_files = {
>      ".rocks/**/*.lua",
>      ".git/**/*.lua",
>  }
> +
> +files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}

Side note: Please file a follow-up issue to fix a single (W122) warning:
| extra/dist/tarantoolctl.in:217:5: (W122) setting read-only field ? of global arg

<snipped>

> -- 
> 2.23.0
> 

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 4/10] Fix luacheck warnings in src/lua/
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 4/10] Fix luacheck warnings in src/lua/ sergeyb
@ 2020-04-23 14:13   ` Igor Munkin
  2020-04-24  9:12     ` Sergey Bronnikov
  0 siblings, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-23 14:13 UTC (permalink / raw)
  To: sergeyb; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Sergey,

Thanks for the patch! I left several comments below, please consider
them.

On 21.04.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Closes #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            |  3 ++
>  src/lua/argparse.lua   |  6 ++--
>  src/lua/buffer.lua     |  4 +--
>  src/lua/clock.lua      |  2 +-
>  src/lua/crypto.lua     |  4 +--
>  src/lua/csv.lua        |  5 ++-
>  src/lua/digest.lua     |  2 +-
>  src/lua/env.lua        |  2 +-
>  src/lua/fiber.lua      |  4 +--
>  src/lua/fio.lua        | 25 +++++++-------
>  src/lua/help.lua       |  7 ++--
>  src/lua/httpc.lua      |  3 --
>  src/lua/init.lua       |  7 ++--
>  src/lua/msgpackffi.lua | 22 +++++--------
>  src/lua/socket.lua     | 65 ++++++++++++++++++-------------------
>  src/lua/string.lua     |  1 -
>  src/lua/swim.lua       | 10 +++---
>  src/lua/tap.lua        | 74 ++++++++++++++++++++----------------------
>  src/lua/trigger.lua    |  3 --
>  19 files changed, 117 insertions(+), 132 deletions(-)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 0b7dc2dfe..60aedc842 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -26,3 +26,6 @@ exclude_files = {
>  }
>  
>  files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
> +files["src/lua/swim.lua"] = {ignore = {"431"}}
> +files["src/lua/fio.lua"] = {ignore = {"231"}}
> +files["src/lua/init.lua"] = {globals = {"dostring"}}

There are several "(W212) unused argument self" warnings for crypto.lua
(and other chunks like digest.lua, errno.lua, etc), but no corresponding
suppression in .luacheckrc like the one you added for tarantoolctl.in in
the previous patch.

Furthermore I see no reason to leave suppressions list unsorted.

> diff --git a/src/lua/argparse.lua b/src/lua/argparse.lua
> index faa0ae130..f58985425 100644
> --- a/src/lua/argparse.lua
> +++ b/src/lua/argparse.lua
> @@ -90,8 +90,8 @@ local function convert_parameter(name, convert_from, convert_to)
>      return convert_from
>  end
>  
> -local function parameters_parse(t_in, options)
> -    local t_out, t_in = {}, t_in or {}
> +local function parameters_parse(t__in, options)
> +    local t_out, t_in = {}, t__in or {}

Moved the related thread from v3 series review[1]:
| > > diff --git a/src/lua/argparse.lua b/src/lua/argparse.lua
| > > index faa0ae130..f58985425 100644
| > > --- a/src/lua/argparse.lua
| > > +++ b/src/lua/argparse.lua
| > > @@ -90,8 +90,8 @@ local function convert_parameter(name, convert_from, convert_to)
| > >      return convert_from
| > >  end
| > >
| > > -local function parameters_parse(t_in, options)
| > > -    local t_out, t_in = {}, t_in or {}
| > > +local function parameters_parse(t__in, options)
| > > +    local t_out, t_in = {}, t__in or {}
| >
| > I guess you can just give t__in a proper name, e.g. args, params, etc.
|
| Agree with you, replaced it with 'param'.
|

I see no corresponding changes in v4.

>  
>      -- Prepare a lookup table for options. An option name -> a
>      -- type name to convert a parameter into or true (which means

<snipped>

> diff --git a/src/lua/fio.lua b/src/lua/fio.lua
> index 83fddaa0a..b2b4b4c77 100644
> --- a/src/lua/fio.lua
> +++ b/src/lua/fio.lua

<snipped>

> @@ -407,20 +407,20 @@ fio.rmtree = function(path)
>      if type(path) ~= 'string' then
>          error("Usage: fio.rmtree(path)")
>      end
> -    local status, err
> +    local status

This was also mentioned in the v3 series review[2]:
| This value is unused (and the corresponding warning is reported).
| Consider the changes below:
|
| ================================================================================
|
| diff --git a/src/lua/fio.lua b/src/lua/fio.lua
| index b2b4b4c77..e271eccf6 100644
| --- a/src/lua/fio.lua
| +++ b/src/lua/fio.lua
| @@ -407,7 +407,6 @@ fio.rmtree = function(path)
|      if type(path) ~= 'string' then
|          error("Usage: fio.rmtree(path)")
|      end
| -    local status
|      path = fio.abspath(path)
|      local ls, err = fio.listdir(path)
|      if err ~= nil then
| @@ -427,7 +426,8 @@ fio.rmtree = function(path)
|              end
|          end
|      end
| -    status, err = fio.rmdir(path)
| +    local _
| +    _, err = fio.rmdir(path)
|      if err ~= nil then
|          return false, string.format("failed to remove %s: %s", path, err)
|      end
|
| ================================================================================

I see no reason to suppress it in the .luacheckrc instead of fixing a
single occurense.

>      path = fio.abspath(path)
>      local ls, err = fio.listdir(path)
>      if err ~= nil then
>          return nil, err
>      end
> -    for i, f in ipairs(ls) do
> +    for _, f in ipairs(ls) do
>          local tmppath = fio.pathjoin(path, f)
>          local st = fio.lstat(tmppath)
>          if st then
>              if st:is_dir() then
> -                st, err = fio.rmtree(tmppath)
> +                _, err = fio.rmtree(tmppath)
>              else
> -                st, err = fio.unlink(tmppath)
> +                _, err = fio.unlink(tmppath)
>              end
>              if err ~= nil  then
>                  return nil, err

<snipped>

> diff --git a/src/lua/help.lua b/src/lua/help.lua
> index 54ff1b5d0..1b822828b 100644
> --- a/src/lua/help.lua
> +++ b/src/lua/help.lua

<snipped>

> @@ -22,7 +19,7 @@ setmetatable(help, { __call = help_call })
>  
>  local screen_id = 1;
>  
> -local function tutorial_call(table, action)
> +local function tutorial_call(action)

This change breaks the behaviour. Consider the following:
| $ ./src/tarantool
| Tarantool 2.4.0-192-g89f3b427d
| type 'help' for interactive help
| tarantool> tutorial('start')
| ---
| - error: 'builtin/help.lua:32: Usage: tutorial("start" | "next" | "prev" | 1 .. 20)'
| ...
|
| tarantool> getmetatable(tutorial).__call('start')
| ---
| - |
|   Tutorial -- Screen #1 -- Hello, Moon
|   ====================================
|
|   Welcome to the Tarantool tutorial.
|   It will introduce you to Tarantool’s Lua application server
|   and database server, which is what’s running what you’re seeing.
|   This is INTERACTIVE -- you’re expected to enter requests
|   based on the suggestions or examples in the screen’s text.
|
|   The first request is:
|
|   5.1, "Olá", "Lua"
|   ------------------
|
|   This isn’t your grandfather’s "Hello World" ...
|   the decimal literal 5.1 and the two strings inside
|   single quotes ("Hello Moon" in Portuguese) will just
|   be repeated, without need for a print() statement.
|
|   Take that one-line request and enter it below after the
|   "tarantool>" prompt, then type Enter.
|   You’ll see the response:
|   ---
|   - 5.1
|   - Olá
|   - Lua
|   ...
|   Then you’ll get a chance to repeat -- perhaps entering
|   something else such as "Longer String",-1,-3,0.
|   When you’re ready to go to the next screen, enter <tutorial("next")>.
| ...
|
| tarantool>

Long story short: table arg is similar to self here (see more here[3])
and cannot be simply dropped. Nevertheless it looks more convenient to
replace it with self.

I guess it would be nice to add a test for it (or at least file a
follow-up issue requesting the test).

>      if action == 'start' then
>          screen_id = 1;
>      elseif action == 'next' or action == 'more' then

<snipped>

> -- 
> 2.23.0
> 

[1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-April/016113.html
[2]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-April/016022.html
[3]: https://www.lua.org/manual/5.1/manual.html#2.8

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/ sergeyb
@ 2020-04-23 22:54   ` Igor Munkin
  2020-05-07 10:32     ` Sergey Bronnikov
  2020-05-07 10:52     ` Sergey Bronnikov
  0 siblings, 2 replies; 39+ messages in thread
From: Igor Munkin @ 2020-04-23 22:54 UTC (permalink / raw)
  To: sergeyb; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Sergey,

Thanks for the patch! Please consider the comments I left below.

On 21.04.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Closes #4681
> 
> Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> ---
>  .luacheckrc                     |  8 ++++++++
>  src/box/lua/console.lua         |  6 +++---
>  src/box/lua/feedback_daemon.lua |  2 +-
>  src/box/lua/key_def.lua         |  2 +-
>  src/box/lua/load_cfg.lua        | 25 +++++++++++------------
>  src/box/lua/net_box.lua         | 26 ++++++++----------------
>  src/box/lua/schema.lua          | 35 ++++++++++++++++-----------------
>  src/box/lua/tuple.lua           |  8 +++-----
>  src/box/lua/upgrade.lua         | 19 +++++++++---------
>  9 files changed, 62 insertions(+), 69 deletions(-)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 60aedc842..64692b27c 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -25,7 +25,15 @@ exclude_files = {
>      ".git/**/*.lua",
>  }
>  
> +files["**/*.lua"] = {
> +    globals = {"box", "_TARANTOOL", "help", "tutorial"},
> +    ignore = {"212/self", "122"}
> +}

Well, I can't figure out why these global suppressions are set in this
patch. By the way these suppressions don't work for
extra/dist/tarantoolctl.in.

Furthermore, IMHO, global suppression for (W122)[Setting a read-only
field of a global variable] is a bad practice.

>  files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
>  files["src/lua/swim.lua"] = {ignore = {"431"}}
>  files["src/lua/fio.lua"] = {ignore = {"231"}}
>  files["src/lua/init.lua"] = {globals = {"dostring"}}
> +files["src/box/lua/console.lua"] = {ignore = {"212"}}

What is the reason to fix 3 (W211)[Unused local variable] warnings, but
leave and suppress 9 (W212)[Unused argument] warnings (at the same time
you fix this type of warnings in load_cfg.lua)?

> +files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}

It's a single empty branch warning, why it can't be fixed / suppressed
inline? Here is the diff:

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

diff --git a/.luacheckrc b/.luacheckrc
index 64692b27c..0c1f85766 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -29,11 +29,11 @@ files["**/*.lua"] = {
     globals = {"box", "_TARANTOOL", "help", "tutorial"},
     ignore = {"212/self", "122"}
 }
+
 files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
 files["src/lua/swim.lua"] = {ignore = {"431"}}
 files["src/lua/fio.lua"] = {ignore = {"231"}}
 files["src/lua/init.lua"] = {globals = {"dostring"}}
 files["src/box/lua/console.lua"] = {ignore = {"212"}}
-files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
 files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
 files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
index 0926c7380..38c128e85 100644
--- a/src/box/lua/load_cfg.lua
+++ b/src/box/lua/load_cfg.lua
@@ -414,7 +414,7 @@ local function prepare_cfg(cfg, default_cfg, template_cfg, modify_cfg, prefix)
         elseif v == "" or v == nil then
             -- "" and NULL = ffi.cast('void *', 0) set option to default value
             v = default_cfg[k]
-        elseif template_cfg[k] == 'any' then
+        elseif template_cfg[k] == 'any' then -- luacheck: ignore
             -- any type is ok
         elseif type(template_cfg[k]) == 'table' then
             if type(v) ~= 'table' then

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

> +files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}

Again, I see suppressed (W212)[Unused argument] warnings *but*:
* they are well localized
* most of them will *never* be fixed and should be commented and
  protected from inquisitive persons
* others can be fixed with a trivial changes

Here is the diff:

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

diff --git a/.luacheckrc b/.luacheckrc
index 64692b27c..b05260d29 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -35,5 +35,5 @@ files["src/lua/fio.lua"] = {ignore = {"231"}}
 files["src/lua/init.lua"] = {globals = {"dostring"}}
 files["src/box/lua/console.lua"] = {ignore = {"212"}}
 files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
-files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
+files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411"}}
 files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
index 1e351bb31..8b3802749 100644
--- a/src/box/lua/net_box.lua
+++ b/src/box/lua/net_box.lua
@@ -56,18 +56,18 @@ local E_PROC_LUA             = box.error.PROC_LUA
 -- utility tables
 local is_final_state         = {closed = 1, error = 1}
 
-local function decode_nil(raw_data, raw_data_end)
+local function decode_nil(raw_data, raw_data_end) -- luacheck: no unused args
     return nil, raw_data_end
 end
 local function decode_data(raw_data)
     local response, raw_end = decode(raw_data)
     return response[IPROTO_DATA_KEY], raw_end
 end
-local function decode_tuple(raw_data, raw_data_end, format)
+local function decode_tuple(raw_data, raw_data_end, format) -- luacheck: no unused args
     local response, raw_end = internal.decode_select(raw_data, nil, format)
     return response[1], raw_end
 end
-local function decode_get(raw_data, raw_data_end, format)
+local function decode_get(raw_data, raw_data_end, format) -- luacheck: no unused args
     local body, raw_end = internal.decode_select(raw_data, nil, format)
     if body[2] then
         return nil, raw_end, box.error.MORE_THAN_ONE_TUPLE
@@ -110,7 +110,7 @@ local method_encoder = {
     max     = internal.encode_select,
     count   = internal.encode_call,
     -- inject raw data into connection, used by console and tests
-    inject = function(buf, id, bytes)
+    inject = function(buf, id, bytes) -- luacheck: no unused args
         local ptr = buf:reserve(#bytes)
         ffi.copy(ptr, bytes, #bytes)
         buf.wpos = ptr + #bytes
@@ -176,7 +176,7 @@ end
 -- Default action on push during a synchronous request -
 -- ignore.
 --
-local function on_push_sync_default(...) end
+local function on_push_sync_default() end
 
 --
 -- Basically, *transport* is a TCP connection speaking one of
@@ -1216,7 +1216,7 @@ function remote_methods:execute(query, parameters, sql_opts, netbox_opts)
                          sql_opts or {})
 end
 
-function remote_methods:prepare(query, parameters, sql_opts, netbox_opts)
+function remote_methods:prepare(query, parameters, sql_opts, netbox_opts) -- luacheck: no unused args
     check_remote_arg(self, "prepare")
     if type(query) ~= "string" then
         box.error(box.error.SQL_PREPARE, "expected string as SQL statement")
@@ -1581,7 +1581,7 @@ this_module.self = {
     timeout = function(self) return self end,
     wait_connected = function(self) return true end,
     is_connected = function(self) return true end,
-    call = function(_box, proc_name, args, opts)
+    call = function(_box, proc_name, args)
         check_remote_arg(_box, 'call')
         check_call_args(args)
         args = args or {}
@@ -1598,7 +1598,7 @@ this_module.self = {
             return handle_eval_result(pcall(proc, unpack(args)))
         end
     end,
-    eval = function(_box, expr, args, opts)
+    eval = function(_box, expr, args)
         check_remote_arg(_box, 'eval')
         check_eval_args(args)
         args = args or {}

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

Moreover a single (W231)[Local variable is set but never accessed]
warning is also supressed (but you fixed others in this file). Here is
the diff:

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

diff --git a/.luacheckrc b/.luacheckrc
index 64692b27c..b23ebfc60 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -35,5 +35,5 @@ files["src/lua/fio.lua"] = {ignore = {"231"}}
 files["src/lua/init.lua"] = {globals = {"dostring"}}
 files["src/box/lua/console.lua"] = {ignore = {"212"}}
 files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
-files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
+files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "411", "212"}}
 files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
index 1e351bb31..bcfec92bc 100644
--- a/src/box/lua/net_box.lua
+++ b/src/box/lua/net_box.lua
@@ -749,13 +749,12 @@ local function create_transport(host, port, user, password, callback,
             return iproto_schema_sm()
         end
         encode_auth(send_buf, new_request_id(), user, password, salt)
-        local err, hdr, body_rpos, body_end = send_and_recv_iproto()
+        local err, hdr, body_rpos = send_and_recv_iproto()
         if err then
             return error_sm(err, hdr)
         end
         if hdr[IPROTO_STATUS_KEY] ~= 0 then
-            local body
-            body, body_end = decode(body_rpos)
+            local body = decode(body_rpos)
             return error_sm(E_NO_CONNECTION, body[IPROTO_ERROR_KEY])
         end
         set_state('fetch_schema')

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

> +files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}

Again, it's a single empty branch warning, that can be suppressed
inline. Here is the diff:

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

diff --git a/.luacheckrc b/.luacheckrc
index 64692b27c..fa715fded 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -36,4 +36,4 @@ files["src/lua/init.lua"] = {globals = {"dostring"}}
 files["src/box/lua/console.lua"] = {ignore = {"212"}}
 files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
 files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
-files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
+files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "212"}}
diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
index de47b807e..5fad272ab 100644
--- a/src/box/lua/schema.lua
+++ b/src/box/lua/schema.lua
@@ -259,7 +259,7 @@ local function check_param_table(table, template)
         if template[k] == nil then
             box.error(box.error.ILLEGAL_PARAMS,
                       "unexpected option '" .. k .. "'")
-        elseif template[k] == 'any' then
+        elseif template[k] == 'any' then -- luacheck: ignore
             -- any type is ok
         elseif (string.find(template[k], ',') == nil) then
             -- one type

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

And the following simple diff fixes all remaining (W212)[Unused
argument] warnings reported for schema.lua:

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

diff --git a/.luacheckrc b/.luacheckrc
index 64692b27c..bfe144f64 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -36,4 +36,4 @@ files["src/lua/init.lua"] = {globals = {"dostring"}}
 files["src/box/lua/console.lua"] = {ignore = {"212"}}
 files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
 files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
-files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
+files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542"}}
diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
index de47b807e..537443eeb 100644
--- a/src/box/lua/schema.lua
+++ b/src/box/lua/schema.lua
@@ -1229,12 +1229,12 @@ end
 
 local iterator_t = ffi.typeof('struct iterator')
 ffi.metatype(iterator_t, {
-    __tostring = function(iterator)
+    __tostring = function()
         return "<iterator state>"
     end;
 })
 
-local iterator_gen = function(param, state)
+local iterator_gen = function(param, state) -- luacheck: no unused args
     --[[
         index:pairs() mostly conforms to the Lua for-in loop conventions and
         tries to follow the best practices of Lua community.
@@ -1268,7 +1268,7 @@ local iterator_gen = function(param, state)
     end
 end
 
-local iterator_gen_luac = function(param, state)
+local iterator_gen_luac = function(param, state) -- luacheck: no unused args
     local tuple = internal.iterator_next(state)
     if tuple ~= nil then
         return state, tuple -- new state, value
@@ -1773,9 +1773,9 @@ local function wrap_schema_object_mt(name)
         __pairs = global_mt.__pairs
     }
     local mt_mt = {}
-    mt_mt.__newindex = function(t, k, v)
+    mt_mt.__newindex = function(self, k, v)
         mt_mt.__newindex = nil
-        mt.__index = function(t, k)
+        mt.__index = function(self, k)
             return mt[k] or box.schema[name][k]
         end
         rawset(mt, k, v)
@@ -2484,7 +2484,7 @@ local function revoke(uid, name, privilege, object_type, object_name, options)
     end
 end
 
-local function drop(uid, opts)
+local function drop(uid)
     -- recursive delete of user data
     local _vpriv = box.space[box.schema.VPRIV_ID]
     local spaces = box.space[box.schema.VSPACE_ID].index.owner:select{uid}
@@ -2563,7 +2563,7 @@ box.schema.user.drop = function(name, opts)
             box.error(box.error.DROP_USER, name,
                       "the user is active in the current session")
         end
-        return drop(uid, opts)
+        return drop(uid)
     end
     if not opts.if_exists then
         box.error(box.error.NO_SUCH_USER, name)

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

<snipped>

> diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
> index 07fa54c38..1e351bb31 100644
> --- a/src/box/lua/net_box.lua
> +++ b/src/box/lua/net_box.lua

<snipped>

> @@ -425,7 +421,7 @@ local function create_transport(host, port, user, password, callback,
>          state = new_state
>          last_errno = new_errno
>          last_error = new_error
> -        callback('state_changed', new_state, new_errno, new_error)
> +        callback('state_changed', new_state, new_error)

Please adjust the corresponding comment.

>          state_cond:broadcast()
>          if state == 'error' or state == 'error_reconnect' or
>             state == 'closed' then

<snipped>

> @@ -954,7 +945,7 @@ local function new_sm(host, port, opts, connection, greeting)
>      local remote = {host = host, port = port, opts = opts, state = 'initial'}
>      local function callback(what, ...)
>          if what == 'state_changed' then
> -            local state, errno, err = ...
> +            local state, err = ...
>              local was_connected = remote._is_connected
>              if state == 'active' then
>                  if not was_connected then
> diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
> index 85fcca562..de47b807e 100644
> --- a/src/box/lua/schema.lua
> +++ b/src/box/lua/schema.lua

<snipped>

> @@ -582,9 +580,9 @@ end
>  --
>  local function format_field_resolve(format, path, what)
>      assert(type(path) == 'number' or type(path) == 'string')
> -    local idx = nil
> +    local idx
>      local relative_path = nil
> -    local field_name = nil
> +    local field_name

You can simply move it down to its initialization.

>      -- Path doesn't require resolve.
>      if type(path) == 'number' then
>          idx = path

<snipped>

> -- 
> 2.23.0
> 

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 7/10] schema: fix index promotion to functional index
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 7/10] schema: fix index promotion to functional index sergeyb
@ 2020-04-23 23:24   ` Igor Munkin
  2020-04-23 23:29     ` Igor Munkin
  0 siblings, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-23 23:24 UTC (permalink / raw)
  To: sergeyb; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Vlad,

Thanks for the patch! I'm glad we found and fixedseveral bugs as a
result of luacheck activity. LGTM (I guess this patch can be also pushed
out of order along with the following one).

On 21.04.20, sergeyb@tarantool.org wrote:
> From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> 
> When index:alter() was called on a non-functional index with
> specified 'func', it led to accessing a not declared variable in
> schema.lua.
> ---
>  src/box/lua/schema.lua          |  2 +-
>  test/engine/func_index.result   | 36 +++++++++++++++++++++++++++++++++
>  test/engine/func_index.test.lua | 14 +++++++++++++
>  3 files changed, 51 insertions(+), 1 deletion(-)
> 

<snipped>

> -- 
> 2.23.0
> 

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G
  2020-04-21 19:52   ` Igor Munkin
@ 2020-04-23 23:27     ` Igor Munkin
  2020-04-28 23:19       ` Vladislav Shpilevoy
  0 siblings, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-23 23:27 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: o.piskunov, tarantool-patches

I don't know whether this patch needs a ChangeLog entry, but it's
missing here.

On 21.04.20, Igor Munkin wrote:
> Vlad,
> 
> Thanks for the patch! LGTM (feel free to push out of order as obvious).
> 
> Side note: I don't know whether we need a test for it (a simple lookup
> for <update_format> and <role_check_grant_revoke_of_sys_priv> in _G) but
> on the second thought it looks excess and out of the common practice.
> 
> On 21.04.20, sergeyb@tarantool.org wrote:
> > From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> > 
> > A couple of functions were mistakenly declared as 'function'
> > instead of 'local function' in schema.lua. That led to their
> > presence in the global namespace.
> > ---
> >  src/box/lua/schema.lua | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> 
> <snipped>
> 
> > -- 
> > 2.23.0
> > 
> 
> -- 
> Best regards,
> IM

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 7/10] schema: fix index promotion to functional index
  2020-04-23 23:24   ` Igor Munkin
@ 2020-04-23 23:29     ` Igor Munkin
  2020-04-28 23:19       ` Vladislav Shpilevoy
  0 siblings, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-23 23:29 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: o.piskunov, tarantool-patches

I don't know whether this patch needs a ChangeLog entry, but it's
missing here.

On 24.04.20, Igor Munkin wrote:
> Vlad,
> 
> Thanks for the patch! I'm glad we found and fixedseveral bugs as a
> result of luacheck activity. LGTM (I guess this patch can be also pushed
> out of order along with the following one).
> 
> On 21.04.20, sergeyb@tarantool.org wrote:
> > From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> > 
> > When index:alter() was called on a non-functional index with
> > specified 'func', it led to accessing a not declared variable in
> > schema.lua.
> > ---
> >  src/box/lua/schema.lua          |  2 +-
> >  test/engine/func_index.result   | 36 +++++++++++++++++++++++++++++++++
> >  test/engine/func_index.test.lua | 14 +++++++++++++
> >  3 files changed, 51 insertions(+), 1 deletion(-)
> > 
> 
> <snipped>
> 
> > -- 
> > 2.23.0
> > 
> 
> -- 
> Best regards,
> IM

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in
  2020-04-23 11:40   ` Igor Munkin
@ 2020-04-24  8:02     ` Sergey Bronnikov
  0 siblings, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-04-24  8:02 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

On 14:40 Thu 23 Apr , Igor Munkin wrote:

<snipped>
> > +files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
> 
> Side note: Please file a follow-up issue to fix a single (W122) warning:
> | extra/dist/tarantoolctl.in:217:5: (W122) setting read-only field ? of global arg

https://github.com/tarantool/tarantool/issues/4929

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

* Re: [Tarantool-patches] [PATCH v4 4/10] Fix luacheck warnings in src/lua/
  2020-04-23 14:13   ` Igor Munkin
@ 2020-04-24  9:12     ` Sergey Bronnikov
  0 siblings, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-04-24  9:12 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Igor,

On 17:13 Thu 23 Apr , Igor Munkin wrote:
> Sergey,
> 
> Thanks for the patch! I left several comments below, please consider
> them.
> 
> On 21.04.20, sergeyb@tarantool.org wrote:
> > From: Sergey Bronnikov <sergeyb@tarantool.org>

<snipped>

> >  files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
> > +files["src/lua/swim.lua"] = {ignore = {"431"}}
> > +files["src/lua/fio.lua"] = {ignore = {"231"}}
> > +files["src/lua/init.lua"] = {globals = {"dostring"}}
> 
> There are several "(W212) unused argument self" warnings for crypto.lua
> (and other chunks like digest.lua, errno.lua, etc), but no corresponding
> suppression in .luacheckrc like the one you added for tarantoolctl.in in
> the previous patch.
>
> Furthermore I see no reason to leave suppressions list unsorted.

Added supression 212/self for file mask "src/lua/*.lua" and sorted
list. Changes pushed to a branch.

<snipped>

> | > > -local function parameters_parse(t_in, options)
> | > > -    local t_out, t_in = {}, t_in or {}
> | > > +local function parameters_parse(t__in, options)
> | > > +    local t_out, t_in = {}, t__in or {}
> | >
> | > I guess you can just give t__in a proper name, e.g. args, params, etc.
> |
> | Agree with you, replaced it with 'param'.
> |
> 
> I see no corresponding changes in v4.

Applied again and updated in a branch.

<snipped>

> This was also mentioned in the v3 series review[2]:
> | This value is unused (and the corresponding warning is reported).
> | Consider the changes below:
> |
> | ================================================================================
> |
> | diff --git a/src/lua/fio.lua b/src/lua/fio.lua
> | index b2b4b4c77..e271eccf6 100644
> | --- a/src/lua/fio.lua
> | +++ b/src/lua/fio.lua
> | @@ -407,7 +407,6 @@ fio.rmtree = function(path)
> |      if type(path) ~= 'string' then
> |          error("Usage: fio.rmtree(path)")
> |      end
> | -    local status
> |      path = fio.abspath(path)
> |      local ls, err = fio.listdir(path)
> |      if err ~= nil then
> | @@ -427,7 +426,8 @@ fio.rmtree = function(path)
> |              end
> |          end
> |      end
> | -    status, err = fio.rmdir(path)
> | +    local _
> | +    _, err = fio.rmdir(path)
> |      if err ~= nil then
> |          return false, string.format("failed to remove %s: %s", path, err)
> |      end
> |
> | ================================================================================
> 
> I see no reason to suppress it in the .luacheckrc instead of fixing a
> single occurense.

Fixed and pushed to a branch too.

<snipped>

> > --- a/src/lua/help.lua
> > +++ b/src/lua/help.lua
> 
> <snipped>
> 
> > @@ -22,7 +19,7 @@ setmetatable(help, { __call = help_call })
> >  
> >  local screen_id = 1;
> >  
> > -local function tutorial_call(table, action)
> > +local function tutorial_call(action)
> 
> This change breaks the behaviour. Consider the following:
> | $ ./src/tarantool
> | Tarantool 2.4.0-192-g89f3b427d
> | type 'help' for interactive help
> | tarantool> tutorial('start')
> | ---
> | - error: 'builtin/help.lua:32: Usage: tutorial("start" | "next" | "prev" | 1 .. 20)'
> | ...
> |
> | tarantool> getmetatable(tutorial).__call('start')
> | ---
> | - |
> |   Tutorial -- Screen #1 -- Hello, Moon
> |   ====================================
> |
> |   Welcome to the Tarantool tutorial.
> |   It will introduce you to Tarantool’s Lua application server
> |   and database server, which is what’s running what you’re seeing.
> |   This is INTERACTIVE -- you’re expected to enter requests
> |   based on the suggestions or examples in the screen’s text.
> |
> |   The first request is:
> |
> |   5.1, "Olá", "Lua"
> |   ------------------
> |
> |   This isn’t your grandfather’s "Hello World" ...
> |   the decimal literal 5.1 and the two strings inside
> |   single quotes ("Hello Moon" in Portuguese) will just
> |   be repeated, without need for a print() statement.
> |
> |   Take that one-line request and enter it below after the
> |   "tarantool>" prompt, then type Enter.
> |   You’ll see the response:
> |   ---
> |   - 5.1
> |   - Olá
> |   - Lua
> |   ...
> |   Then you’ll get a chance to repeat -- perhaps entering
> |   something else such as "Longer String",-1,-3,0.
> |   When you’re ready to go to the next screen, enter <tutorial("next")>.
> | ...
> |
> | tarantool>
> 
> Long story short: table arg is similar to self here (see more here[3])
> and cannot be simply dropped. Nevertheless it looks more convenient to
> replace it with self.

replaced 'table' argument by 'self'. tutorial('start') works as exprected.

> I guess it would be nice to add a test for it (or at least file a
> follow-up issue requesting the test).

https://github.com/tarantool/tarantool/issues/4930

<snipped>

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

* Re: [Tarantool-patches] [PATCH v4 9/10] Disabled test/luajit-tap in luacheckrc
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 9/10] Disabled test/luajit-tap in luacheckrc sergeyb
@ 2020-04-24 10:16   ` Igor Munkin
  2020-04-29 14:25     ` Sergey Bronnikov
  0 siblings, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-24 10:16 UTC (permalink / raw)
  To: sergeyb; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Sergey,

Thanks for the patch, but it looks irrelevant. Just apply the last patch
in the series, bump luajit submodule before applying all other patches
and suppress jit global variable. I guess this patch can be discarded.

On 21.04.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> temporarily disabled luajit-tap tests while patch with fixes not applied
> ---
>  .luacheckrc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index cec1f4ffe..b8ee14b50 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -19,6 +19,7 @@ exclude_files = {
>      "test/xlog/*.lua",
>      "test/wal_off/*.lua",
>      "test/var/**/*.lua",
> +    "test/luajit-tap",
>      "test-run/**/*.lua",
>      "third_party/**/*.lua",
>      ".rocks/**/*.lua",
> -- 
> 2.23.0
> 

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 6/10] Fix luacheck warnings in test/
  2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 6/10] Fix luacheck warnings in test/ sergeyb
@ 2020-04-27 14:38   ` Igor Munkin
  2020-05-06 16:16     ` Sergey Bronnikov
  0 siblings, 1 reply; 39+ messages in thread
From: Igor Munkin @ 2020-04-27 14:38 UTC (permalink / raw)
  To: sergeyb; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Sergey,

Thanks for the patch! I didn't finish the review, but I'm not going to
continue with this version (the reason is at the bottom of my reply).
However I left several comments for the part I've checked, please
consider them.

On 21.04.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Closes #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                                   |  34 ++++++
>  test/app-tap/cfg.test.lua                     |   2 +-
>  test/app-tap/clock.test.lua                   |   4 +-
>  test/app-tap/console.test.lua                 |  15 +--
>  test/app-tap/console_lua.test.lua             |  22 ++--
>  test/app-tap/csv.test.lua                     |  56 ++++-----
>  test/app-tap/debug.test.lua                   |  10 +-
>  test/app-tap/errno.test.lua                   |   6 +-
>  test/app-tap/fail_main.test.lua               |   6 +-
>  .../gh-4761-json-per-call-options.test.lua    |  11 +-
>  test/app-tap/http_client.test.lua             |  54 ++++-----
>  test/app-tap/iconv.test.lua                   |   6 +-
>  test/app-tap/init_script.test.lua             |  14 +--
>  test/app-tap/inspector.test.lua               |   6 +-
>  test/app-tap/json.test.lua                    |   1 -
>  test/app-tap/logger.test.lua                  |  23 ++--
>  test/app-tap/minimal.test.lua                 |   4 +-
>  test/app-tap/module_api.test.lua              |  11 +-
>  test/app-tap/msgpackffi.test.lua              |   3 +-
>  test/app-tap/pcall.test.lua                   |   6 +-
>  test/app-tap/snapshot.test.lua                |  17 ++-
>  test/app-tap/string.test.lua                  |  54 ++++-----
>  test/app-tap/tap.test.lua                     |  26 ++--
>  test/app-tap/tarantoolctl.test.lua            |  76 ++++++------
>  test/app-tap/trigger.test.lua                 |  20 ++--
>  test/app-tap/yaml.test.lua                    |  16 +--
>  test/box-py/box.lua                           |   2 +-
>  test/box-tap/auth.test.lua                    |  36 +++---
>  test/box-tap/cfg.test.lua                     |  34 +++---
>  test/box-tap/cfgup.test.lua                   |   2 +-
>  test/box-tap/feedback_daemon.test.lua         |   4 +-
>  test/box-tap/gc.test.lua                      |   6 +-
>  test/box-tap/key_def.test.lua                 |  58 ++++-----
>  test/box-tap/merger.test.lua                  | 112 +++++++++---------
>  test/box-tap/on_schema_init.test.lua          |   4 +-
>  test/box-tap/schema_mt.test.lua               |  18 +--
>  test/box-tap/session.storage.test.lua         |  10 +-
>  test/box-tap/session.test.lua                 |  59 ++++-----
>  test/box-tap/trigger_atexit.test.lua          |  10 +-
>  test/box-tap/trigger_yield.test.lua           |  10 +-
>  test/box/box.lua                              |   2 +-
>  test/box/hash_multipart.result                |   2 +-
>  test/box/hash_multipart.test.lua              |   2 +-
>  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                    |   4 +-
>  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/require_init.lua                 |   3 -
>  test/box/lua/test_init.lua                    |  10 +-
>  test/box/lua/utils.lua                        |  13 +-
>  test/box/on_schema_init.lua                   |   2 +-
>  test/box/proxy.lua                            |   2 +-
>  test/box/tiny.lua                             |   2 +-
>  test/box/tree_pk.result                       |   4 +-
>  test/box/tree_pk.test.lua                     |   4 +-
>  test/engine/tree_min_max_count.result         |   2 +-
>  test/engine/tree_min_max_count.test.lua       |   2 +-
>  test/engine_long/suite.lua                    |   4 +-
>  test/long_run-py/lua/finalizers.lua           |   8 +-
>  test/long_run-py/suite.lua                    |   6 +-
>  test/replication-py/master.lua                |   2 +-
>  test/replication-py/panic.lua                 |   2 +-
>  test/replication-py/replica.lua               |   4 -
>  test/replication/lua/fast_replica.lua         |   3 +-
>  test/replication/lua/rlimit.lua               |   2 +-
>  test/replication/master.lua                   |   2 +-
>  test/replication/replicaset_ro_mostly.result  |   2 +-
>  .../replication/replicaset_ro_mostly.test.lua |   2 +-
>  test/sql-tap/alter.test.lua                   |   4 +-
>  test/sql-tap/analyze3.test.lua                |   6 +-
>  test/sql-tap/analyze5.test.lua                |   2 +-
>  test/sql-tap/analyze9.test.lua                |  30 ++---
>  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                  |  22 ++--
>  test/sql-tap/func.test.lua                    |   2 +-
>  test/sql-tap/func3.test.lua                   |  24 ++--
>  test/sql-tap/gh-2723-concurrency.test.lua     |   8 +-
>  .../gh-3083-ephemeral-unref-tuples.test.lua   |   2 +-
>  .../gh-3307-xfer-optimization-issue.test.lua  |  16 +--
>  .../gh-3332-tuple-format-leak.test.lua        |   2 +-
>  .../gh-4077-iproto-execute-no-bind.test.lua   |   7 +-
>  .../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                |  28 ++---
>  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/tkt-fa7bf5ec.test.lua            |   6 +-
>  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/sql/savepoints.result                    |   6 +-
>  test/sql/savepoints.test.lua                  |   6 +-
>  test/sql/triggers.result                      |   2 +-
>  test/sql/triggers.test.lua                    |   2 +-
>  test/vinyl/large.lua                          |   3 +-
>  test/vinyl/txn_proxy.lua                      |   6 +-
>  test/vinyl/upgrade/fill.lua                   |   8 +-
>  test/vinyl/vinyl.lua                          |   2 +-
>  test/wal_off/rtree_benchmark.result           |   2 +-
>  test/wal_off/rtree_benchmark.test.lua         |   2 +-
>  test/xlog-py/box.lua                          |   2 +-
>  test/xlog/panic.lua                           |   2 +-
>  test/xlog/reader.result                       |   2 +-
>  test/xlog/reader.test.lua                     |   2 +-
>  test/xlog/snap_io_rate.test.lua               |   2 +-
>  test/xlog/transaction.result                  |   2 +-
>  test/xlog/transaction.test.lua                |   2 +-
>  .../2.1.3/gh-4771-upgrade-sequence/fill.lua   |  12 +-
>  test/xlog/xlog.lua                            |   2 +-
>  157 files changed, 704 insertions(+), 740 deletions(-)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 64692b27c..cec1f4ffe 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -37,3 +37,37 @@ files["src/box/lua/console.lua"] = {ignore = {"212"}}
>  files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
>  files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
>  files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
> +files["test/app/lua/fiber.lua"] = {globals = {"box_fiber_run_test"}}

test/app/{app,loaders}.lua are also Lua source files and need to be
tested via luacheck.

> +files["test/app-tap/console.test.lua"] = {globals = {"long_func"}}
> +files["test/app-tap/lua/require_mod.lua"] = {globals = {"exports"}}
> +files["test/app-tap/module_api.test.lua"] = {ignore = {"311"}}

In previous review I provided a diff with fix for this class of
warnings. You've said nothing against my approaches, but fixed it on
your own way with no discussion. It's simply unproductive, because I
need to double-check all changes now.

> +files["test/app-tap/string.test.lua"] = {globals = {"utf8"}}
> +files["test/app-tap/tarantoolctl.test.lua"] = {ignore = {"113", "421"}}
> +files["test/box-tap/session.test.lua"] = {
> +	globals = {"active_connections", "session", "space", "f1", "f2"},
> +	ignore = {"211"}
> +}
> +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 = {"space_field_types", "iterate", "arithmetic", "table_shuffle",
> +	"table_generate", "tuple_to_string", "check_space", "space_bsize",
> +	"create_iterator", "setmap", "sort"}}
> +files["test/box/lua/bitset.lua"] = {
> +	globals = {"create_space", "fill", "delete", "clear", "drop_space",
> +	"dump", "test_insert_delete"}
> +}
> +files["test/box/lua/fifo.lua"] = {globals = {"fifomax", "find_or_create_fifo", "fifo_push", "fifo_top"}}
> +files["test/box/lua/identifier.lua"] = {globals = {"run_test"}}
> +files["test/box/lua/require_mod.lua"] = {globals = {"exports"}}
> +files["test/luajit-tap/gh-4476-fix-string-find-recording.test.lua"] = {ignore = {"231"}}
> +files["test/luajit-tap/or-232-unsink-64-kptr.test.lua"] = {ignore = {"542"}}

This files have to be added right after luajit submodule bump.

> +files["test/replication/lua/fast_replica.lua"] = {
> +	globals = {"join", "start_all", "stop_all", "wait_all",
> +	"drop_all", "drop_all", "vclock_diff", "unregister",
> +	"delete", "start", "stop", "call_all", "drop", "wait"},
> +	ignore = {"212", "213"}
> +}
> +files["test/sql-tap/*.lua"] = {ignore = {"611", "612", "613", "614", "621", "631", "211", "113", "111"}}
> +files["test/sql-tap/lua/sqltester.lua"] = {globals = {"table_match_regex_p"}}
> +files["test/sql-tap/e_expr.test.lua"] = {ignore = {"512"}}

<snipped>

> diff --git a/test/app-tap/console.test.lua b/test/app-tap/console.test.lua
> index 4feadfa5e..e81b48a80 100755
> --- a/test/app-tap/console.test.lua
> +++ b/test/app-tap/console.test.lua

<snipped>

> @@ -59,7 +59,7 @@ test:is(client:read(";"), 'true;', "pushed message")
>  client:write('\\set output lua\n')
>  client:read(";")
>  
> -long_func_f = nil
> +local long_func_f
>  function long_func()

Please consider the fix I proposed in previous review[1]. This warning
is a false positive and can be suppressed inline. Here is the diff:

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

diff --git a/.luacheckrc b/.luacheckrc
index cec1f4ffe..4faf770e8 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -38,7 +38,6 @@ files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
 files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
 files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
 files["test/app/lua/fiber.lua"] = {globals = {"box_fiber_run_test"}}
-files["test/app-tap/console.test.lua"] = {globals = {"long_func"}}
 files["test/app-tap/lua/require_mod.lua"] = {globals = {"exports"}}
 files["test/app-tap/module_api.test.lua"] = {ignore = {"311"}}
 files["test/app-tap/string.test.lua"] = {globals = {"utf8"}}
diff --git a/test/app-tap/console.test.lua b/test/app-tap/console.test.lua
index e81b48a80..454d5a892 100755
--- a/test/app-tap/console.test.lua
+++ b/test/app-tap/console.test.lua
@@ -60,6 +60,7 @@ client:write('\\set output lua\n')
 client:read(";")
 
 local long_func_f
+-- luacheck: globals long_func (is called via client socket)
 function long_func()
     long_func_f = fiber.self()
     box.session.push('push')

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

>      long_func_f = fiber.self()
>      box.session.push('push')

<snipped>

> diff --git a/test/app-tap/console_lua.test.lua b/test/app-tap/console_lua.test.lua
> index 3ed6aad97..263e86c54 100755
> --- a/test/app-tap/console_lua.test.lua
> +++ b/test/app-tap/console_lua.test.lua

<snipped>

> @@ -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(test_obj, client, statements, name)

Minor: I guess you can use <testcase> for argument as well as for
parameter.

> +    test_obj:test(name, function(test)
>          test:plan(2 * #statements)
>  
>          for _, stmt in ipairs(statements) do
> @@ -75,15 +75,15 @@ 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(test_obj, client, input, exp_output, name)

Minor: I guess you can use <testcase> for argument as well as for
parameter.

> +    test_obj:test(name, function(test)
>          test:plan(2)
>  
>          local res = client:write(input .. '\n')
>          test:ok(res ~= nil, ('-> [[%s]]'):format(input))
>  
>          local exp = exp_output .. EOL
> -        local res = client:read(EOL)
> +        res = client:read(EOL)
>          test:is(res, exp, ('<- [[%s]]'):format(exp:gsub('\n', '\\n')))
>      end)
>  end

<snipped>

> diff --git a/test/app-tap/errno.test.lua b/test/app-tap/errno.test.lua
> index 5fd8eaca4..4a13edf2a 100755
> --- a/test/app-tap/errno.test.lua
> +++ b/test/app-tap/errno.test.lua
> @@ -3,10 +3,10 @@
>  local tap = require('tap')
>  local errno = require('errno')
>  
> -local test = tap.test("errno")
> +local suite = tap.test("errno")
>  
> -test:plan(1)
> -test:test("primary", function(test)
> +suite:plan(1)
> +suite:test("primary", function(test)
>      test:plan(10)
>      test:is(type(errno), "table", "type of table")
>      test:ok(errno.EINVAL ~= nil, "errno.EINVAL is available")

These changes introduce a mess in naming: in previous chunks you rename
<test> argument to <testcase>, but here you decided to change naming for
the root suite. I guess you need either to adjust it to the common
naming (<test> and <testcase>) or leave the shadowing, considering this
warning is raised in many other places and we have no policy for it for
now.

<snipped>

> 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..a8c02dd2f 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}}',

Underscore can be freely omitted here (as was proposed in the previous
review[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},

Underscore can be freely omitted here (as was proposed in the previous
review[1]).

>                            {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..1c5bf853b 100755
> --- a/test/app-tap/http_client.test.lua
> +++ b/test/app-tap/http_client.test.lua
> @@ -3,13 +3,13 @@
>  local tap = require('tap')
>  local client = require('http.client')
>  local json = require('json')
> -local test = tap.test("curl")
> +local suite = tap.test("curl")

These changes introduce a mess in naming: in previous chunks you rename
<test> argument to <testcase>, but here you decided to change naming for
the root suite. I guess you need either to adjust it to the common
naming (<test> and <testcase>) or leave the shadowing, considering this
warning is raised in many other places and we have no policy for it for
now.

>  local fiber = require('fiber')
>  local socketlib = require('socket')
>  local os = require('os')
>  
>  local TARANTOOL_SRC_DIR = os.getenv("TARANTOOL_SRC_DIR") or "../.."
> -test:diag("TARANTOOL_SRC_DIR=%s", TARANTOOL_SRC_DIR)
> +suite:diag("TARANTOOL_SRC_DIR=%s", TARANTOOL_SRC_DIR)
>  
>  local function merge(...)
>      local res = {}

<snipped>

> @@ -270,7 +269,7 @@ local function test_errors(test)
>      test:ok(not status and string.find(json.encode(err),
>                          "Unsupported protocol"),
>                          "POST: exception on bad protocol")
> -    local r = http:get("http://do_not_exist_8ffad33e0cb01e6a01a03d00089e71e5b2b7e9930dfcba.ru")
> +    http:get("http://do_not_exist_8ffad33e0cb01e6a01a03d00089e71e5b2b7e9930dfcba.ru")

Why did you leave this line? What does it test?

>  end
>  
>  -- gh-3679 Check that opts.headers values can be strings only.

<snipped>

> diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua
> index 492d5ea0b..56db1d2c7 100755
> --- a/test/app-tap/logger.test.lua
> +++ b/test/app-tap/logger.test.lua
> @@ -26,7 +26,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)

Underscore can be freely omitted here (as was proposed in the previous
review[1]).

>  test:ok(not s, "plain")
>  --
>  -- gh-700: Crash on calling log.info() with formatting characters

<snipped>

> @@ -56,34 +56,34 @@ file:close()
>  
>  test:ok(log.pid() >= 0, "pid()")
>  
> --- logger uses 'debug', try to set it to nil
> -debug = nil
> +-- luacheck: ignore (logger uses 'debug', try to set it to nil)
> +local debug = nil

This change breaks the test: debug global variable need to be set to
nil, not the local one. Furthermore, the change differs to the one I've
seen in the previous branch. Has the branch been rebased?

>  log.info("debug is nil")
>  debug = require('debug')
>  

<snipped>

> diff --git a/test/app-tap/module_api.test.lua b/test/app-tap/module_api.test.lua
> index a6658cc61..e0f2bf75f 100755
> --- a/test/app-tap/module_api.test.lua
> +++ b/test/app-tap/module_api.test.lua

There is a fix for the warning related to <obj> variable in previous
review[1]. Please consider it, since this warning will never be fixed.

<snipped>

> diff --git a/test/app-tap/snapshot.test.lua b/test/app-tap/snapshot.test.lua
> index 587f8279b..bd5270702 100755
> --- a/test/app-tap/snapshot.test.lua
> +++ b/test/app-tap/snapshot.test.lua

<snipped>

> @@ -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)
>
Underscore can be freely omitted here (as was proposed in the previous
review[1]).

 +    for _, f in pairs(files) do
>          f:close()
>      end
> -    local ss, ms = pcall(box.snapshot)
> +    local ss, _ = pcall(box.snapshot)

Underscore can be freely omitted here (as was proposed in the previous
review[1]).

>      test:ok(not sf and ss, msg)
>  end
>  gh1094()

<snipped>

> diff --git a/test/app-tap/string.test.lua b/test/app-tap/string.test.lua
> index 02a1a84d7..bf1be5c9e 100755
> --- a/test/app-tap/string.test.lua
> +++ b/test/app-tap/string.test.lua
> @@ -1,11 +1,11 @@
>  #!/usr/bin/env tarantool
>  
>  local tap = require('tap')
> -local test = tap.test("string extensions")
> +local suite = tap.test("string extensions")

These changes introduce a mess in naming: in previous chunks you rename
<test> argument to <testcase>, but here you decided to change naming for
the root suite. I guess you need either to adjust it to the common
naming (<test> and <testcase>) or leave the shadowing, considering this
warning is raised in many other places and we have no policy for it for
now.

>  
> -test:plan(7)
> +suite:plan(7)
>  
> -test:test("split", function(test)
> +suite:test("split", function(test)
>      test:plan(10)
>  
>      -- testing basic split (works over gsplit)

<snipped>

> diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
> index 4d7059559..6c3cfd450 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')

Well, the fact you simply didn't read my reply[1] drives me crazy. I'm
totally OK whether you *fix* the problem other way. I can handle the
fact you introduce unused variables and then suppress them. But ignoring
bug fix for this test is unacceptable for me. OK, I mention it one more
time.

**Here is the fix for the bug you successfully masked in the second
series in a row**:

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

diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
index 6c3cfd450..6f5cd0bdd 100755
--- a/test/app-tap/tarantoolctl.test.lua
+++ b/test/app-tap/tarantoolctl.test.lua
@@ -32,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

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

It's a bug since there is no <file> variable in this scope and this line
is just a copy-paste from the loop body.

I'm out from the further review for this version and will wait the next
one to proceed.

<snipped>

> -- 
> 2.23.0
> 

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

-- 
Best regards,
IM

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

* Re: [Tarantool-patches] [PATCH v4 7/10] schema: fix index promotion to functional index
  2020-04-23 23:29     ` Igor Munkin
@ 2020-04-28 23:19       ` Vladislav Shpilevoy
  0 siblings, 0 replies; 39+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-28 23:19 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches

@ChangeLog
* Fixed a bug in altering a normal index to a functional one.

Pushed to master, 2.4, 2.3.

On 24/04/2020 01:29, Igor Munkin wrote:
> I don't know whether this patch needs a ChangeLog entry, but it's
> missing here.

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

* Re: [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G
  2020-04-23 23:27     ` Igor Munkin
@ 2020-04-28 23:19       ` Vladislav Shpilevoy
  0 siblings, 0 replies; 39+ messages in thread
From: Vladislav Shpilevoy @ 2020-04-28 23:19 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches

@ChangeLog
* Fixed a couple of internal symbols dangling in global namespace _G (gh-4812).

Pushed to master, 2.4, 2.3, 1.10.

On 24/04/2020 01:27, Igor Munkin wrote:
> I don't know whether this patch needs a ChangeLog entry, but it's
> missing here.

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

* Re: [Tarantool-patches] [PATCH v4 9/10] Disabled test/luajit-tap in luacheckrc
  2020-04-24 10:16   ` Igor Munkin
@ 2020-04-29 14:25     ` Sergey Bronnikov
  0 siblings, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-04-29 14:25 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

On 13:16 Fri 24 Apr , Igor Munkin wrote:
> Sergey,
> 
> Thanks for the patch, but it looks irrelevant. Just apply the last patch
> in the series, bump luajit submodule before applying all other patches
> and suppress jit global variable. I guess this patch can be discarded.

Yes, it is a temporary patch. I'll remove it.

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

* Re: [Tarantool-patches] [PATCH v4 6/10] Fix luacheck warnings in test/
  2020-04-27 14:38   ` Igor Munkin
@ 2020-05-06 16:16     ` Sergey Bronnikov
  0 siblings, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-05-06 16:16 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Igor, thanks a lot for review!
See my comments inline.

On 17:38 Mon 27 Apr , Igor Munkin wrote:
> Sergey,
> 
> Thanks for the patch! I didn't finish the review, but I'm not going to
> continue with this version (the reason is at the bottom of my reply).
> However I left several comments for the part I've checked, please
> consider them.
> 
> On 21.04.20, sergeyb@tarantool.org wrote:
> > diff --git a/.luacheckrc b/.luacheckrc

<snipped>

> > index 64692b27c..cec1f4ffe 100644
> > --- a/.luacheckrc
> > +++ b/.luacheckrc
> > @@ -37,3 +37,37 @@ files["src/box/lua/console.lua"] = {ignore = {"212"}}
> >  files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
> >  files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
> >  files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
> > +files["test/app/lua/fiber.lua"] = {globals = {"box_fiber_run_test"}}
> 
> test/app/{app,loaders}.lua are also Lua source files and need to be
> tested via luacheck.

Replaced file mask "test/app/*.lua" with "test/app/*.test.lua" to
exclude test files only and allow luacheck to check non-test code. All
warnings in a new code has beed fixed or supressed.

> > +files["test/app-tap/console.test.lua"] = {globals = {"long_func"}}
> > +files["test/app-tap/lua/require_mod.lua"] = {globals = {"exports"}}
> > +files["test/app-tap/module_api.test.lua"] = {ignore = {"311"}}
> 
> In previous review I provided a diff with fix for this class of
> warnings. You've said nothing against my approaches, but fixed it on
> your own way with no discussion. It's simply unproductive, because I
> need to double-check all changes now.

Sorry for triggering your double efforts. Actually it is not easy for me
to merge your fixes provided inline in a mail. Fixes on top of branch
would require much less efforts from my side - just squash them with
appropriate commits. Anyway our main goal is fixing warnings regardless
my own way or your own way. Isn't it?

> > +files["test/app-tap/string.test.lua"] = {globals = {"utf8"}}
> > +files["test/app-tap/tarantoolctl.test.lua"] = {ignore = {"113", "421"}}
> > +files["test/box-tap/session.test.lua"] = {
> > +	globals = {"active_connections", "session", "space", "f1", "f2"},
> > +	ignore = {"211"}
> > +}
> > +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 = {"space_field_types", "iterate", "arithmetic", "table_shuffle",
> > +	"table_generate", "tuple_to_string", "check_space", "space_bsize",
> > +	"create_iterator", "setmap", "sort"}}
> > +files["test/box/lua/bitset.lua"] = {
> > +	globals = {"create_space", "fill", "delete", "clear", "drop_space",
> > +	"dump", "test_insert_delete"}
> > +}
> > +files["test/box/lua/fifo.lua"] = {globals = {"fifomax", "find_or_create_fifo", "fifo_push", "fifo_top"}}
> > +files["test/box/lua/identifier.lua"] = {globals = {"run_test"}}
> > +files["test/box/lua/require_mod.lua"] = {globals = {"exports"}}
> > +files["test/luajit-tap/gh-4476-fix-string-find-recording.test.lua"] = {ignore = {"231"}}
> > +files["test/luajit-tap/or-232-unsink-64-kptr.test.lua"] = {ignore = {"542"}}
> 
> This files have to be added right after luajit submodule bump.

Added supressions for tests in luajit-tap dir in a separate commit.

> > +files["test/replication/lua/fast_replica.lua"] = {
> > +	globals = {"join", "start_all", "stop_all", "wait_all",
> > +	"drop_all", "drop_all", "vclock_diff", "unregister",
> > +	"delete", "start", "stop", "call_all", "drop", "wait"},
> > +	ignore = {"212", "213"}
> > +}
> > +files["test/sql-tap/*.lua"] = {ignore = {"611", "612", "613", "614", "621", "631", "211", "113", "111"}}
> > +files["test/sql-tap/lua/sqltester.lua"] = {globals = {"table_match_regex_p"}}
> > +files["test/sql-tap/e_expr.test.lua"] = {ignore = {"512"}}
> 
> <snipped>
> 
> > diff --git a/test/app-tap/console.test.lua b/test/app-tap/console.test.lua
> > index 4feadfa5e..e81b48a80 100755
> > --- a/test/app-tap/console.test.lua
> > +++ b/test/app-tap/console.test.lua
> 
> <snipped>
> 
> > @@ -59,7 +59,7 @@ test:is(client:read(";"), 'true;', "pushed message")
> >  client:write('\\set output lua\n')
> >  client:read(";")
> >  
> > -long_func_f = nil
> > +local long_func_f
> >  function long_func()
> 
> Please consider the fix I proposed in previous review[1]. This warning
> is a false positive and can be suppressed inline. Here is the diff:
> 
> ================================================================================
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index cec1f4ffe..4faf770e8 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -38,7 +38,6 @@ files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
>  files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
>  files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
>  files["test/app/lua/fiber.lua"] = {globals = {"box_fiber_run_test"}}
> -files["test/app-tap/console.test.lua"] = {globals = {"long_func"}}
>  files["test/app-tap/lua/require_mod.lua"] = {globals = {"exports"}}
>  files["test/app-tap/module_api.test.lua"] = {ignore = {"311"}}
>  files["test/app-tap/string.test.lua"] = {globals = {"utf8"}}
> diff --git a/test/app-tap/console.test.lua b/test/app-tap/console.test.lua
> index e81b48a80..454d5a892 100755
> --- a/test/app-tap/console.test.lua
> +++ b/test/app-tap/console.test.lua
> @@ -60,6 +60,7 @@ client:write('\\set output lua\n')
>  client:read(";")
>  
>  local long_func_f
> +-- luacheck: globals long_func (is called via client socket)
>  function long_func()
>      long_func_f = fiber.self()
>      box.session.push('push')

Fix applied.

> ================================================================================
> 
> >      long_func_f = fiber.self()
> >      box.session.push('push')
> 
> <snipped>
> 
> > diff --git a/test/app-tap/console_lua.test.lua b/test/app-tap/console_lua.test.lua
> > index 3ed6aad97..263e86c54 100755
> > --- a/test/app-tap/console_lua.test.lua
> > +++ b/test/app-tap/console_lua.test.lua
> 
> <snipped>
> 
> > @@ -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(test_obj, client, statements, name)
> 
> Minor: I guess you can use <testcase> for argument as well as for
> parameter.

Agree, replaced "test_obj" with "testcase".

> > +    test_obj:test(name, function(test)
> >          test:plan(2 * #statements)
> >  
> >          for _, stmt in ipairs(statements) do
> > @@ -75,15 +75,15 @@ 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(test_obj, client, input, exp_output, name)
> 
> Minor: I guess you can use <testcase> for argument as well as for
> parameter.

Agree, replaced "test_obj" with "testcase".

> > +    test_obj:test(name, function(test)
> >          test:plan(2)
> >  
> >          local res = client:write(input .. '\n')
> >          test:ok(res ~= nil, ('-> [[%s]]'):format(input))
> >  
> >          local exp = exp_output .. EOL
> > -        local res = client:read(EOL)
> > +        res = client:read(EOL)
> >          test:is(res, exp, ('<- [[%s]]'):format(exp:gsub('\n', '\\n')))
> >      end)
> >  end
> 
> <snipped>
> 
> > diff --git a/test/app-tap/errno.test.lua b/test/app-tap/errno.test.lua
> > index 5fd8eaca4..4a13edf2a 100755
> > --- a/test/app-tap/errno.test.lua
> > +++ b/test/app-tap/errno.test.lua
> > @@ -3,10 +3,10 @@
> >  local tap = require('tap')
> >  local errno = require('errno')
> >  
> > -local test = tap.test("errno")
> > +local suite = tap.test("errno")
> >  
> > -test:plan(1)
> > -test:test("primary", function(test)
> > +suite:plan(1)
> > +suite:test("primary", function(test)
> >      test:plan(10)
> >      test:is(type(errno), "table", "type of table")
> >      test:ok(errno.EINVAL ~= nil, "errno.EINVAL is available")
> 
> These changes introduce a mess in naming: in previous chunks you rename
> <test> argument to <testcase>, but here you decided to change naming for
> the root suite. I guess you need either to adjust it to the common
> naming (<test> and <testcase>) or leave the shadowing, considering this
> warning is raised in many other places and we have no policy for it for
> now.

Agree, there is a mess a bit here. Reverted "suite" to "test" and replaced
"test" with "testcase" in the following tests:

test/app-tap/console_lua.test.lua
test/app-tap/errno.test.lua
test/app-tap/gh-4761-json-per-call-options.test.lua
test/app-tap/http_client.test.lua
test/app-tap/string.test.lua
test/app-tap/trigger.test.lua
test/box-tap/key_def.test.lua
test/box-tap/merger.test.lua

> <snipped>
> 
> > 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..a8c02dd2f 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}}',
> 
> Underscore can be freely omitted here (as was proposed in the previous
> review[1]).

removed

> >                            {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},
> 
> Underscore can be freely omitted here (as was proposed in the previous
> review[1]).

removed

> >                            {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..1c5bf853b 100755
> > --- a/test/app-tap/http_client.test.lua
> > +++ b/test/app-tap/http_client.test.lua
> > @@ -3,13 +3,13 @@
> >  local tap = require('tap')
> >  local client = require('http.client')
> >  local json = require('json')
> > -local test = tap.test("curl")
> > +local suite = tap.test("curl")
> 
> These changes introduce a mess in naming: in previous chunks you rename
> <test> argument to <testcase>, but here you decided to change naming for
> the root suite. I guess you need either to adjust it to the common
> naming (<test> and <testcase>) or leave the shadowing, considering this
> warning is raised in many other places and we have no policy for it for
> now.

see my answer above, fixed

> >  local fiber = require('fiber')
> >  local socketlib = require('socket')
> >  local os = require('os')
> >  
> >  local TARANTOOL_SRC_DIR = os.getenv("TARANTOOL_SRC_DIR") or "../.."
> > -test:diag("TARANTOOL_SRC_DIR=%s", TARANTOOL_SRC_DIR)
> > +suite:diag("TARANTOOL_SRC_DIR=%s", TARANTOOL_SRC_DIR)
> >  
> >  local function merge(...)
> >      local res = {}
> 
> <snipped>
> 
> > @@ -270,7 +269,7 @@ local function test_errors(test)
> >      test:ok(not status and string.find(json.encode(err),
> >                          "Unsupported protocol"),
> >                          "POST: exception on bad protocol")
> > -    local r = http:get("http://do_not_exist_8ffad33e0cb01e6a01a03d00089e71e5b2b7e9930dfcba.ru")
> > +    http:get("http://do_not_exist_8ffad33e0cb01e6a01a03d00089e71e5b2b7e9930dfcba.ru")
> 
> Why did you leave this line? What does it test?

I thought this line tests http get for unavailable URL...
Unexpectedly there is a story with this testcase. Sometime ago we had
separate testcase with URL that contains unavailable host name. This testcase
was a flaky and may hang forever on resolving unavailable host name. Testcase
has been removed in commit [2], but http:get was kept for unknown
reasons. Discussed with Alexender Turenko and decided to remove this line
too.

[2] https://github.com/tarantool/tarantool/commit/33254bd6632b616a6c9080e059d2d52e6b54e035

> >  end
> >  
> >  -- gh-3679 Check that opts.headers values can be strings only.
> 
> <snipped>
> 
> > diff --git a/test/app-tap/logger.test.lua b/test/app-tap/logger.test.lua
> > index 492d5ea0b..56db1d2c7 100755
> > --- a/test/app-tap/logger.test.lua
> > +++ b/test/app-tap/logger.test.lua
> > @@ -26,7 +26,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)
> 
> Underscore can be freely omitted here (as was proposed in the previous
> review[1]).

removed

> >  test:ok(not s, "plain")
> >  --
> >  -- gh-700: Crash on calling log.info() with formatting characters
> 
> <snipped>
> 
> > @@ -56,34 +56,34 @@ file:close()
> >  
> >  test:ok(log.pid() >= 0, "pid()")
> >  
> > --- logger uses 'debug', try to set it to nil
> > -debug = nil
> > +-- luacheck: ignore (logger uses 'debug', try to set it to nil)
> > +local debug = nil
> 
> This change breaks the test: debug global variable need to be set to
> nil, not the local one. Furthermore, the change differs to the one I've
> seen in the previous branch. Has the branch been rebased?

make 'debug' global again

> >  log.info("debug is nil")
> >  debug = require('debug')
> >  
> 
> <snipped>
> 
> > diff --git a/test/app-tap/module_api.test.lua b/test/app-tap/module_api.test.lua
> > index a6658cc61..e0f2bf75f 100755
> > --- a/test/app-tap/module_api.test.lua
> > +++ b/test/app-tap/module_api.test.lua
> 
> There is a fix for the warning related to <obj> variable in previous
> review[1]. Please consider it, since this warning will never be fixed.

applied

> <snipped>
> 
> > diff --git a/test/app-tap/snapshot.test.lua b/test/app-tap/snapshot.test.lua
> > index 587f8279b..bd5270702 100755
> > --- a/test/app-tap/snapshot.test.lua
> > +++ b/test/app-tap/snapshot.test.lua
> 
> <snipped>
> 
> > @@ -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)
> >
> Underscore can be freely omitted here (as was proposed in the previous
> review[1]).

removed

>  +    for _, f in pairs(files) do
> >          f:close()
> >      end
> > -    local ss, ms = pcall(box.snapshot)
> > +    local ss, _ = pcall(box.snapshot)
> 
> Underscore can be freely omitted here (as was proposed in the previous
> review[1]).

removed

> 
> >      test:ok(not sf and ss, msg)
> >  end
> >  gh1094()
> 
> <snipped>
> 
> > diff --git a/test/app-tap/string.test.lua b/test/app-tap/string.test.lua
> > index 02a1a84d7..bf1be5c9e 100755
> > --- a/test/app-tap/string.test.lua
> > +++ b/test/app-tap/string.test.lua
> > @@ -1,11 +1,11 @@
> >  #!/usr/bin/env tarantool
> >  
> >  local tap = require('tap')
> > -local test = tap.test("string extensions")
> > +local suite = tap.test("string extensions")
> 
> These changes introduce a mess in naming: in previous chunks you rename
> <test> argument to <testcase>, but here you decided to change naming for
> the root suite. I guess you need either to adjust it to the common
> naming (<test> and <testcase>) or leave the shadowing, considering this
> warning is raised in many other places and we have no policy for it for
> now.

see my answer above, fixed
> >  
> > -test:plan(7)
> > +suite:plan(7)
> >  
> > -test:test("split", function(test)
> > +suite:test("split", function(test)
> >      test:plan(10)
> >  
> >      -- testing basic split (works over gsplit)
> 
> <snipped>
> 
> > diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
> > index 4d7059559..6c3cfd450 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')
> 
> Well, the fact you simply didn't read my reply[1] drives me crazy. I'm
> totally OK whether you *fix* the problem other way. I can handle the
> fact you introduce unused variables and then suppress them. But ignoring
> bug fix for this test is unacceptable for me. OK, I mention it one more
> time.
> 
> **Here is the fix for the bug you successfully masked in the second
> series in a row**:
> 
> ================================================================================
> 
> diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
> index 6c3cfd450..6f5cd0bdd 100755
> --- a/test/app-tap/tarantoolctl.test.lua
> +++ b/test/app-tap/tarantoolctl.test.lua
> @@ -32,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
> 
> ================================================================================
> 
> It's a bug since there is no <file> variable in this scope and this line
> is just a copy-paste from the loop body.

Fixed.

> I'm out from the further review for this version and will wait the next
> one to proceed.

Something goes wrong and some your patches was missed.
Sorry for this. I have reviewed your suggested patches in [1] one more time
to make sure all of them are applied.

This patch was not applied as we decided previosly to supress warnings
triggered by unused 'self' argument in luacherkrc:

Fixed several warnings in test/app-tap/table.test.lua with the diff
below:

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

diff --git a/test/app-tap/table.test.lua b/test/app-tap/table.test.lua
index 60c095fdf..7279b07ed 100755
--- a/test/app-tap/table.test.lua
+++ b/test/app-tap/table.test.lua
@@ -145,7 +145,7 @@ end
 
 do -- check usage of __copy metamethod
     local copy_mt = nil; copy_mt = {
-        __copy = function(self)
+        __copy = function()
             local new_self = { a = 1}
             return setmetatable(new_self, copy_mt)
         end
@@ -164,7 +164,7 @@ end
 
 do -- check usage of __copy metamethod + shallow
     local copy_mt = nil; copy_mt = {
-        __copy = function(self)
+        __copy = function()
             local new_self = { a = 1}
             return setmetatable(new_self, copy_mt)
         end
@@ -191,7 +191,7 @@ end
 
 do -- check usage of not __copy metamethod on second level + shallow
     local copy_mt = nil; copy_mt = {
-        __copy = function(self)
+        __copy = function()
             local new_self = { a = 1 }
             return setmetatable(new_self, copy_mt)
         end



> <snipped>
> 
> > -- 
> > 2.23.0
> > 
> 
> [1]: https://lists.tarantool.org/pipermail/tarantool-patches/2020-April/016066.html
> 
> -- 
> Best regards,
> IM

-- 
sergeyb@

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

* Re: [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/
  2020-04-23 22:54   ` Igor Munkin
@ 2020-05-07 10:32     ` Sergey Bronnikov
  2020-05-07 14:34       ` Sergey Bronnikov
  2020-05-07 10:52     ` Sergey Bronnikov
  1 sibling, 1 reply; 39+ messages in thread
From: Sergey Bronnikov @ 2020-05-07 10:32 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

Igor,

thanks for review!
I have corrected patches according to your comments.

On 01:54 Fri 24 Apr , Igor Munkin wrote:
> Sergey,
> 
> Thanks for the patch! Please consider the comments I left below.
> 
> On 21.04.20, sergeyb@tarantool.org wrote:
> > From: Sergey Bronnikov <sergeyb@tarantool.org>
> > 
> > Closes #4681
> > 
> > Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> > Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> > ---
> >  .luacheckrc                     |  8 ++++++++
> >  src/box/lua/console.lua         |  6 +++---
> >  src/box/lua/feedback_daemon.lua |  2 +-
> >  src/box/lua/key_def.lua         |  2 +-
> >  src/box/lua/load_cfg.lua        | 25 +++++++++++------------
> >  src/box/lua/net_box.lua         | 26 ++++++++----------------
> >  src/box/lua/schema.lua          | 35 ++++++++++++++++-----------------
> >  src/box/lua/tuple.lua           |  8 +++-----
> >  src/box/lua/upgrade.lua         | 19 +++++++++---------
> >  9 files changed, 62 insertions(+), 69 deletions(-)
> > 
> > diff --git a/.luacheckrc b/.luacheckrc
> > index 60aedc842..64692b27c 100644
> > --- a/.luacheckrc
> > +++ b/.luacheckrc
> > @@ -25,7 +25,15 @@ exclude_files = {
> >      ".git/**/*.lua",
> >  }
> >  
> > +files["**/*.lua"] = {
> > +    globals = {"box", "_TARANTOOL", "help", "tutorial"},
> > +    ignore = {"212/self", "122"}
> > +}
> 
> Well, I can't figure out why these global suppressions are set in this
> patch.
> By the way these suppressions don't work for extra/dist/tarantoolctl.in.

I'll move these globals to a patch specific to src/lua/.

> Furthermore, IMHO, global suppression for (W122)[Setting a read-only
> field of a global variable] is a bad practice.

requested by Vladislav in [1] (comment 5):
"This error is actually ridiculous in such a language as Lua.
Can we ignore it globally? The same for error 122."

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

> >  files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
> >  files["src/lua/swim.lua"] = {ignore = {"431"}}
> >  files["src/lua/fio.lua"] = {ignore = {"231"}}
> >  files["src/lua/init.lua"] = {globals = {"dostring"}}
> > +files["src/box/lua/console.lua"] = {ignore = {"212"}}
> 
> What is the reason to fix 3 (W211)[Unused local variable] warnings, but
> leave and suppress 9 (W212)[Unused argument] warnings (at the same time
> you fix this type of warnings in load_cfg.lua)?
> 
> > +files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
> 
> It's a single empty branch warning, why it can't be fixed / suppressed
> inline? Here is the diff:

I thought we don't want to use inline supressions at all.
Well, applied patch below on a branch.

> ================================================================================
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 64692b27c..0c1f85766 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -29,11 +29,11 @@ files["**/*.lua"] = {
>      globals = {"box", "_TARANTOOL", "help", "tutorial"},
>      ignore = {"212/self", "122"}
>  }
> +
>  files["extra/dist/tarantoolctl.in"] = {ignore = {"212/self", "122", "431"}}
>  files["src/lua/swim.lua"] = {ignore = {"431"}}
>  files["src/lua/fio.lua"] = {ignore = {"231"}}
>  files["src/lua/init.lua"] = {globals = {"dostring"}}
>  files["src/box/lua/console.lua"] = {ignore = {"212"}}
> -files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
>  files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
>  files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
> diff --git a/src/box/lua/load_cfg.lua b/src/box/lua/load_cfg.lua
> index 0926c7380..38c128e85 100644
> --- a/src/box/lua/load_cfg.lua
> +++ b/src/box/lua/load_cfg.lua
> @@ -414,7 +414,7 @@ local function prepare_cfg(cfg, default_cfg, template_cfg, modify_cfg, prefix)
>          elseif v == "" or v == nil then
>              -- "" and NULL = ffi.cast('void *', 0) set option to default value
>              v = default_cfg[k]
> -        elseif template_cfg[k] == 'any' then
> +        elseif template_cfg[k] == 'any' then -- luacheck: ignore
>              -- any type is ok
>          elseif type(template_cfg[k]) == 'table' then
>              if type(v) ~= 'table' then
> 
> ================================================================================
> 
> > +files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
> 
> Again, I see suppressed (W212)[Unused argument] warnings *but*:
> * they are well localized
> * most of them will *never* be fixed and should be commented and
>   protected from inquisitive persons
> * others can be fixed with a trivial changes
> 
> Here is the diff:

Applied, thanks!

> ================================================================================
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 64692b27c..b05260d29 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -35,5 +35,5 @@ files["src/lua/fio.lua"] = {ignore = {"231"}}
>  files["src/lua/init.lua"] = {globals = {"dostring"}}
>  files["src/box/lua/console.lua"] = {ignore = {"212"}}
>  files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
> -files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
> +files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411"}}
>  files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
> diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
> index 1e351bb31..8b3802749 100644
> --- a/src/box/lua/net_box.lua
> +++ b/src/box/lua/net_box.lua
> @@ -56,18 +56,18 @@ local E_PROC_LUA             = box.error.PROC_LUA
>  -- utility tables
>  local is_final_state         = {closed = 1, error = 1}
>  
> -local function decode_nil(raw_data, raw_data_end)
> +local function decode_nil(raw_data, raw_data_end) -- luacheck: no unused args
>      return nil, raw_data_end
>  end
>  local function decode_data(raw_data)
>      local response, raw_end = decode(raw_data)
>      return response[IPROTO_DATA_KEY], raw_end
>  end
> -local function decode_tuple(raw_data, raw_data_end, format)
> +local function decode_tuple(raw_data, raw_data_end, format) -- luacheck: no unused args
>      local response, raw_end = internal.decode_select(raw_data, nil, format)
>      return response[1], raw_end
>  end
> -local function decode_get(raw_data, raw_data_end, format)
> +local function decode_get(raw_data, raw_data_end, format) -- luacheck: no unused args
>      local body, raw_end = internal.decode_select(raw_data, nil, format)
>      if body[2] then
>          return nil, raw_end, box.error.MORE_THAN_ONE_TUPLE
> @@ -110,7 +110,7 @@ local method_encoder = {
>      max     = internal.encode_select,
>      count   = internal.encode_call,
>      -- inject raw data into connection, used by console and tests
> -    inject = function(buf, id, bytes)
> +    inject = function(buf, id, bytes) -- luacheck: no unused args
>          local ptr = buf:reserve(#bytes)
>          ffi.copy(ptr, bytes, #bytes)
>          buf.wpos = ptr + #bytes
> @@ -176,7 +176,7 @@ end
>  -- Default action on push during a synchronous request -
>  -- ignore.
>  --
> -local function on_push_sync_default(...) end
> +local function on_push_sync_default() end
>  
>  --
>  -- Basically, *transport* is a TCP connection speaking one of
> @@ -1216,7 +1216,7 @@ function remote_methods:execute(query, parameters, sql_opts, netbox_opts)
>                           sql_opts or {})
>  end
>  
> -function remote_methods:prepare(query, parameters, sql_opts, netbox_opts)
> +function remote_methods:prepare(query, parameters, sql_opts, netbox_opts) -- luacheck: no unused args
>      check_remote_arg(self, "prepare")
>      if type(query) ~= "string" then
>          box.error(box.error.SQL_PREPARE, "expected string as SQL statement")
> @@ -1581,7 +1581,7 @@ this_module.self = {
>      timeout = function(self) return self end,
>      wait_connected = function(self) return true end,
>      is_connected = function(self) return true end,
> -    call = function(_box, proc_name, args, opts)
> +    call = function(_box, proc_name, args)
>          check_remote_arg(_box, 'call')
>          check_call_args(args)
>          args = args or {}
> @@ -1598,7 +1598,7 @@ this_module.self = {
>              return handle_eval_result(pcall(proc, unpack(args)))
>          end
>      end,
> -    eval = function(_box, expr, args, opts)
> +    eval = function(_box, expr, args)
>          check_remote_arg(_box, 'eval')
>          check_eval_args(args)
>          args = args or {}
> 
> ================================================================================
> 
> Moreover a single (W231)[Local variable is set but never accessed]
> warning is also supressed (but you fixed others in this file). Here is
> the diff:

Applied, thanks!

> ================================================================================
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 64692b27c..b23ebfc60 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -35,5 +35,5 @@ files["src/lua/fio.lua"] = {ignore = {"231"}}
>  files["src/lua/init.lua"] = {globals = {"dostring"}}
>  files["src/box/lua/console.lua"] = {ignore = {"212"}}
>  files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
> -files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
> +files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "411", "212"}}
>  files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
> diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
> index 1e351bb31..bcfec92bc 100644
> --- a/src/box/lua/net_box.lua
> +++ b/src/box/lua/net_box.lua
> @@ -749,13 +749,12 @@ local function create_transport(host, port, user, password, callback,
>              return iproto_schema_sm()
>          end
>          encode_auth(send_buf, new_request_id(), user, password, salt)
> -        local err, hdr, body_rpos, body_end = send_and_recv_iproto()
> +        local err, hdr, body_rpos = send_and_recv_iproto()
>          if err then
>              return error_sm(err, hdr)
>          end
>          if hdr[IPROTO_STATUS_KEY] ~= 0 then
> -            local body
> -            body, body_end = decode(body_rpos)
> +            local body = decode(body_rpos)
>              return error_sm(E_NO_CONNECTION, body[IPROTO_ERROR_KEY])
>          end
>          set_state('fetch_schema')
> 
> ================================================================================
> 
> > +files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
> 
> Again, it's a single empty branch warning, that can be suppressed
> inline. Here is the diff:

Applied, thanks!

> ================================================================================
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 64692b27c..fa715fded 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -36,4 +36,4 @@ files["src/lua/init.lua"] = {globals = {"dostring"}}
>  files["src/box/lua/console.lua"] = {ignore = {"212"}}
>  files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
>  files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
> -files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
> +files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "212"}}
> diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
> index de47b807e..5fad272ab 100644
> --- a/src/box/lua/schema.lua
> +++ b/src/box/lua/schema.lua
> @@ -259,7 +259,7 @@ local function check_param_table(table, template)
>          if template[k] == nil then
>              box.error(box.error.ILLEGAL_PARAMS,
>                        "unexpected option '" .. k .. "'")
> -        elseif template[k] == 'any' then
> +        elseif template[k] == 'any' then -- luacheck: ignore
>              -- any type is ok
>          elseif (string.find(template[k], ',') == nil) then
>              -- one type
> 
> ================================================================================
> 
> And the following simple diff fixes all remaining (W212)[Unused
> argument] warnings reported for schema.lua:

Applied.

> ================================================================================
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 64692b27c..bfe144f64 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -36,4 +36,4 @@ files["src/lua/init.lua"] = {globals = {"dostring"}}
>  files["src/box/lua/console.lua"] = {ignore = {"212"}}
>  files["src/box/lua/load_cfg.lua"] = {ignore = {"542"}}
>  files["src/box/lua/net_box.lua"] = {ignore = {"431", "432", "231", "411", "212"}}
> -files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542", "212"}}
> +files["src/box/lua/schema.lua"] = {ignore = {"431", "432", "542"}}
> diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
> index de47b807e..537443eeb 100644
> --- a/src/box/lua/schema.lua
> +++ b/src/box/lua/schema.lua
> @@ -1229,12 +1229,12 @@ end
>  
>  local iterator_t = ffi.typeof('struct iterator')
>  ffi.metatype(iterator_t, {
> -    __tostring = function(iterator)
> +    __tostring = function()
>          return "<iterator state>"
>      end;
>  })
>  
> -local iterator_gen = function(param, state)
> +local iterator_gen = function(param, state) -- luacheck: no unused args
>      --[[
>          index:pairs() mostly conforms to the Lua for-in loop conventions and
>          tries to follow the best practices of Lua community.
> @@ -1268,7 +1268,7 @@ local iterator_gen = function(param, state)
>      end
>  end
>  
> -local iterator_gen_luac = function(param, state)
> +local iterator_gen_luac = function(param, state) -- luacheck: no unused args
>      local tuple = internal.iterator_next(state)
>      if tuple ~= nil then
>          return state, tuple -- new state, value
> @@ -1773,9 +1773,9 @@ local function wrap_schema_object_mt(name)
>          __pairs = global_mt.__pairs
>      }
>      local mt_mt = {}
> -    mt_mt.__newindex = function(t, k, v)
> +    mt_mt.__newindex = function(self, k, v)
>          mt_mt.__newindex = nil
> -        mt.__index = function(t, k)
> +        mt.__index = function(self, k)
>              return mt[k] or box.schema[name][k]
>          end
>          rawset(mt, k, v)
> @@ -2484,7 +2484,7 @@ local function revoke(uid, name, privilege, object_type, object_name, options)
>      end
>  end
>  
> -local function drop(uid, opts)
> +local function drop(uid)
>      -- recursive delete of user data
>      local _vpriv = box.space[box.schema.VPRIV_ID]
>      local spaces = box.space[box.schema.VSPACE_ID].index.owner:select{uid}
> @@ -2563,7 +2563,7 @@ box.schema.user.drop = function(name, opts)
>              box.error(box.error.DROP_USER, name,
>                        "the user is active in the current session")
>          end
> -        return drop(uid, opts)
> +        return drop(uid)
>      end
>      if not opts.if_exists then
>          box.error(box.error.NO_SUCH_USER, name)
> 
> ================================================================================
> 
> <snipped>
> 
> > diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
> > index 07fa54c38..1e351bb31 100644
> > --- a/src/box/lua/net_box.lua
> > +++ b/src/box/lua/net_box.lua
> 
> <snipped>
> 
> > @@ -425,7 +421,7 @@ local function create_transport(host, port, user, password, callback,
> >          state = new_state
> >          last_errno = new_errno
> >          last_error = new_error
> > -        callback('state_changed', new_state, new_errno, new_error)
> > +        callback('state_changed', new_state, new_error)
> 
> Please adjust the corresponding comment.
> 
> >          state_cond:broadcast()
> >          if state == 'error' or state == 'error_reconnect' or
> >             state == 'closed' then
> 
> <snipped>
> 
> > @@ -954,7 +945,7 @@ local function new_sm(host, port, opts, connection, greeting)
> >      local remote = {host = host, port = port, opts = opts, state = 'initial'}
> >      local function callback(what, ...)
> >          if what == 'state_changed' then
> > -            local state, errno, err = ...
> > +            local state, err = ...
> >              local was_connected = remote._is_connected
> >              if state == 'active' then
> >                  if not was_connected then
> > diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
> > index 85fcca562..de47b807e 100644
> > --- a/src/box/lua/schema.lua
> > +++ b/src/box/lua/schema.lua
> 
> <snipped>
> 
> > @@ -582,9 +580,9 @@ end
> >  --
> >  local function format_field_resolve(format, path, what)
> >      assert(type(path) == 'number' or type(path) == 'string')
> > -    local idx = nil
> > +    local idx
> >      local relative_path = nil
> > -    local field_name = nil
> > +    local field_name
> 
> You can simply move it down to its initialization.

Done

> >      -- Path doesn't require resolve.
> >      if type(path) == 'number' then
> >          idx = path
> 

<snipped>

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

* Re: [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/
  2020-04-23 22:54   ` Igor Munkin
  2020-05-07 10:32     ` Sergey Bronnikov
@ 2020-05-07 10:52     ` Sergey Bronnikov
  1 sibling, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-05-07 10:52 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

On 01:54 Fri 24 Apr , Igor Munkin wrote:

<snipped>

> > @@ -425,7 +421,7 @@ local function create_transport(host, port, user, password, callback,
> >          state = new_state
> >          last_errno = new_errno
> >          last_error = new_error
> > -        callback('state_changed', new_state, new_errno, new_error)
> > +        callback('state_changed', new_state, new_error)
> 
> Please adjust the corresponding comment.

Done.

<snipped>

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

* Re: [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/
  2020-05-07 10:32     ` Sergey Bronnikov
@ 2020-05-07 14:34       ` Sergey Bronnikov
  0 siblings, 0 replies; 39+ messages in thread
From: Sergey Bronnikov @ 2020-05-07 14:34 UTC (permalink / raw)
  To: Igor Munkin; +Cc: o.piskunov, tarantool-patches, v.shpilevoy

On 13:32 Thu 07 May , Sergey Bronnikov wrote:
<snipped>
> > > diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
> > > index 85fcca562..de47b807e 100644
> > > --- a/src/box/lua/schema.lua
> > > +++ b/src/box/lua/schema.lua
> > 
> > <snipped>
> > 
> > > @@ -582,9 +580,9 @@ end
> > >  --
> > >  local function format_field_resolve(format, path, what)
> > >      assert(type(path) == 'number' or type(path) == 'string')
> > > -    local idx = nil
> > > +    local idx
> > >      local relative_path = nil
> > > -    local field_name = nil
> > > +    local field_name
> > 
> > You can simply move it down to its initialization.
> 
> Done

reverted, because change broke tests

<snipped>

-- 
sergeyb@

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

end of thread, other threads:[~2020-05-07 14:34 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 14:00 [Tarantool-patches] [PATCH v4 0/10] Add static analysis with luacheck sergeyb
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 1/10] Add initial luacheck config sergeyb
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 2/10] gitlab-ci: enable static analysis with luacheck sergeyb
2020-04-21 20:04   ` Alexander Tikhonov
2020-04-22  8:09     ` Sergey Bronnikov
2020-04-22  8:11     ` Kirill Yukhin
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 3/10] Fix luacheck warnings in extra/dist/tarantoolctl.in sergeyb
2020-04-23 11:40   ` Igor Munkin
2020-04-24  8:02     ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 4/10] Fix luacheck warnings in src/lua/ sergeyb
2020-04-23 14:13   ` Igor Munkin
2020-04-24  9:12     ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 5/10] Fix luacheck warnings in src/box/lua/ sergeyb
2020-04-23 22:54   ` Igor Munkin
2020-05-07 10:32     ` Sergey Bronnikov
2020-05-07 14:34       ` Sergey Bronnikov
2020-05-07 10:52     ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 6/10] Fix luacheck warnings in test/ sergeyb
2020-04-27 14:38   ` Igor Munkin
2020-05-06 16:16     ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 7/10] schema: fix index promotion to functional index sergeyb
2020-04-23 23:24   ` Igor Munkin
2020-04-23 23:29     ` Igor Munkin
2020-04-28 23:19       ` Vladislav Shpilevoy
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 8/10] schema: fix internal symbols dangling in _G sergeyb
2020-04-21 14:13   ` Oleg Babin
2020-04-21 14:45     ` Sergey Bronnikov
2020-04-21 19:52   ` Igor Munkin
2020-04-23 23:27     ` Igor Munkin
2020-04-28 23:19       ` Vladislav Shpilevoy
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 9/10] Disabled test/luajit-tap in luacheckrc sergeyb
2020-04-24 10:16   ` Igor Munkin
2020-04-29 14:25     ` Sergey Bronnikov
2020-04-21 14:00 ` [Tarantool-patches] [PATCH v4 10/10] luajit: Fix warnings spotted by luacheck sergeyb
2020-04-21 19:33   ` Igor Munkin
2020-04-22 10:14     ` Sergey Bronnikov
2020-04-23  6:24   ` Sergey Bronnikov
2020-04-23 10:03     ` Igor Munkin
2020-04-23 10:30       ` Sergey Bronnikov

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