[Tarantool-patches] [PATCH v8 07/14] test: fix luacheck warnings W231 in test/sql-tap

Sergey Bronnikov sergeyb at tarantool.org
Sat Jan 30 01:39:17 MSK 2021


Thanks for review!

On 24.01.2021 20:35, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> On 21.01.2021 13:50, sergeyb at tarantool.org wrote:
>> From: Sergey Bronnikov <sergeyb at tarantool.org>
>>
>> W231 (Local variable is set but never accessed)
>>
>> Part of #5464
>> ---
>> diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
>> index 5f8b206d3..b488bdc60 100755
>> --- a/test/sql-tap/e_expr.test.lua
>> +++ b/test/sql-tap/e_expr.test.lua
>> @@ -2554,9 +2550,6 @@ test:do_test(
>>   -- evaluation of the THEN expression that corresponds to the first WHEN
>>   -- expression that evaluates to true.
>>   --
>> -a = 0
>> -b = 1
>> -c = 0
> These look like an artifact of a wrong conversion from TCL to Lua.
> The variables are used in the SQL statements. I think the converter
> thought it could just declare them as Lua variables to make visible
> in SQL. Better keep them and add MUST_WORK_TEST if it is not here yet.

Reverted changes with removing variables and added luacheck inline 
suppression:

--- a/.luacheckrc
+++ b/.luacheckrc
@@ -51,8 +51,6 @@ exclude_files = {

  files["test/sql-tap/**/*.lua"] = {
      ignore = {
-        -- Local variable is set but never accessed.
-        "231",
          -- "Value assigned to a local variable is unused."
          "311",
          -- Unreachable code.
diff --git a/test/sql-tap/e_expr.test.lua b/test/sql-tap/e_expr.test.lua
index 5f8b206d3..5ecd7b7ae 100755
--- a/test/sql-tap/e_expr.test.lua
+++ b/test/sql-tap/e_expr.test.lua
@@ -2486,7 +2486,7 @@ test:do_execsql_test(
          -- </e_expr-20.2>
      })

-local a, b, c
+local a, b, c -- luacheck: ignore unused a b c
  a = 0
  b = 0
  c = 0

What does comment with MUST_WORK_TEST mean?

> So in future we would see the expected variable values, and either
> decide fix the tests or delete them entirely. The latter can easily
> happen due to how much the type system was reworked.
>
>>   test:do_execsql_test(
>>       "e_expr-21.2.1",
>>       [[


More information about the Tarantool-patches mailing list