Tarantool development patches archive
 help / color / mirror / Atom feed
From: Igor Munkin <imun@tarantool.org>
To: sergeyb@tarantool.org
Cc: o.piskunov@tarantool.org, tarantool-patches@dev.tarantool.org,
	v.shpilevoy@tarantool.org, alexander.turenko@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v6 09/25] Fix luacheck warnings in test/box
Date: Mon, 1 Jun 2020 19:06:42 +0300	[thread overview]
Message-ID: <20200601160642.GS21558@tarantool.org> (raw)
In-Reply-To: <8c80f5ce9c990027db258b1915d2e054a0fa90b3.1590764167.git.sergeyb@tarantool.org>

Sergey,

Thanks for the patch!

Again, I see a mess in the branch. Please review yourself before sending
the patchset: mixed tabs and spaces, unsorted enries in .luacheckrc --
we are talking about it since I joined the review (i.e. v3 series). Now
it's a v6 and I definitely don't want another one, but I doubt we will
avoid it. Furthermore the changes you made in scope of this patch just
partially fix the problem. Yes, I see you committed/rebased some
follow-up patches on the branch few hours ago and it's another
consequence of omitting self-review. Hasty fixes are not necessary (I
have another patchesets to be reviewed and my own tasks), but pointing
to the same mistakes just makes me frustrating. It would be great if you
re-check yourself once more before running git send-email next time.
This will definitely make the review process much easier, efficient and
ergo faster.

Please send follow-up patches to this thread, since it's too hard to
comment the changes you made after the series was sent.

I reviewed this one and its follow-up you recently pushed. Please
consider the comments below.

On 29.05.20, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Part of #4681
> 
> Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> Reviewed-by: Igor Munkin <imun@tarantool.org>
> 
> Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> Co-authored-by: Igor Munkin <imun@tarantool.org>
> ---
>  .luacheckrc                        | 13 +++++++++++++
>  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 ++--
>  24 files changed, 51 insertions(+), 46 deletions(-)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index 630834e16..f99cc17eb 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -41,3 +41,16 @@ files["src/box/lua/schema.lua"] = {globals = {"tonumber64"}, ignore = {"431", "4
>  files["test/app/lua/fiber.lua"] = {globals = {"box_fiber_run_test"}}
>  files["test/app-tap/lua/require_mod.lua"] = {globals = {"exports"}}
>  files["test/app-tap/string.test.lua"] = {globals = {"utf8"}}
> +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"}

One more time: please sort the entries. It *really* helps for reviewing
and further maintenance. I don't want to refer the last time I was
asking it, please just fix.

One more time: please adjust the indentation (tabs vs spaces) and to use
only one as we already discussed several times. I don't want to refer
the last time I was asking it, please just fix.

Furthermore, I can't figure out the rules you're using for indentation.
.luacheckrc is kinda Lua source file, so please adjust it regarding our
contrubition guide. The result should be similar to the example below:
| files["test/box/lua/bitset.lua"] = {
|     globals = {
|         "create_space", "fill", "delete", "clear", "drop_space",
|         "dump", "test_insert_delete"
|     }
| }

Feel free to put each global entry to a seraparate line if it seems
better for you.

> +}
> +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"}}

<snipped>

I see no rule for checking .result files, *but* I know the exact reason,
why I see such changes in the patch. The mask ought to be updated *prior
to or together with* the changes. Please remove this change, since
test/box/hash_miltipart.test.lua is a diff-based test, thereby has to be
skipped by luacheck as we discussed several times.

> 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

<snipped>

I failed to find any source that uses require_init.lua, require_mod.lua
(except require_init.lua) and test_init.lua. Looks these chunk can be
just dropped. But I'm totally against such actions in scope of this
patch, so please revert the changes related to these files, add them to
the exclude list like you did for test_init.lua in the follow-up patch
and create an issue for further actions.

> diff --git a/test/box/lua/require_init.lua b/test/box/lua/require_init.lua

<snipped>

> diff --git a/test/box/lua/test_init.lua b/test/box/lua/test_init.lua

<snipped>

> 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

Here is the diff from the follow-up patch:

| diff --git a/test/box/on_schema_init.lua b/test/box/on_schema_init.lua
| index f74d6d7fe..a32470b40 100644
| --- a/test/box/on_schema_init.lua
| +++ b/test/box/on_schema_init.lua
| @@ -1,12 +1,12 @@
|  #!/usr/bin/env tarantool
|  local os = require('os')
|  
| -function test_before_replace_trig(old, new)
| +local function test_before_replace_trig(old, new) -- luacheck: ignore

I see no reason to use "ignore" here and below instead of "no unused
args" that explicitly describes the suppressed warning.

|      -- return multiple values so that the stack fills earlier.
|      return new:update{{'+', 2, 1}}, new:update{{'+', 2, 1}}, new:update{{'+', 2, 1}}, new:update{{'+', 2, 1}}
|  end
|  
| -function space_on_replace_trig(old, new)
| +local function space_on_replace_trig(old, new) -- luacheck: ignore
|      if new and new[3] == 'test_on_schema_init' then
|          box.on_commit(function()
|              box.space.test_on_schema_init:before_replace(test_before_replace_trig)
| @@ -14,7 +14,7 @@ function space_on_replace_trig(old, new)
|      end
|  end
|  
| -function on_init_trig()
| +local function on_init_trig()
|      box.space._space:on_replace(space_on_replace_trig)
|  end
|  

<snipped>

Again, the changeset below is made for diff-based tests, please drop it.

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

-- 
Best regards,
IM

  reply	other threads:[~2020-06-01 16:15 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29 15:08 [Tarantool-patches] [PATCH v6 00/25] Add static analysis with luacheck sergeyb
2020-05-29 15:08 ` [Tarantool-patches] [PATCH v6 01/25] Add initial luacheck config sergeyb
2020-05-29 16:04   ` Igor Munkin
2020-05-29 16:27     ` Igor Munkin
2020-05-30 12:19       ` Sergey Bronnikov
2020-05-30 12:18     ` Sergey Bronnikov
2020-05-29 15:08 ` [Tarantool-patches] [PATCH v6 02/25] build: enable 'make luacheck' target sergeyb
2020-05-29 16:28   ` Igor Munkin
2020-05-29 15:08 ` [Tarantool-patches] [PATCH v6 03/25] gitlab-ci: enable static analysis with luacheck sergeyb
2020-05-29 19:25   ` Igor Munkin
2020-06-01  9:29     ` Sergey Bronnikov
2020-06-01  9:48       ` Igor Munkin
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 04/25] Fix luacheck warnings in extra/dist/tarantoolctl.in sergeyb
2020-05-29 16:35   ` Igor Munkin
2020-06-01 14:10   ` Alexander Turenko
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 05/25] Fix luacheck warnings in src/lua/ sergeyb
2020-05-29 16:51   ` Igor Munkin
2020-05-29 19:13     ` Igor Munkin
2020-05-30 12:15       ` Sergey Bronnikov
2020-06-01  9:43         ` Igor Munkin
2020-06-01 10:36           ` Sergey Bronnikov
2020-06-01  9:38     ` Sergey Bronnikov
2020-06-01 14:47   ` Alexander Turenko
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 06/25] Fix luacheck warnings in src/box/lua/ sergeyb
2020-05-29 19:11   ` Igor Munkin
2020-05-30 12:22     ` Sergey Bronnikov
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 07/25] Supress luacheck warnings in test/app sergeyb
2020-06-01 10:11   ` Igor Munkin
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 08/25] Fix luacheck warnings in test/app-tap sergeyb
2020-06-01 11:41   ` Igor Munkin
2020-07-16 11:44     ` Sergey Bronnikov
2020-07-16 12:42       ` Igor Munkin
2020-07-16 13:25         ` Sergey Bronnikov
2020-06-01 13:37   ` Alexander Turenko
2020-06-01 16:37     ` Igor Munkin
2020-06-01 17:13       ` Alexander Turenko
2020-06-01 17:38         ` Igor Munkin
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 09/25] Fix luacheck warnings in test/box sergeyb
2020-06-01 16:06   ` Igor Munkin [this message]
2020-07-16 13:23     ` Sergey Bronnikov
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 10/25] Fix luacheck warnings in test/box-py sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 11/25] Fix luacheck warnings in test/box-tap sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 12/25] Fix luacheck warnings in test/engine sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 13/25] Fix luacheck warnings in test/engine_long sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 14/25] Fix luacheck warnings in test/long_run-py sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 15/25] Fix luacheck warnings in test/replication sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 16/25] Fix luacheck warnings in test/replication-py sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 17/25] Fix luacheck warnings in test/sql sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 18/25] Fix luacheck warnings in test/sql-tap sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 19/25] Fix luacheck warnings in test/swim sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 20/25] Fix luacheck warnings in test/vinyl sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 21/25] Fix luacheck warnings in test/wal_off sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 22/25] Fix luacheck warnings in test/xlog sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 23/25] Fix luacheck warnings in test/xlog-py sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 24/25] Add luacheck supressions for luajit tests sergeyb
2020-05-29 15:09 ` [Tarantool-patches] [PATCH v6 25/25] luajit: bump new version sergeyb
2020-06-01 17:08 ` [Tarantool-patches] [PATCH v6 00/25] Add static analysis with luacheck Vladislav Shpilevoy
2020-06-01 17:29   ` Alexander Turenko
2020-06-01 18:13     ` Igor Munkin
2020-06-02 14:42 ` Alexander Turenko
2020-06-02 15:58   ` Igor Munkin

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=20200601160642.GS21558@tarantool.org \
    --to=imun@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=o.piskunov@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v6 09/25] Fix luacheck warnings in test/box' \
    /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