[Tarantool-patches] [PATCH luajit 3/4][v2] cmake: introduce target with codespell
Sergey Kaplun
skaplun at tarantool.org
Mon Oct 23 12:20:58 MSK 2023
Hi, Sergey!
Thanks for the patch!
Please, consider my comments below.
On 11.10.23, Sergey Bronnikov wrote:
> From: Sergey Bronnikov <sergeyb at tarantool.org>
>
> The patch introduces a new CMake target: "LuaJIT-codespell", that
> spellchecks files specified in a whitelist by codespell [1].
>
> 1. https://github.com/codespell-project/codespell
> ---
> CMakeLists.txt | 1 +
> cmake/CodeSpell.cmake | 36 ++++++++++++++++++++++++++++++++
> test/CMakeLists.txt | 1 +
> tools/codespell-ignore-words.txt | 3 +++
> 4 files changed, 41 insertions(+)
> create mode 100644 cmake/CodeSpell.cmake
> create mode 100644 tools/codespell-ignore-words.txt
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
<snipped>
> diff --git a/cmake/CodeSpell.cmake b/cmake/CodeSpell.cmake
> new file mode 100644
> index 00000000..c4d3555d
> --- /dev/null
> +++ b/cmake/CodeSpell.cmake
> @@ -0,0 +1,36 @@
> +find_program(CODESPELL codespell)
> +
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/src/lj_mapi.c)
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/src/lj_sysprof.c)
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/src/lj_utils_leb128.c)
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/src/lj_wbuf.c)
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/src/luajit-gdb.py)
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/src/luajit_lldb.py)
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/test/CMakeLists.txt)
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/test/tarantool-c-tests)
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/test/tarantool-tests)
> +list(APPEND CODESPELL_WHITELIST ${PROJECT_SOURCE_DIR}/tools)
Also, the following files should be checked:
* src/lib_misc.c
* src/lj_memprof.c
* src/lj_memprof.h
* src/lj_sysprof.h
* src/lj_utils.h
* src/lj_wbuf.h
* src/lmisclib.h
* test/LuaJIT-tests/CMakeLists.txt
* test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt
* test/PUC-Rio-Lua-5.1-tests/CMakeLists.txt
* test/PUC-Rio-Lua-5.1-tests/libs/CMakeLists.txt
* test/lua-Harness-tests/CMakeLists.txt
> +
> +set(IGNORE_WORDS ${PROJECT_SOURCE_DIR}/tools/codespell-ignore-words.txt)
> +
> +add_custom_target(${PROJECT_NAME}-codespell)
> +if (CODESPELL)
> + add_custom_command(TARGET ${PROJECT_NAME}-codespell
> + COMMENT "Running codespell"
> + COMMAND
> + ${CODESPELL}
> + --ignore-words ${IGNORE_WORDS}
> + --skip ${IGNORE_WORDS}
> + --ignore-words-list fpr
> + --check-filenames
> + ${CODESPELL_WHITELIST}
> + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
> + )
> +else ()
> + set(WARN_MSG "`codespell' is not found, "
> + "so ${PROJECT_NAME}-codespell target is dummy")
The output is splitted (thanks CMake). I found the only way to join
lines via `string(CONCAT WARN_MSG <str1> <str2>)`.
> + add_custom_command(TARGET ${PROJECT_NAME}-codespell
> + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red ${MSG}
> + COMMENT ${MSG}
The ${MSG} is undefined, so this line does nothing and can be deleted.
> + )
> +endif (CODESPELL)
<snipped>
> diff --git a/tools/codespell-ignore-words.txt b/tools/codespell-ignore-words.txt
> new file mode 100644
> index 00000000..ceeed47c
> --- /dev/null
> +++ b/tools/codespell-ignore-words.txt
> @@ -0,0 +1,3 @@
> +mmaped
Should it be mmapped instead (like map -> mapped)?
> +isnt
> +FPR
> --
> 2.34.1
>
--
Best regards,
Sergey Kaplun
More information about the Tarantool-patches
mailing list