Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: tarantool-patches@dev.tarantool.org,
	Sergey Kaplun <skaplun@tarantool.org>,
	max.kokryashkin@gmail.com
Subject: [Tarantool-patches] [PATCH 3/4][v2] cmake: introduce 'check' and 'LuaJIT-checkpatch' targets
Date: Mon, 17 Jul 2023 16:34:36 +0300	[thread overview]
Message-ID: <1c8a5c13c50a2561ebe5d3f82749df644fe2a352.1689600525.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1689600525.git.sergeyb@tarantool.org>

From: Sergey Bronnikov <sergeyb@tarantool.org>

In Tarantool we use our own fork of checkpatch [2] with additional check
types. It's logical to use it in a LuaJIT development. We don't need
check tags in commit messages like NO_DOC, NO_CHANGELOG, NO_TEST and
others, so to be able to customize command-line options Github Action, provided
by checkpatch repository [3], was added to the repository.

See documentation for used checkpatch in [4].

Patch introduce new CMake targets: LuaJIT-checkpatch, that checks
patches on top of master branch using script checkpatch.pl [1], and
target check, that combines LuaJIT-luacheck and LuaJIT-checkpatch.

1. https://docs.kernel.org/dev-tools/checkpatch.html
2. https://github.com/tarantool/checkpatch
3. https://github.com/tarantool/checkpatch/blob/master/.github/actions/checkpatch/action.yml
4. https://github.com/tarantool/checkpatch/blob/master/doc/checkpatch.rst
---
 test/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 47296a22..ccbad035 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -42,6 +42,39 @@ else()
   )
 endif()
 
+find_program(CHECKPATCH checkpatch.pl
+             HINTS ${PROJECT_SOURCE_DIR}/checkpatch)
+if(CHECKPATCH)
+  set(MASTER_BRANCH "tarantool/master")
+  add_custom_target(${PROJECT_NAME}-checkpatch)
+  add_custom_command(TARGET ${PROJECT_NAME}-checkpatch
+    COMMENT "Running checkpatch"
+    COMMAND
+      ${CHECKPATCH}
+        --codespell
+        --color=always
+        --git ${MASTER_BRANCH}..HEAD
+        --ignore COMMIT_LOG_LONG_LINE
+        # Requires at least two lines in commit message and this
+        # is annoying.
+        --ignore COMMIT_MESSAGE
+        --ignore NO_CHANGELOG
+        --ignore NO_DOC
+        --ignore NO_TEST
+        --show-types
+    WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+  )
+else()
+  add_custom_target(${PROJECT_NAME}-checkpatch)
+  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)
 
-- 
2.34.1


  parent reply	other threads:[~2023-07-17 13:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 13:34 [Tarantool-patches] [PATCH 0/4][v2] Fix typos and enable checkpatch Sergey Bronnikov via Tarantool-patches
2023-07-17 13:34 ` [Tarantool-patches] [PATCH 1/4][v2] ci: fix a step name Sergey Bronnikov via Tarantool-patches
2023-07-17 15:43   ` Maxim Kokryashkin via Tarantool-patches
2023-07-17 13:34 ` [Tarantool-patches] [PATCH 2/4][v2] codehealth: fix typos Sergey Bronnikov via Tarantool-patches
2023-07-17 15:48   ` Maxim Kokryashkin via Tarantool-patches
2023-07-17 13:34 ` Sergey Bronnikov via Tarantool-patches [this message]
2023-07-17 16:10   ` [Tarantool-patches] [PATCH 3/4][v2] cmake: introduce 'check' and 'LuaJIT-checkpatch' targets Maxim Kokryashkin via Tarantool-patches
2023-07-20 18:07     ` Sergey Bronnikov via Tarantool-patches
2023-07-20 21:13       ` Maxim Kokryashkin via Tarantool-patches
2023-07-17 13:34 ` [Tarantool-patches] [PATCH 4/4][v2] ci: enable checkpatch Sergey Bronnikov via Tarantool-patches
2023-07-17 18:48   ` Maxim Kokryashkin via Tarantool-patches
2023-07-20 18:14     ` Sergey Bronnikov via Tarantool-patches
2023-07-20 21:14       ` Maxim Kokryashkin via Tarantool-patches

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=1c8a5c13c50a2561ebe5d3f82749df644fe2a352.1689600525.git.sergeyb@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=estetus@gmail.com \
    --cc=max.kokryashkin@gmail.com \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 3/4][v2] cmake: introduce '\''check'\'' and '\''LuaJIT-checkpatch'\'' targets' \
    /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