[Tarantool-patches] [PATCH 3/5][v3] cmake: introduce new targets

Maxim Kokryashkin m.kokryashkin at tarantool.org
Thu Aug 3 22:38:09 MSK 2023


Hi, Sergey!
Please consider my comments below.
 
> 
>>From: Sergey Bronnikov < sergeyb at tarantool.org >
>>
>>In Tarantool we use our own fork of checkpatch [1] with additional check
>>types. It's logical to use it in LuaJIT development. However, we don't
>>need to enable all checks [2] implemented in checkpatch, therefore a
>>number of checks are disabled.
>>
>>Patch introduces two new CMake targets: "LuaJIT-checkpatch", that checks
>>patches on top of the master branch using script checkpatch.pl, and
>Typo: s/using/using the/
>>target "check", that combines LuaJIT-luacheck and LuaJIT-checkpatch. By
>>default CMake looking for checkpatch.pl in a directory "checkpatch" in
>Typo: s/looking/looks/
>Typo: s/in a directory/in the directory/
>>LuaJIT repository root directory and in a directories specified in PATH.
>Typo: s/LuaJIT/the LuaJIT/
>Typo: s/a directories/directories/
> 
>>
>>1.  https://github.com/tarantool/checkpatch
>>2.  https://github.com/tarantool/checkpatch/blob/master/doc/checkpatch.rst
>>---
>> test/CMakeLists.txt | 51 +++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 51 insertions(+)
>>
>>diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
>>index 47296a22..5ec0bed6 100644
>>--- a/test/CMakeLists.txt
>>+++ b/test/CMakeLists.txt
>>@@ -42,6 +42,56 @@ else()
>>   )
>> endif()
>> 
>>+find_program(CHECKPATCH checkpatch.pl
>>+ HINTS ${PROJECT_SOURCE_DIR}/checkpatch)
>>+add_custom_target(${PROJECT_NAME}-checkpatch)
>>+set(MASTER_BRANCH "tarantool/master")
>>+if(CHECKPATCH)
>>+ add_custom_command(TARGET ${PROJECT_NAME}-checkpatch
>>+ COMMENT "Running checkpatch"
>>+ COMMAND
>>+ ${CHECKPATCH}
>>+ # Description of supported checks in
>>+ #  https://github.com/tarantool/checkpatch/blob/master/doc/checkpatch.rst
>>+ --codespell
>>+ --color=always
>>+ --git ${MASTER_BRANCH}..HEAD
>>+ --show-types
>>+ --ignore BAD_SIGN_OFF
>>+ --ignore BLOCK_COMMENT_STYLE
>>+ --ignore CODE_INDENT
>>+ --ignore COMMIT_LOG_LONG_LINE
>>+ # Requires at least two lines in commit message and this
>>+ # is annoying.
>>+ --ignore COMMIT_MESSAGE
>>+ --ignore CONSTANT_COMPARISON
>>+ --ignore FUNCTION_NAME_NO_NEWLINE
>>+ --ignore GIT_COMMIT_ID
>>+ --ignore INCLUDE_GUARD
>>+ --ignore LOGICAL_CONTINUATIONS
>>+ --ignore LONG_LINE
>>+ --ignore NO_CHANGELOG
>>+ --ignore NO_DOC
>>+ --ignore NO_TEST
>>+ --ignore PREFER_DEFINED_ATTRIBUTE_MACRO
>>+ --ignore SPACING
>>+ --ignore SUSPECT_CODE_INDENT
>>+ --ignore TABSTOP
>>+ --ignore TRAILING_STATEMENTS
>>+ --ignore UNCOMMENTED_DEFINITION
>>+ --ignore UNSAFE_FUNCTION
>>+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
>>+ )
>>+else()
>I suggest doing the same as with coverage — move that logic into a separate module,
>so the test/CMakeLists.txt remains readable and clean.
>>+ add_custom_command(TARGET ${PROJECT_NAME}-checkpatch
>>+ COMMENT "`checkpatch.pl' is not found, so ${PROJECT_NAME}-checkpatch target is dummy"
>>+ )
>>+endif()
>>+
>>+add_custom_target(check
>>+ DEPENDS ${PROJECT_NAME}-checkpatch ${PROJECT_NAME}-luacheck
>>+)
>>+
>> set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
>> separate_arguments(LUAJIT_TEST_COMMAND)
>> 
>>@@ -75,5 +125,6 @@ if(LUAJIT_USE_TEST)
>>   add_custom_target(test DEPENDS
>>     ${PROJECT_NAME}-test
>>     ${PROJECT_NAME}-luacheck
>>+ ${PROJECT_NAME}-checkpatch
>>   )
>> endif()
>>--
>>2.34.1
>--
>Best regards,
>Maxim Kokryashkin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20230803/6696f342/attachment.htm>


More information about the Tarantool-patches mailing list