[Tarantool-patches] [PATCH luajit 5/5] test: run luacheck static analysis via CMake
Igor Munkin
imun at tarantool.org
Fri Feb 19 22:14:19 MSK 2021
Sergey,
Thanks for your review!
On 14.02.21, Sergey Kaplun wrote:
> Hi, Igor!
>
> Thanks for the patch!
> Nice to see all LuaJIT-related stuff inside its repo!
>
> LGTM, except few questions below.
Added your tag:
| Reviewed-by: Sergey Kaplun <skaplun at tarantool.org>
>
> On 02.02.21, Igor Munkin wrote:
> > This patch introduces a separate target to run luacheck against all Lua
> > chunks within LuaJIT repository except those explicitly ignored in
> > .luacheckrc. There is also a single additional change over the 'luajit'
> > std defaults: to suppress all false positives related to <misc>
>
> Typo: defaults are standards already. 'std' or 'defatults' is redundant
> here.
No. std is the attribute of .luacheckrc. The value of this attribute is
'luajit'. The defaults of the chosen std requires an additional change.
>
> > namespace introduced in 5a61e1ab54b5c66bfebd836db1ac47996611e065 ('misc:
> > add C and Lua API for platform metrics'), this name is added to
> > <read_globals> list.
> >
> > All Lua sources originally inherited from LuaJIT vanilla repository are
> > ignored, to leave them coherent with the upstream.
> >
> > The new target is a dependency for the root <test> target.
> >
>
> Nit: Looks like you should mention tarantool/tarantool#5631 here.
> Or squash it with the previous patch.
> See rationale here [1].
> Feel free to ignore.
Answered here[1].
Ignoring.
>
> > Part of tarantool/tarantool#4862
> > Part of tarantool/tarantool#5470
> >
> > Signed-off-by: Igor Munkin <imun at tarantool.org>
> > ---
> > .gitignore | 1 +
> > .luacheckrc | 11 +++++++++++
> > test/CMakeLists.txt | 31 +++++++++++++++++++++++++++++++
> > 3 files changed, 43 insertions(+)
> > create mode 100644 .luacheckrc
> >
<snipped>
> > diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
> > index f05dd90..c89efc2 100644
> > --- a/test/CMakeLists.txt
> > +++ b/test/CMakeLists.txt
> > @@ -3,6 +3,36 @@
> > # See the rationale in the root CMakeLists.txt.
> > cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
>
> Side note: Why this version?
Answered here[2].
>
> >
> > +find_program(LUACHECK luacheck)
> > +if(LUACHECK)
> > + set(LUACHECK_RC ${PROJECT_SOURCE_DIR}/.luacheckrc)
> > + set(LUACHECK_OK ${CMAKE_CURRENT_BINARY_DIR}/luacheck.ok)
> > + file(GLOB_RECURSE LUACHECK_DEPS ${PROJECT_SOURCE_DIR}/*.lua)
> > + add_custom_command(
> > + COMMENT "Running luacheck static analysis"
> > + OUTPUT ${LUACHECK_OK}
> > + DEPENDS ${LUACHECK} ${LUACHECK_RC} ${LUACHECK_DEPS}
>
> Why are `${LUACHECK}` and `${LUACHECK_RC}` are mentioned?
To prevent target from running when strictly required luacheck or
.luacheckrc is missing.
>
> > + COMMAND
> > + ${LUACHECK} ${PROJECT_SOURCE_DIR}
> > + --codes
> > + --config ${LUACHECK_RC}
> > + && touch ${LUACHECK_OK}
> > + # XXX: Filenames in .luacheckrc are considered relative to
> > + # the working directory, hence luacheck should be run in the
> > + # project root directory.
> > + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
> > + )
>
> <snipped>
>
> > --
> > 2.25.0
> >
>
> [1]: https://lists.tarantool.org/tarantool-patches/20210214191626.GF9361@root/T/#md50dbe78c52523ca739f2751d96c61edcf2e7a36
>
> --
> Best regards,
> Sergey Kaplun
[1]:
https://lists.tarantool.org/tarantool-patches/cover.1612291495.git.imun@tarantool.org/T/#m817b6d754030b10f5b90f7602906496da10ee59f
[2]:
https://lists.tarantool.org/tarantool-patches/cover.1612291495.git.imun@tarantool.org/T/#m17cec88647c4defe2afee689dcba8d03b8b660d7
--
Best regards,
IM
More information about the Tarantool-patches
mailing list