Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org
Subject: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap
Date: Thu, 21 Jan 2021 15:49:57 +0300	[thread overview]
Message-ID: <3a5360daf42cd920e3ce536020a6ff2fbccc095e.1611232655.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1611232655.git.sergeyb@tarantool.org>

From: Sergey Bronnikov <sergeyb@tarantool.org>

W113 (Accessing an undefined global variable)

Part of #5464
---
 .luacheckrc                    |  37 +++++++++-
 test/sql-tap/badutf1.test.lua  |  10 ++-
 test/sql-tap/index1.test.lua   |   2 +-
 test/sql-tap/lua/sqltester.lua |   2 +-
 test/sql-tap/lua_sql.test.lua  |   6 +-
 test/sql-tap/minmax2.test.lua  |   2 +
 test/sql-tap/select1.test.lua  |   4 ++
 test/sql-tap/subquery.test.lua |   7 +-
 test/sql-tap/table.test.lua    |   6 +-
 test/sql-tap/tkt1443.test.lua  |   2 +-
 test/sql-tap/trigger9.test.lua |   1 +
 test/sql-tap/triggerC.test.lua |   1 -
 test/sql-tap/view.test.lua     | 126 +++++++++++++++------------------
 13 files changed, 122 insertions(+), 84 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 81aa61a2b..eb709d6a3 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {
 
 files["test/sql-tap/**/*.lua"] = {
     ignore = {
-        -- Accessing an undefined global variable.
-        "113",
         -- Unused local variable.
         "211",
         -- Unused argument.
@@ -124,3 +122,38 @@ files["test/box-tap/extended_error.test.lua"] = {
         "forbidden_function",
     },
 }
+files["test/sql-tap/analyze5.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/cast.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/func.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/e_expr.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/e_select1.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/misc1.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
+files["test/sql-tap/sort.test.lua"] = {
+    ignore = {
+        "113",
+    },
+}
diff --git a/test/sql-tap/badutf1.test.lua b/test/sql-tap/badutf1.test.lua
index 654629bf7..b7fa8ce0b 100755
--- a/test/sql-tap/badutf1.test.lua
+++ b/test/sql-tap/badutf1.test.lua
@@ -93,8 +93,12 @@ test:do_test(
     })
 
 -- commented as it uses utf16
-if 0>0 then
-sql("db2", "")
+-- testcases are broken
+-- https://github.com/tarantool/tarantool/issues/5743
+local is_gh_5743_closed = false
+if is_gh_5743_closed then
+sql("db2", "") -- luacheck: ignore sql
+-- luacheck: push ignore sql_exec
 test:do_test(
     "badutf-1.10",
     function()
@@ -206,7 +210,7 @@ test:do_test(
         -- </badutf-1.20>
     })
 end
-
+-- luacheck: pop
 
 
 test:do_test(
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index ea25727a4..574faafd6 100755
--- a/test/sql-tap/index1.test.lua
+++ b/test/sql-tap/index1.test.lua
@@ -585,7 +585,7 @@ test:do_test(
         for i = 1, 50, 1 do
             test:execsql(string.format("INSERT INTO t3 VALUES('x%sx',%s,0.%s)", i, i, i))
         end
-        local sql_search_count = 0
+        -- luacheck: ignore X
         return X(381, "X!cmd", [=[["concat",[["execsql","SELECT c FROM t3 WHERE b==10"]],["sql_search_count"]]]=])
     end, {
         -- <index-11.1>
diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 169d2f271..bfd14a1a7 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -86,7 +86,7 @@ local function is_deeply_regex(got, expected)
     end
 
     if string_regex_p(expected) then
-        return table_match_regex_p(got, expected)
+        return table_match_regex_p(got, expected) -- luacheck: ignore table_match_regex_p
     end
 
     if got == nil and expected == nil then return true end
diff --git a/test/sql-tap/lua_sql.test.lua b/test/sql-tap/lua_sql.test.lua
index b22f195ca..4704970c8 100755
--- a/test/sql-tap/lua_sql.test.lua
+++ b/test/sql-tap/lua_sql.test.lua
@@ -75,9 +75,10 @@ box.schema.func.create('CHECK_FROM_SQL_TO_LUA', {language = 'Lua',
                        exports = {'LUA', 'SQL'}})
 
 -- check for different types
-for i = 1, #from_sql_to_lua, 1 do
+for i = 1, #from_sql_to_lua, 1 do -- luacheck: ignore from_sql_to_lua
     test:do_execsql_test(
         "lua_sql-2.2."..i,
+        -- luacheck: ignore from_sql_to_lua
         "select check_from_sql_to_lua("..i..","..from_sql_to_lua[i][1]..")",
         {1})
 end
@@ -102,9 +103,10 @@ box.schema.func.create('CHECK_FROM_LUA_TO_SQL', {language = 'Lua',
                        exports = {'LUA', 'SQL'}})
 
 -- check for different types
-for i = 1, #from_lua_to_sql, 1 do
+for i = 1, #from_lua_to_sql, 1 do -- luacheck: ignore from_lua_to_sql
     test:do_execsql_test(
         "lua_sql-2.3."..i,
+        -- luacheck: ignore from_lua_to_sql
         "select "..tostring(from_lua_to_sql[i][1]).." = check_from_lua_to_sql("..i..")",
         {true})
 end
diff --git a/test/sql-tap/minmax2.test.lua b/test/sql-tap/minmax2.test.lua
index f3d608aab..b6c02a4cc 100755
--- a/test/sql-tap/minmax2.test.lua
+++ b/test/sql-tap/minmax2.test.lua
@@ -72,6 +72,7 @@ test:do_test(
 test:do_test(
     "minmax2-1.2",
     function()
+        -- luacheck: ignore sql_search_count
         return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
@@ -89,6 +90,7 @@ test:do_test(
 test:do_test(
     "minmax2-1.4",
     function()
+        -- luacheck: ignore sql_search_count
         return box.stat.sql().sql_search_count - sql_search_count
     end, 19)
 
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index 0e7c5a318..99bcce93b 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -1556,6 +1556,7 @@ test:do_test(
         return box.execute("SELECT * FROM test1 WHERE f1<0").metadata
     end, {
         -- <select1-9.2>
+        -- luacheck: ignore F1 and F2 and INTEGER
         {name = F1, type = INTEGER},{name = F2, type = INTEGER}
         -- </select1-9.2>
     })
@@ -1566,6 +1567,7 @@ test:do_test(
             return box.execute("SELECT * FROM test1 WHERE f1<(select count(*) from test2)").metadata
         end, {
             -- <select1-9.3>
+            -- luacheck: ignore F1 and F2 and INTEGER
             {name = F1, type = INTEGER},{name = F2, type = INTEGER}
             -- </select1-9.3>
         })
@@ -1578,6 +1580,7 @@ test:do_test(
         return box.execute("SELECT * FROM test1 ORDER BY f1").metadata
     end, {
         -- <select1-9.4>
+        -- luacheck: ignore F1 and F2 and INTEGER
         {name = F1, type = INTEGER},{name = F2, type = INTEGER}
         -- </select1-9.4>
     })
@@ -1588,6 +1591,7 @@ test:do_test(
         return box.execute("SELECT * FROM test1 WHERE f1<0 ORDER BY f1").metadata
     end, {
         -- <select1-9.5>
+        -- luacheck: ignore F1 and F2 and INTEGER
         {name = F1, type = INTEGER},{name = F2, type = INTEGER}
         -- </select1-9.5>
     })
diff --git a/test/sql-tap/subquery.test.lua b/test/sql-tap/subquery.test.lua
index f57a22624..2f92da96c 100755
--- a/test/sql-tap/subquery.test.lua
+++ b/test/sql-tap/subquery.test.lua
@@ -684,7 +684,7 @@ test:do_test(
         -- This is the key test.  The subquery should have only run once.  If
         -- The double-quoted identifier "two" were causing the subquery to be
         -- processed as a correlated subquery, then it would have run 4 times.
-        return callcnt
+        return callcnt -- luacheck: ignore callcnt
     end, 1)
 
 -- Ticket #1380.  Make sure correlated subqueries on an IN clause work
@@ -706,7 +706,8 @@ test:do_test(
 test:do_test(
     "subquery-6.2",
     function()
-        return callcnt
+        return callcnt -- luacheck: ignore callcnt
+
     end, 4)
 
 test:do_test(
@@ -725,7 +726,7 @@ test:do_test(
 test:do_test(
     "subquery-6.4",
     function()
-        return callcnt
+        return callcnt -- luacheck: ignore callcnt
     end, 1)
 
 box.func.CALLCNT:drop()
diff --git a/test/sql-tap/table.test.lua b/test/sql-tap/table.test.lua
index 6e45dbab1..2817e1e72 100755
--- a/test/sql-tap/table.test.lua
+++ b/test/sql-tap/table.test.lua
@@ -417,7 +417,10 @@ test:do_test(
 
 test:drop_all_tables()
 -- MUST_WORK_TEST
-if (0 > 0)
+-- testcase is broken
+-- https://github.com/tarantool/tarantool/issues/5742
+local is_gh_5742_closed = false
+if is_gh_5742_closed
  then
     test:do_test(
         "table-5.2.2",
@@ -437,6 +440,7 @@ if (0 > 0)
             -- </table-5.2.2>
         })
 
+    -- luacheck: ignore X
     X(313, "X!cmd", [=[["Make","sure","an","EXPLAIN","does","not","really","create","a","new","table"]]=])
 end
 test:do_test(
diff --git a/test/sql-tap/tkt1443.test.lua b/test/sql-tap/tkt1443.test.lua
index d1d837e72..f40ca16d1 100755
--- a/test/sql-tap/tkt1443.test.lua
+++ b/test/sql-tap/tkt1443.test.lua
@@ -115,7 +115,7 @@ test:do_test(
             );
             INSERT INTO Permissions VALUES(1, 0, 0, 1, 0, 1);
             INSERT INTO Permissions VALUES(2, 2, 4, 0, 0, 0);
-        ]], d))
+        ]], d)) -- luacheck: ignore d
     end, {
         -- <tkt1443-1.0>
 
diff --git a/test/sql-tap/trigger9.test.lua b/test/sql-tap/trigger9.test.lua
index 5c1f4cbb2..b8e1fc876 100755
--- a/test/sql-tap/trigger9.test.lua
+++ b/test/sql-tap/trigger9.test.lua
@@ -1,5 +1,6 @@
 #!/usr/bin/env tarantool
 _G.test = require("sqltester")
+local test = _G.test
 test:plan(28)
 
 --!./tcltestrunner.lua
diff --git a/test/sql-tap/triggerC.test.lua b/test/sql-tap/triggerC.test.lua
index e95641938..7d496bc4d 100755
--- a/test/sql-tap/triggerC.test.lua
+++ b/test/sql-tap/triggerC.test.lua
@@ -791,7 +791,6 @@ for testno, v in ipairs(tests11) do
                 SELECT a,b FROM log;
             ]]
         end, {
-            defaults
         })
 
     --
diff --git a/test/sql-tap/view.test.lua b/test/sql-tap/view.test.lua
index 2f1af29b0..67f461132 100755
--- a/test/sql-tap/view.test.lua
+++ b/test/sql-tap/view.test.lua
@@ -1,6 +1,6 @@
 #!/usr/bin/env tarantool
 local test = require("sqltester")
-test:plan(78)
+test:plan(83)
 
 --!./tcltestrunner.lua
 -- 2002 February 26
@@ -501,21 +501,18 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-    test:do_test(
-        "view-7.2",
-        function()
-            return test:execsql [[
-                SELECT * FROM test;
-            ]]
-        end, {
-            -- <view-7.2>
-            1, 2, 3
-            -- </view-7.2>
-        })
+test:do_test(
+    "view-7.2",
+    function()
+        return test:execsql [[
+            SELECT * FROM test;
+        ]]
+    end, {
+        -- <view-7.2>
+        1, 2, 3
+        -- </view-7.2>
+    })
 
-end
 test:do_execsql_test(
     "view-7.3",
     [[
@@ -531,21 +528,18 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-    test:do_test(
-        "view-7.4",
-        function()
-            return test:execsql [[
-                SELECT * FROM test;
-            ]]
-        end, {
-            -- <view-7.4>
-            1, 2, 3
-            -- </view-7.4>
-        })
+test:do_test(
+    "view-7.4",
+    function()
+        return test:execsql [[
+            SELECT * FROM test;
+        ]]
+    end, {
+        -- <view-7.4>
+        1, 2, 3
+        -- </view-7.4>
+    })
 
-end
 test:do_execsql_test(
     "view-7.5",
     [[
@@ -561,21 +555,18 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-    test:do_test(
-        "view-7.6",
-        function()
-            return test:execsql [[
-                SELECT * FROM test;
-            ]]
-        end, {
-            -- <view-7.6>
-            1, 2, 3
-            -- </view-7.6>
-        })
+test:do_test(
+    "view-7.6",
+    function()
+        return test:execsql [[
+            SELECT * FROM test;
+        ]]
+    end, {
+        -- <view-7.6>
+        1, 2, 3
+        -- </view-7.6>
+    })
 
-end
 test:do_execsql_test(
     "view-8.1",
     [[
@@ -588,33 +579,29 @@ test:do_execsql_test(
     })
 
 -- MUST_WORK_TEST
-if (0 > 0)
- then
-    test:do_test(
-        "view-8.2",
-        function()
-            return test:execsql [[
-                SELECT * FROM v6 ORDER BY xyz;
-            ]]
-        end, {
-            -- <view-8.2>
-            7, 2, 13, 5, 19, 8, 27, 12
-            -- </view-8.2>
-        })
-
-    -- MUST_WORK_TEST problem with column names
-    test:do_execsql_test(
-        "view-8.3",
-        [[
-            CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
-            SELECT * FROM v7 ORDER BY a;
-        ]], {
-            -- <view-8.3>
-            9, 18, 27, 39
-            -- </view-8.3>
-        })
+test:do_test(
+    "view-8.2",
+    function()
+        return test:execsql [[
+            SELECT * FROM v6 ORDER BY xyz;
+        ]]
+    end, {
+        -- <view-8.2>
+        7, 2, 13, 5, 19, 8, 27, 12
+        -- </view-8.2>
+    })
 
-end
+-- MUST_WORK_TEST problem with column names
+test:do_execsql_test(
+    "view-8.3",
+    [[
+        CREATE VIEW v7(a) AS SELECT pqr+xyz FROM v6;
+        SELECT * FROM v7 ORDER BY a;
+    ]], {
+        -- <view-8.3>
+        9, 18, 27, 39
+        -- </view-8.3>
+    })
 
 test:do_execsql_test(
     "view-8.4",
@@ -1124,6 +1111,7 @@ if (0 > 0)
         function()
             -- ["unset","-nocomplain","x"]
             test:execsql("SELECT * FROM x1 x break")
+            -- luacheck: ignore X
             return X(797, "X!cmd", [=[["lsort",[["array","names","x"]]]]=])
         end, {
             -- <view-22.2>
-- 
2.25.1


  parent reply	other threads:[~2021-01-21 12:51 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-21 12:49 [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Sergey Bronnikov via Tarantool-patches
2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 01/14] test: fix luacheck warnings in test/sql Sergey Bronnikov via Tarantool-patches
2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 02/14] test: remove functions to open and close SQL connection Sergey Bronnikov via Tarantool-patches
2021-01-21 12:49 ` Sergey Bronnikov via Tarantool-patches [this message]
2021-01-24 17:33   ` [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap Vladislav Shpilevoy via Tarantool-patches
2021-02-06 17:52     ` Vladislav Shpilevoy via Tarantool-patches
2021-02-16 12:02     ` Sergey Bronnikov via Tarantool-patches
2021-02-23 21:25       ` Vladislav Shpilevoy via Tarantool-patches
2021-02-25 10:39         ` Sergey Bronnikov via Tarantool-patches
2021-02-26 23:42   ` Vladislav Shpilevoy via Tarantool-patches
2021-02-27 17:53     ` Sergey Bronnikov via Tarantool-patches
2021-02-28 15:30       ` Vladislav Shpilevoy via Tarantool-patches
2021-03-01 13:26         ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:49 ` [Tarantool-patches] [PATCH v8 04/14] test: fix luacheck warnings W211 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:34   ` Vladislav Shpilevoy via Tarantool-patches
2021-02-16 14:09     ` Sergey Bronnikov via Tarantool-patches
2021-02-23 21:26   ` Vladislav Shpilevoy via Tarantool-patches
2021-02-25 11:02     ` Sergey Bronnikov via Tarantool-patches
2021-02-26 23:42       ` Vladislav Shpilevoy via Tarantool-patches
2021-02-27 17:09         ` Sergey Bronnikov via Tarantool-patches
2021-02-28 15:30           ` Vladislav Shpilevoy via Tarantool-patches
2021-03-01 13:46             ` Sergey Bronnikov via Tarantool-patches
2021-03-01 21:27               ` Vladislav Shpilevoy via Tarantool-patches
2021-03-02  8:05                 ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 05/14] test: fix luacheck warnings W212 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 06/14] test: fix laucheck warnings W213 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 16:32     ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 07/14] test: fix luacheck warnings W231 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:35   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 22:39     ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 08/14] test: fix luacheck warnings W311 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 09/14] test: fix luacheck warnings W511 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 10/14] test: fix luacheck warnings W512 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 11/14] test: fix luacheck warnings W542 " Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 12/14] test: fix luacheck warnings W612, W613, W614 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:36   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 16:23     ` Sergey Bronnikov via Tarantool-patches
2021-01-29 21:50       ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 13/14] test: fix luacheck warnings W621 " Sergey Bronnikov via Tarantool-patches
2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 16:11     ` Sergey Bronnikov via Tarantool-patches
2021-01-21 12:50 ` [Tarantool-patches] [PATCH v8 14/14] luacheck: add issues for suppressed warnings Sergey Bronnikov via Tarantool-patches
2021-01-24 17:37   ` Vladislav Shpilevoy via Tarantool-patches
2021-01-29 16:13     ` Sergey Bronnikov via Tarantool-patches
2021-03-01 21:37 ` [Tarantool-patches] [PATCH v8 00/14] Fix luacheck warnings in test/sql and test/sql-tap Vladislav Shpilevoy via Tarantool-patches
2021-03-02  9:47 ` Kirill Yukhin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3a5360daf42cd920e3ce536020a6ff2fbccc095e.1611232655.git.sergeyb@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v8 03/14] test: fix luacheck warnings W113 in test/sql-tap' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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