Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: sergeyb@tarantool.org, tarantool-patches@dev.tarantool.org,
	imun@tarantool.org
Cc: alexander.turenko@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 6/6] Fix luacheck warnings in src/box/lua/
Date: Sat, 6 Jun 2020 20:03:33 +0200	[thread overview]
Message-ID: <a1c4bef1-6495-5e0e-faf0-ab3779b4aa6e@tarantool.org> (raw)
In-Reply-To: <ccfdf69c72fd2364a381f1c89a8025268ac84e89.1591259297.git.sergeyb@tarantool.org>

Thanks for the patch!

See 7 comments below.

On 04/06/2020 10:39, sergeyb@tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb@tarantool.org>
> 
> Part of #4681
> 
> Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
> ---
>  .luacheckrc                     | 10 +++++--
>  src/box/lua/console.lua         | 10 +++----
>  src/box/lua/feedback_daemon.lua |  2 +-
>  src/box/lua/key_def.lua         |  2 +-
>  src/box/lua/load_cfg.lua        | 11 ++++---
>  src/box/lua/net_box.lua         | 52 +++++++++++++--------------------
>  src/box/lua/schema.lua          | 44 +++++++++++++---------------
>  src/box/lua/tuple.lua           |  8 ++---
>  src/box/lua/upgrade.lua         | 19 ++++++------
>  9 files changed, 73 insertions(+), 85 deletions(-)
> 
> diff --git a/.luacheckrc b/.luacheckrc
> index fb8b9dfb3..9fd017629 100644
> --- a/.luacheckrc
> +++ b/.luacheckrc
> @@ -19,7 +20,7 @@ include_files = {
>  
>  exclude_files = {
>      "build/**/*.lua",
> -    "src/box/**/*.lua",
> +    "src/box/lua/serpent.lua", -- third-party source code

1. I see the comments are getting less and less strict in every new patch.
Please, be consistent. Use a capital letter to start a sentence, and end it
with dot.

>      "test-run/**/*.lua",
>      "test/**/*.lua",
>      "third_party/**/*.lua",
> diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua
> index 9560bfdd4..f71744014 100644
> --- a/src/box/lua/net_box.lua
> +++ b/src/box/lua/net_box.lua
> @@ -187,7 +183,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

2. Unnecessary diff. I reverted this line and nothing changed.

>      local begin = fiber.clock()
>      local s = socket.tcp_connect(host, port, timeout)
>      if not s then
> diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua
> index cdfbb65f7..4fe0ff8da 100644
> --- a/src/box/lua/schema.lua
> +++ b/src/box/lua/schema.lua
> @@ -846,7 +844,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]

3. Ditto.

>              if tuple ~= nil and tuple.is_generated then
>                  box.error(box.error.ALTER_SPACE, space_name,
>                            "can not attach generated sequence")
> @@ -2681,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

4. Ditto.

>      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..87f53258b 100644
> --- a/src/box/lua/tuple.lua
> +++ b/src/box/lua/tuple.lua
> @@ -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)

5. Ditto.

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

6. Ditto.

>      if tuple == nil then
>          return box.error()
>      end
> 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
> @@ -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 = {}

7. Ditto.

>      format[1] = {type='string', name='key'}
>      format[2] = {type='any', name='value', is_nullable=true}
>      box.space._schema:format(format)

  reply	other threads:[~2020-06-06 18:03 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04  8:39 [Tarantool-patches] [PATCH 0/6] Add static analysis of Lua code in src/ and extra/ with luacheck sergeyb
2020-06-04  8:39 ` [Tarantool-patches] [PATCH 1/6] Add initial luacheck config sergeyb
2020-06-06 18:02   ` Vladislav Shpilevoy
2020-06-09 16:16     ` Sergey Bronnikov
2020-06-04  8:39 ` [Tarantool-patches] [PATCH 2/6] build: enable 'make luacheck' target sergeyb
2020-06-04  8:39 ` [Tarantool-patches] [PATCH 3/6] gitlab-ci: enable static analysis with luacheck sergeyb
2020-06-04  8:39 ` [Tarantool-patches] [PATCH 4/6] Fix luacheck warnings in extra/dist/ sergeyb
2020-06-06 18:02   ` Vladislav Shpilevoy
2020-06-09 16:17     ` Sergey Bronnikov
2020-06-19 23:15   ` Vladislav Shpilevoy
2020-07-05 16:28     ` Vladislav Shpilevoy
2020-07-12 15:37       ` Vladislav Shpilevoy
2020-07-13 10:01     ` Sergey Bronnikov
2020-06-04  8:39 ` [Tarantool-patches] [PATCH 5/6] Fix luacheck warnings in src/lua/ sergeyb
2020-06-06 18:03   ` Vladislav Shpilevoy
2020-06-11 12:00     ` Sergey Bronnikov
2020-06-11 19:52       ` Vladislav Shpilevoy
2020-06-18  9:32         ` Sergey Bronnikov
2020-06-18  9:35       ` Sergey Bronnikov
2020-06-11 17:22     ` Igor Munkin
2020-07-05 16:28   ` Vladislav Shpilevoy
2020-07-10 16:55     ` Sergey Bronnikov
2020-07-12 15:37       ` Vladislav Shpilevoy
2020-07-13  9:51         ` Sergey Bronnikov
2020-07-13 22:59   ` Vladislav Shpilevoy
2020-06-04  8:39 ` [Tarantool-patches] [PATCH 6/6] Fix luacheck warnings in src/box/lua/ sergeyb
2020-06-06 18:03   ` Vladislav Shpilevoy [this message]
2020-06-11 12:01     ` Sergey Bronnikov
2020-06-18  9:37       ` Sergey Bronnikov
2020-06-19 23:15   ` Vladislav Shpilevoy
2020-07-01 14:02     ` Sergey Bronnikov
2020-07-13 22:59   ` Vladislav Shpilevoy
2020-07-14 10:54     ` Sergey Bronnikov
2020-07-14 11:24       ` Sergey Bronnikov
2020-06-04  8:43 ` [Tarantool-patches] [PATCH 0/6] Add static analysis of Lua code in src/ and extra/ with luacheck Sergey Bronnikov
2020-06-19 23:15   ` Vladislav Shpilevoy
2020-07-13  9:53     ` Sergey Bronnikov
2020-06-04  9:04 ` Igor Munkin
2020-06-04 11:17 ` Sergey Bronnikov
2020-07-14 22:49 ` Vladislav Shpilevoy
2020-07-15  9:51 ` Kirill Yukhin

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=a1c4bef1-6495-5e0e-faf0-ab3779b4aa6e@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=imun@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 6/6] Fix luacheck warnings in src/box/lua/' \
    /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