From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 594AD656C30; Thu, 12 Oct 2023 16:28:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 594AD656C30 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1697117320; bh=T0Pe4Bi3M+juuxQzFcY+CEwI7LZy/jwFnGLuZKBrAN8=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=K23nEW1GT3J5C6Y1tDcl9T510Lc/la0akgpcVyZbSbU9Pg3FWC5HeQ7uJ67jQRm15 1wVjVBPEu4HTZHa42bGJv9cfGEDSazHrw4dmn460J28smNfWWULkdzJlUYw3DEz0Ci f8JH6jU/Mn/BSdIqzlb2d3Xm200//GMjhniJ7dks= Received: from smtp31.i.mail.ru (smtp31.i.mail.ru [95.163.41.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 83CA1656C30 for ; Thu, 12 Oct 2023 16:28:38 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 83CA1656C30 Received: by smtp31.i.mail.ru with esmtpa (envelope-from ) id 1qqvjw-001urW-30; Thu, 12 Oct 2023 16:28:37 +0300 Content-Type: multipart/alternative; boundary="------------omZNOquKxEAv9trIMyRiMfLO" Message-ID: <28a21ed3-a914-4270-872a-3706e7a977c2@tarantool.org> Date: Thu, 12 Oct 2023 16:28:36 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Maxim Kokryashkin , Sergey Bronnikov Cc: max.kokryashkin@gmail.com, tarantool-patches@dev.tarantool.org References: <0f1c6ed9f0bdade86631edc135839e607f3bb7f6.1697042800.git.sergeyb@tarantool.org> <1697107429.603761776@f747.i.mail.ru> Content-Language: en-US In-Reply-To: <1697107429.603761776@f747.i.mail.ru> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9FE0487E50246814697BDC0BB54697F16EE89B06BE40DE88800894C459B0CD1B97094BCC35B93C731A78F7B899ADCB33BAB01BB01FC83561339E8B8BCDB49C505 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE71B1B5393BB9C1313EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637486F32EF78EC606F8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8169E286A8DF7CF7F708F1C95BE9E2678117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAE9A1BBD95851C5BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735201E561CDFBCA1751FF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947CF254576263B31EA9040F9FF01DFDA4A84AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3B1CCBFDB748CB1BDBA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CF11471C67CF6D96D51DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C322E8CC72813B2B8435872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5C2475A399476D68BD1575CB713A2280D8B81E981850A5325F87CCE6106E1FC07E67D4AC08A07B9B0D56D36E97F3F038CCB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF1476C3278601F0F6AAAD57790DC3284700D6C5DEC68FF69D3B275E8AB04EBFE49901B20BD73D67EEED8146B44B5935893D5C1BE4C5B3F2A9E3DD832A529E0F49A74DFFEFA5DC0E7F02C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojBYtV3BjG6I4lATPOHX6tQA== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A7695EC415CB87272F8548FC74EE4CC6E3D09FD6E2B231121C05EBA65886582A37BD66FEC6BF5C9C28D98A98C1125256619760D574B6FC815AB872D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 3/4][v2] cmake: introduce target with codespell X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------omZNOquKxEAv9trIMyRiMfLO Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Max thanks for review! see my comments On 10/12/23 13:43, Maxim Kokryashkin via Tarantool-patches wrote: > Hi, Sergey! > Please consider my comments below. > > Среда, 11 октября 2023, 19:54 +03:00 от Sergey Bronnikov via > Tarantool-patches : > From: Sergey Bronnikov > > > The patch introduces a new CMake target: "LuaJIT-codespell", that > spellchecks files specified in a whitelist by codespell [1]. > > Typo: s/a whitelist/the whitelist/ Fixed. > > 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 > index eebf3d6f..7ef10f2f 100644 > --- a/CMakeLists.txt > +++ b/CMakeLists.txt > @@ -32,6 +32,7 @@ set(CMAKE_MODULE_PATH > "${CMAKE_CURRENT_SOURCE_DIR}/cmake") >  include(LuaJITUtils) >  include(SetBuildParallelLevel) >  include(SetVersion) > +include(CodeSpell) > >  # --- Variables to be exported to child scopes > --------------------------------- > > 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) > > CMake’s list is variadic, you can add all entries in one go. Sure, I know. This way it looks better and changes in patches will be more readable. > + > +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") > + add_custom_command(TARGET ${PROJECT_NAME}-codespell > + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red ${MSG} > + COMMENT ${MSG} > > Why a `message` call with level set to WARNING is not enough? it is a CMake target, you cannot use `message` command there. > Is there a concern > about coloring? for me warning highlighted by red color will be more notable than without it. > If so, I believe it’s inconsistent to use approach with cmake_echo_color. > In case of `prove` absence on the machine, the more important message > about > skipped regression tests will be less noticeable in comparison with > codespell, which is > by far less important. > + ) > +endif (CODESPELL) > diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt > index 58cba5ba..8afc42df 100644 > --- a/test/CMakeLists.txt > +++ b/test/CMakeLists.txt > @@ -68,6 +68,7 @@ endif() >  add_custom_target(${PROJECT_NAME}-lint DEPENDS >    ${PROJECT_NAME}-luacheck >    ${PROJECT_NAME}-flake8 > + ${PROJECT_NAME}-codespell >  ) > >  set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e > dofile[[${LUAJIT_TEST_INIT}]]") > 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 > +isnt > +FPR > -- > 2.34.1 > > -- > Best regards, > Maxim Kokryashkin --------------omZNOquKxEAv9trIMyRiMfLO Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi, Max


thanks for review! see my comments

On 10/12/23 13:43, Maxim Kokryashkin via Tarantool-patches wrote:
Hi, Sergey!
Please consider my comments below.
 
Среда, 11 октября 2023, 19:54 +03:00 от Sergey Bronnikov via Tarantool-patches <tarantool-patches@dev.tarantool.org>:
 
From: Sergey Bronnikov <sergeyb@tarantool.org>

The patch introduces a new CMake target: "LuaJIT-codespell", that
spellchecks files specified in a whitelist by codespell [1].
Typo: s/a whitelist/the whitelist/

Fixed.



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
index eebf3d6f..7ef10f2f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,6 +32,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 include(LuaJITUtils)
 include(SetBuildParallelLevel)
 include(SetVersion)
+include(CodeSpell)
 
 # --- Variables to be exported to child scopes ---------------------------------
 
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)
CMake’s list is variadic, you can add all entries in one go.

Sure, I know. This way it looks better and changes in patches will be more readable.


+
+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")
+ add_custom_command(TARGET ${PROJECT_NAME}-codespell
+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red ${MSG}
+ COMMENT ${MSG}
Why a `message` call with level set to WARNING is not enough?

it is a CMake target, you cannot use `message` command there.


Is there a concern
about coloring?

for me warning highlighted by red color will be more notable than without it.


If so, I believe it’s inconsistent to use approach with cmake_echo_color.
In case of `prove` absence on the machine, the more important message about
skipped regression tests will be less noticeable in comparison with codespell, which is
by far less important.

+ )
+endif (CODESPELL)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 58cba5ba..8afc42df 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -68,6 +68,7 @@ endif()
 add_custom_target(${PROJECT_NAME}-lint DEPENDS
   ${PROJECT_NAME}-luacheck
   ${PROJECT_NAME}-flake8
+ ${PROJECT_NAME}-codespell
 )
 
 set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]")
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
+isnt
+FPR
--
2.34.1
 
--
Best regards,
Maxim Kokryashkin
 
--------------omZNOquKxEAv9trIMyRiMfLO--