Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v7 0/2] Fix luacheck warnings in test/sql and test/sql-tap
@ 2021-01-14  8:52 Sergey Bronnikov via Tarantool-patches
  2021-01-14  8:52 ` [Tarantool-patches] [PATCH v7 1/2] test: fix luacheck warnings in test/sql Sergey Bronnikov via Tarantool-patches
  2021-01-14  8:52 ` [Tarantool-patches] [PATCH v7 2/2] test: fix luacheck warnings in test/sql-tap Sergey Bronnikov via Tarantool-patches
  0 siblings, 2 replies; 5+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-14  8:52 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

Changelog v7:

- fixed warnings in a new code
- rebased to master branch

Changelog v6:

- splitted patch in test/ for patches per sub-directory
- adjusted suppressions in .luacheckrc
- fixed formatting issues in .luacheckrc

Issues:
  - https://github.com/tarantool/tarantool/issues/5463
  - https://github.com/tarantool/tarantool/issues/5464
Gitlab CI: https://gitlab.com/tarantool/tarantool/-/pipelines/241203686
Branch: ligurio/gh-5463-luacheck-warnings-test-sql

Sergey Bronnikov (2):
  test: fix luacheck warnings in test/sql
  test: fix luacheck warnings in test/sql-tap

 .luacheckrc                                    |  2 +-
 test/sql-tap/analyze9.test.lua                 | 18 +++++++++---------
 test/sql-tap/between.test.lua                  |  4 ++--
 test/sql-tap/date.test.lua                     |  3 ++-
 test/sql-tap/e_expr.test.lua                   | 11 ++++++-----
 test/sql-tap/func.test.lua                     |  2 +-
 test/sql-tap/gh-2723-concurrency.test.lua      |  8 ++++----
 .../gh-3083-ephemeral-unref-tuples.test.lua    |  2 +-
 .../sql-tap/gh-3332-tuple-format-leak.test.lua |  2 +-
 .../gh2127-indentifier-max-length.test.lua     | 10 +++++-----
 test/sql-tap/identifier-characters.test.lua    |  2 +-
 test/sql-tap/index1.test.lua                   |  4 +---
 test/sql-tap/join3.test.lua                    |  2 +-
 test/sql-tap/lua-tables.test.lua               |  5 ++---
 test/sql-tap/lua/sqltester.lua                 |  5 ++---
 test/sql-tap/misc1.test.lua                    |  4 ++--
 test/sql-tap/misc5.test.lua                    |  2 +-
 test/sql-tap/select1.test.lua                  |  6 +++---
 test/sql-tap/select2.test.lua                  |  8 ++++----
 test/sql-tap/select4.test.lua                  |  3 +--
 test/sql-tap/select5.test.lua                  |  3 +--
 test/sql-tap/select9.test.lua                  | 10 +++-------
 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               |  5 ++---
 test/sql-tap/table.test.lua                    |  3 ++-
 test/sql-tap/tkt-38cb5df375.test.lua           |  1 -
 test/sql-tap/tkt-91e2e8ba6f.test.lua           |  3 ---
 test/sql-tap/tkt-9a8b09f8e6.test.lua           |  3 ---
 test/sql-tap/tkt-bd484a090c.test.lua           |  3 ++-
 test/sql-tap/tkt2192.test.lua                  |  3 ++-
 test/sql-tap/tkt3493.test.lua                  |  3 ---
 test/sql-tap/trigger2.test.lua                 |  4 ++--
 test/sql-tap/triggerA.test.lua                 |  1 -
 test/sql-tap/where2.test.lua                   |  6 ++----
 test/sql-tap/whereC.test.lua                   |  1 -
 test/sql-tap/with1.test.lua                    |  8 ++++----
 test/sql-tap/with2.test.lua                    | 14 +++++++-------
 test/sql/lua/sql_tokenizer.lua                 |  2 +-
 41 files changed, 87 insertions(+), 114 deletions(-)

-- 
2.25.1

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

* [Tarantool-patches] [PATCH v7 1/2] test: fix luacheck warnings in test/sql
  2021-01-14  8:52 [Tarantool-patches] [PATCH v7 0/2] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
@ 2021-01-14  8:52 ` Sergey Bronnikov via Tarantool-patches
  2021-01-14  8:52 ` [Tarantool-patches] [PATCH v7 2/2] test: fix luacheck warnings in test/sql-tap Sergey Bronnikov via Tarantool-patches
  1 sibling, 0 replies; 5+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-14  8:52 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #5463

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

diff --git a/.luacheckrc b/.luacheckrc
index 4b829f3dc..b0260082e 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -41,7 +41,7 @@ exclude_files = {
     "test/luajit-tap/**/*.lua",
     "test/replication/**/*.lua",
     "test/replication-py/**/*.lua",
-    "test/sql/**/*.lua",
+    "test/sql/*.test.lua",
     "test/swim/**/*.lua",
     "test/var/**/*.lua",
     "test/vinyl/**/*.lua",
diff --git a/test/sql/lua/sql_tokenizer.lua b/test/sql/lua/sql_tokenizer.lua
index 9922d792d..ffe4fb4e8 100644
--- a/test/sql/lua/sql_tokenizer.lua
+++ b/test/sql/lua/sql_tokenizer.lua
@@ -134,7 +134,7 @@ end
 -- @retval Token type. If the rest of the SQL request consists of
 --         spaces and comments, then return TK_EMPTY.
 local function get_next_token(context)
-    local c = ''
+    local c
     repeat
         local i = context.offset
         c = context.sql:sub(i, i)
-- 
2.25.1

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

* [Tarantool-patches] [PATCH v7 2/2] test: fix luacheck warnings in test/sql-tap
  2021-01-14  8:52 [Tarantool-patches] [PATCH v7 0/2] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
  2021-01-14  8:52 ` [Tarantool-patches] [PATCH v7 1/2] test: fix luacheck warnings in test/sql Sergey Bronnikov via Tarantool-patches
@ 2021-01-14  8:52 ` Sergey Bronnikov via Tarantool-patches
  2021-01-15 22:10   ` Vladislav Shpilevoy via Tarantool-patches
  1 sibling, 1 reply; 5+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-14  8:52 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #5464

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>
---
 test/sql-tap/analyze9.test.lua                 | 18 +++++++++---------
 test/sql-tap/between.test.lua                  |  4 ++--
 test/sql-tap/date.test.lua                     |  3 ++-
 test/sql-tap/e_expr.test.lua                   | 11 ++++++-----
 test/sql-tap/func.test.lua                     |  2 +-
 test/sql-tap/gh-2723-concurrency.test.lua      |  8 ++++----
 .../gh-3083-ephemeral-unref-tuples.test.lua    |  2 +-
 .../sql-tap/gh-3332-tuple-format-leak.test.lua |  2 +-
 .../gh2127-indentifier-max-length.test.lua     | 10 +++++-----
 test/sql-tap/identifier-characters.test.lua    |  2 +-
 test/sql-tap/index1.test.lua                   |  4 +---
 test/sql-tap/join3.test.lua                    |  2 +-
 test/sql-tap/lua-tables.test.lua               |  5 ++---
 test/sql-tap/lua/sqltester.lua                 |  5 ++---
 test/sql-tap/misc1.test.lua                    |  4 ++--
 test/sql-tap/misc5.test.lua                    |  2 +-
 test/sql-tap/select1.test.lua                  |  6 +++---
 test/sql-tap/select2.test.lua                  |  8 ++++----
 test/sql-tap/select4.test.lua                  |  3 +--
 test/sql-tap/select5.test.lua                  |  3 +--
 test/sql-tap/select9.test.lua                  | 10 +++-------
 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               |  5 ++---
 test/sql-tap/table.test.lua                    |  3 ++-
 test/sql-tap/tkt-38cb5df375.test.lua           |  1 -
 test/sql-tap/tkt-91e2e8ba6f.test.lua           |  3 ---
 test/sql-tap/tkt-9a8b09f8e6.test.lua           |  3 ---
 test/sql-tap/tkt-bd484a090c.test.lua           |  3 ++-
 test/sql-tap/tkt2192.test.lua                  |  3 ++-
 test/sql-tap/tkt3493.test.lua                  |  3 ---
 test/sql-tap/trigger2.test.lua                 |  4 ++--
 test/sql-tap/triggerA.test.lua                 |  1 -
 test/sql-tap/where2.test.lua                   |  6 ++----
 test/sql-tap/whereC.test.lua                   |  1 -
 test/sql-tap/with1.test.lua                    |  8 ++++----
 test/sql-tap/with2.test.lua                    | 14 +++++++-------
 39 files changed, 85 insertions(+), 112 deletions(-)

diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 1d7c8b632..50300cdbe 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -244,7 +244,7 @@ test:do_execsql_test(
 local function insert_filler_rows_n(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
@@ -615,7 +615,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
@@ -663,7 +663,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
@@ -717,7 +717,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\""
@@ -768,7 +768,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\""
@@ -829,7 +829,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\""
@@ -880,7 +880,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\""
@@ -937,7 +937,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\""
@@ -1167,7 +1167,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 550976b86..2058d5f5a 100755
--- a/test/sql-tap/between.test.lua
+++ b/test/sql-tap/between.test.lua
@@ -61,11 +61,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 b414b5397..83210acf4 100755
--- a/test/sql-tap/date.test.lua
+++ b/test/sql-tap/date.test.lua
@@ -29,7 +29,8 @@ test:plan(0)
 
 -- Disabled until #3694 is resolved.
 --
-if false then
+local enable_broken_tests = false
+if enable_broken_tests then
 local function datetest(tnum, expr, result)
     test:do_test(
         "date-"..tnum,
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index f5b58cb79..ca15d2a1a 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -1077,7 +1077,7 @@ test:do_execsql_test(
 --
 -- MUST_WORK_TEST prepared statements
 if (0>0) then
-    local function parameter_test(tn, sql, params, result)
+    local function parameter_test(tn, sql, params, result) -- luacheck: no unused args
         local stmt = sql_prepare_v2("db", sql, -1)
         for _ in X(0, "X!foreach", [=[["number name",["params"]]]=]) do
             local 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 = {}
 local function likefunc(...)
     local args = {...}
-    for i, v in ipairs(args) do
+    for _, v in ipairs(args) do
         table.insert(likeargs, v)
     end
     return 1
@@ -2356,7 +2356,7 @@ end
 local regexpargs = {}
 local function regexpfunc(...)
     local args = {...}
-    for i, v in ipairs(args) do
+    for _, v in ipairs(args) do
         table.insert(regexpargs, v)
     end
     return 1
@@ -2415,7 +2415,7 @@ test:do_test(
 local matchargs = {  }
 local function matchfunc(...)
     local args = {...}
-    for i, v in ipairs(args) do
+    for _, v in ipairs(args) do
         table.insert(matchargs, v)
     end
     return 1
@@ -2679,6 +2679,7 @@ if 0>0 then
     -- comparisons take place.
     --
 
+    -- luacheck: ignore (loop is executed at most once)
     for _ in X(0, "X!foreach", [=[["a b c",[["list",[["expr","3"]],[["expr","4"]],[["expr","5"]]]]]]=]) do
         break
     end
diff --git a/test/sql-tap/func.test.lua b/test/sql-tap/func.test.lua
index d14eef421..e741acc64 100755
--- a/test/sql-tap/func.test.lua
+++ b/test/sql-tap/func.test.lua
@@ -1473,7 +1473,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/gh-2723-concurrency.test.lua b/test/sql-tap/gh-2723-concurrency.test.lua
index aa9be0130..d48760ac4 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 0b7c3ca32..159e9cac5 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-3332-tuple-format-leak.test.lua b/test/sql-tap/gh-3332-tuple-format-leak.test.lua
index 5e286ed0d..5285cfa28 100755
--- a/test/sql-tap/gh-3332-tuple-format-leak.test.lua
+++ b/test/sql-tap/gh-3332-tuple-format-leak.test.lua
@@ -21,7 +21,7 @@ test:do_test(
 test:do_test(
     "format-leak",
     function()
-        for i = 1, 100000 do
+        for _ = 1, 100000 do
             box.execute("SELECT id FROM t1 WHERE flags=3 ORDER BY id LIMIT 2");
         end
     end, {
diff --git a/test/sql-tap/gh2127-indentifier-max-length.test.lua b/test/sql-tap/gh2127-indentifier-max-length.test.lua
index 112689327..33d22b50a 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 7b257921d..184916bd3 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 ea25727a4..bcfaeb9a8 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)
@@ -1011,8 +1010,7 @@ end
 test:do_test(
     "index-22.1.0",
     function()
-        local format
-        format = {}
+        local format = {}
         format[1] = { name = 'id', type = 'scalar'}
         format[2] = { name = 'f2', type = 'scalar'}
         box.schema.create_space('T', {format = format})
diff --git a/test/sql-tap/join3.test.lua b/test/sql-tap/join3.test.lua
index 4aa8c94a3..3f6799cc1 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 fa10d886d..c722411e1 100755
--- a/test/sql-tap/lua-tables.test.lua
+++ b/test/sql-tap/lua-tables.test.lua
@@ -5,11 +5,10 @@ test:plan(14)
 test:do_test(
     "lua-tables-prepare-1",
     function()
-        local format, s
-        format = {}
+        local format = {}
         format[1] = { name = 'id', type = 'scalar'}
         format[2] = { name = 'f2', type = 'scalar'}
-        s = box.schema.create_space('t', {format = format})
+        local s = box.schema.create_space('t', {format = format})
         s:create_index('i', {parts={1, 'scalar'}})
 
         s:replace{1, 4}
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 169d2f271..79702f1fb 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -176,7 +176,7 @@ local function execsql(self, sql)
 end
 test.execsql = execsql
 
-local function catchsql(self, sql, expect)
+local function catchsql(self, sql)
     local r = {pcall(execsql, self, sql) }
     if r[1] == true then
         r[1] = 0
@@ -272,7 +272,7 @@ test.catchsql2 = catchsql2
 -- that different SQL statements generate exactly the same VDBE code.
 local function explain_no_trace(self, sql)
     local tr = execsql(self, "EXPLAIN "..sql)
-    for i=1,8 do
+    for _=1,8 do
         table.remove(tr,1)
     end
     return tr
@@ -378,7 +378,6 @@ function test.randstr(Length)
     for Loop = 0, 255 do
         Chars[Loop+1] = string.char(Loop)
     end
-    local String = table.concat(Chars)
     local Result = {}
     local Lookup = Chars
     local Range = #Lookup
diff --git a/test/sql-tap/misc1.test.lua b/test/sql-tap/misc1.test.lua
index c9b9cd7a8..371597813 100755
--- a/test/sql-tap/misc1.test.lua
+++ b/test/sql-tap/misc1.test.lua
@@ -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 357c36ff6..209eb0d9c 100755
--- a/test/sql-tap/misc5.test.lua
+++ b/test/sql-tap/misc5.test.lua
@@ -292,7 +292,7 @@ test:do_test(
         local sql, tail
         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 0e7c5a318..f484648b8 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1,6 +1,7 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
 test:plan(173)
+local enable_broken_tests = false
 
 local function set_full_column_names(value)
     box.space._session_settings:update('sql_full_column_names', {
@@ -1513,8 +1514,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",
         [[
@@ -1970,7 +1970,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 96b29937f..9b50ed529 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 abc95a24f..7ff6d449c 100755
--- a/test/sql-tap/select4.test.lua
+++ b/test/sql-tap/select4.test.lua
@@ -30,9 +30,8 @@ test:execsql [[
     CREATE TABLE t1(n int primary key, log int);
     START TRANSACTION;
 ]]
-local i, j
 for i = 1, 31, 1 do
-    j = 0
+    local j = 0
     while math.pow(2, j) < i do
         j = j+1
     end
diff --git a/test/sql-tap/select5.test.lua b/test/sql-tap/select5.test.lua
index d531cbcf8..43d923848 100755
--- a/test/sql-tap/select5.test.lua
+++ b/test/sql-tap/select5.test.lua
@@ -27,9 +27,8 @@ test:execsql [[
     CREATE TABLE t1(x int primary key, y int);
     START TRANSACTION;
 ]]
-local i, j
 for i = 1, 31, 1 do
-    j = 0
+    local j = 0
     while math.pow(2, j) < i do
         j = j+1
     end
diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
index 4f7da84e2..570bee955 100755
--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -60,10 +60,8 @@ local 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 a608ab093..2c8cf55b9 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 b56403ce5..fcb1cc385 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 a9c7d9fb6..d4b36bb2d 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 065f648b7..7424f9121 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 469193a2b..4938297fb 100755
--- a/test/sql-tap/sql-errors.test.lua
+++ b/test/sql-tap/sql-errors.test.lua
@@ -6,10 +6,9 @@ test:execsql([[
 	CREATE TABLE t0 (i INT PRIMARY KEY, a INT);
 	CREATE VIEW v0 AS SELECT * FROM t0;
 ]])
-local format, s0
-format = {}
+local format = {}
 for i = 1, 2001 do format[i] = {name = 'A' .. i, type = 'unsigned'} end
-s0 = box.schema.space.create('S0', {format = format})
+local s0 = box.schema.space.create('S0', {format = format})
 s0:create_index('I0')
 
 test:do_catchsql_test(
diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua
index 590dbafbd..236577fa3 100755
--- a/test/sql-tap/table.test.lua
+++ b/test/sql-tap/table.test.lua
@@ -1,6 +1,7 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
 test:plan(79)
+local 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 1539005b8..b373bbc57 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 c6d9a26d8..5b78d8f4c 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 8f305e444..05bcbcc24 100755
--- a/test/sql-tap/tkt-9a8b09f8e6.test.lua
+++ b/test/sql-tap/tkt-9a8b09f8e6.test.lua
@@ -22,9 +22,6 @@ test:plan(47)
 -- ["source",[["testdir"],"\/tester.tcl"]]
 local 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 50c76304c..79ad912d0 100755
--- a/test/sql-tap/tkt-bd484a090c.test.lua
+++ b/test/sql-tap/tkt-bd484a090c.test.lua
@@ -2,6 +2,7 @@
 local test = require("sqltester")
 --test:plan(2)
 test:plan(0)
+local enable_broken_tests = false
 
 --!./tcltestrunner.lua
 -- 2011 June 21
@@ -22,7 +23,7 @@ local testprefix = "tkt-bd484a090c"
 
 -- Disabled until #3694 is resolved.
 --
-if false then
+if enable_broken_tests then
 test:do_test(
     1.1,
     function()
diff --git a/test/sql-tap/tkt2192.test.lua b/test/sql-tap/tkt2192.test.lua
index dabdfd141..fe7d8817c 100755
--- a/test/sql-tap/tkt2192.test.lua
+++ b/test/sql-tap/tkt2192.test.lua
@@ -2,6 +2,7 @@
 local 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 78e465b00..9387c5207 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 680cd07b8..4a4454597 100755
--- a/test/sql-tap/trigger2.test.lua
+++ b/test/sql-tap/trigger2.test.lua
@@ -127,12 +127,12 @@ for _, tbl_defn in ipairs(tbl_definitions) do
             local 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 38a3dbea2..8d5013255 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 3b7e36093..aad6351e6 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -1,9 +1,7 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-local yaml = require("yaml")
-local fio = require("fio")
-
 local ffi = require("ffi")
+local _
 test:plan(74)
 
 ffi.cdef[[
@@ -116,7 +114,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/whereC.test.lua b/test/sql-tap/whereC.test.lua
index 334d4cf29..f71ab06c6 100755
--- a/test/sql-tap/whereC.test.lua
+++ b/test/sql-tap/whereC.test.lua
@@ -1,6 +1,5 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-local yaml = require('yaml')
 test:plan(41)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/with1.test.lua b/test/sql-tap/with1.test.lua
index 86dd4f83a..2a91085a2 100755
--- a/test/sql-tap/with1.test.lua
+++ b/test/sql-tap/with1.test.lua
@@ -631,13 +631,13 @@ local 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 456ded363..cdf1d75a2 100755
--- a/test/sql-tap/with2.test.lua
+++ b/test/sql-tap/with2.test.lua
@@ -386,22 +386,22 @@ genstmt(255), {
 -- Check that adding a WITH clause to an INSERT disables the xfer
 -- optimization.
 
-local function do_xfer_test(test, test_func, test_name, func, exp, opts)
-    local opts = opts or {}
+local function do_xfer_test(test_arg, test_func, test_name, func, exp, opts)
+    opts = opts or {}
     local exp_xfer_count = opts.exp_xfer_count
     local before = box.stat.sql().sql_xfer_count
-    test_func(test, test_name, func, exp)
+    test_func(test_arg, test_name, func, exp)
     local after = box.stat.sql().sql_xfer_count
     test:is(after - before, exp_xfer_count,
                    test_name .. '-xfer-count')
 end
 
-test.do_execsql_xfer_test = function(test, test_name, func, exp, opts)
-    do_xfer_test(test, test.do_execsql_test, test_name, func, exp, opts)
+test.do_execsql_xfer_test = function(test_arg, test_name, func, exp, opts)
+    do_xfer_test(test_arg, test_arg.do_execsql_test, test_name, func, exp, opts)
 end
 
-test.do_catchsql_xfer_test = function(test, test_name, func, exp, opts)
-    do_xfer_test(test, test.do_catchsql_test, test_name, func, exp, opts)
+test.do_catchsql_xfer_test = function(test_arg, test_name, func, exp, opts)
+    do_xfer_test(test_arg, test_arg.do_catchsql_test, test_name, func, exp, opts)
 end
 
 test:do_execsql_test(
-- 
2.25.1


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

* Re: [Tarantool-patches] [PATCH v7 2/2] test: fix luacheck warnings in test/sql-tap
  2021-01-14  8:52 ` [Tarantool-patches] [PATCH v7 2/2] test: fix luacheck warnings in test/sql-tap Sergey Bronnikov via Tarantool-patches
@ 2021-01-15 22:10   ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-21 12:52     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 1 reply; 5+ messages in thread
From: Vladislav Shpilevoy via Tarantool-patches @ 2021-01-15 22:10 UTC (permalink / raw)
  To: sergeyb, tarantool-patches

Hi! Thanks for the patch!

> diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua
> index 456ded363..cdf1d75a2 100755
> --- a/test/sql-tap/with2.test.lua
> +++ b/test/sql-tap/with2.test.lua
> @@ -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(

I reverted this entire diff hunk and luacheck passed.
Indeed, in this hunk you only fix upvalue redefinitions,
which we have agreed to leave as is, and you even added
ignores to .luacheckrc to the list of global ignores:

    -- Redefining a local variable.
    "411",
    -- Redefining an argument.
    "412",
    -- Shadowing a local variable.
    "421",
    -- Shadowing an upvalue.
    "431",
    -- Shadowing an upvalue argument.
    "432",

Why did you change this file?
Also I did this and the check also has passed:

diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 50300cdbe..b8955531a 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -244,7 +244,7 @@ test:do_execsql_test(
 local function insert_filler_rows_n(iStart, nCopy, nVal)
     for i = 0, nVal-1 do
         local iVal = iStart+i
-        for _ = 0, nCopy-1 do
+        for j = 0, nCopy-1 do
             box.execute(string.format("INSERT INTO t1 VALUES (null, %s, %s, '%s')", iVal, iVal, iVal))
         end
     end

I reverted one of your first changes in this commit.
The check passes because it looks like you left a ton of
ignores in files["test/sql-tap/**/*.lua"] in .luacheckrc.

These comments make me think that you checked the files
without using .luacheckrc config or I don't know.

I suggest you to re-make the patch with these ignores
and excess diff removed.

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

* Re: [Tarantool-patches] [PATCH v7 2/2] test: fix luacheck warnings in test/sql-tap
  2021-01-15 22:10   ` Vladislav Shpilevoy via Tarantool-patches
@ 2021-01-21 12:52     ` Sergey Bronnikov via Tarantool-patches
  0 siblings, 0 replies; 5+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-21 12:52 UTC (permalink / raw)
  To: Vladislav Shpilevoy, tarantool-patches

Thanks for review!

On 16.01.2021 01:10, Vladislav Shpilevoy wrote:
> Hi! Thanks for the patch!
>
>> diff --git a/test/sql-tap/with2.test.lua b/test/sql-tap/with2.test.lua
>> index 456ded363..cdf1d75a2 100755
>> --- a/test/sql-tap/with2.test.lua
>> +++ b/test/sql-tap/with2.test.lua
>> @@ -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(
> I reverted this entire diff hunk and luacheck passed.
> Indeed, in this hunk you only fix upvalue redefinitions,
> which we have agreed to leave as is, and you even added
> ignores to .luacheckrc to the list of global ignores:
>
>      -- Redefining a local variable.
>      "411",
>      -- Redefining an argument.
>      "412",
>      -- Shadowing a local variable.
>      "421",
>      -- Shadowing an upvalue.
>      "431",
>      -- Shadowing an upvalue argument.
>      "432",
>
> Why did you change this file?
> Also I did this and the check also has passed:
>
> diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
> index 50300cdbe..b8955531a 100755
> --- a/test/sql-tap/analyze9.test.lua
> +++ b/test/sql-tap/analyze9.test.lua
> @@ -244,7 +244,7 @@ test:do_execsql_test(
>   local function insert_filler_rows_n(iStart, nCopy, nVal)
>       for i = 0, nVal-1 do
>           local iVal = iStart+i
> -        for _ = 0, nCopy-1 do
> +        for j = 0, nCopy-1 do
>               box.execute(string.format("INSERT INTO t1 VALUES (null, %s, %s, '%s')", iVal, iVal, iVal))
>           end
>       end
>
> I reverted one of your first changes in this commit.
> The check passes because it looks like you left a ton of
> ignores in files["test/sql-tap/**/*.lua"] in .luacheckrc.
>
> These comments make me think that you checked the files
> without using .luacheckrc config or I don't know.
>
> I suggest you to re-make the patch with these ignores
> and excess diff removed.

sent updated series [1].

1. 
https://lists.tarantool.org/tarantool-patches/cover.1611232655.git.sergeyb@tarantool.org/T/#t


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

end of thread, other threads:[~2021-01-21 12:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14  8:52 [Tarantool-patches] [PATCH v7 0/2] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
2021-01-14  8:52 ` [Tarantool-patches] [PATCH v7 1/2] test: fix luacheck warnings in test/sql Sergey Bronnikov via Tarantool-patches
2021-01-14  8:52 ` [Tarantool-patches] [PATCH v7 2/2] test: fix luacheck warnings in test/sql-tap Sergey Bronnikov via Tarantool-patches
2021-01-15 22:10   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-21 12:52     ` Sergey Bronnikov via Tarantool-patches

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