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 C6D8781588C; Tue, 17 Oct 2023 17:50:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C6D8781588C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1697554219; bh=X8x4NNbtX8ltdJUEC+pYR/Ykc5p83/KDaiGJRwOUf0g=; 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=s/QZli7Qul2CW4jElVJGlETc3IJYZJ2tN4lNnpYH5gWd2MDvMPXEfUb9/r29Pd29S hKICfRvF2YvrMgESbcD8i3h04OhuA/ckQ6lIa14aU8bAJ86dxH7Ue91O+/4lJte9zI 4YD05hWp/bANPiak83q9SbcY6OTYQpRVHgvQE6oc= Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [95.163.41.77]) (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 064F65745F9 for ; Tue, 17 Oct 2023 17:50:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 064F65745F9 Received: by smtp36.i.mail.ru with esmtpa (envelope-from ) id 1qslOj-00Ewlb-0H; Tue, 17 Oct 2023 17:50:17 +0300 Message-ID: <2f093b55-cec5-4cfa-a452-bc79598278a7@tarantool.org> Date: Tue, 17 Oct 2023 17:50:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Maxim Kokryashkin Cc: Sergey Bronnikov , max.kokryashkin@gmail.com, tarantool-patches@dev.tarantool.org References: <0f1c6ed9f0bdade86631edc135839e607f3bb7f6.1697042800.git.sergeyb@tarantool.org> <1697107429.603761776@f747.i.mail.ru> <28a21ed3-a914-4270-872a-3706e7a977c2@tarantool.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD978AFEFB3096932CF12F77ADD25EC5C9658AC0226C7A531B7182A05F538085040073BCD4327061FD0F62D443A229BBCEA54F079C81FEED7B9D21135814D965465 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CB5C87C4C9A74E8BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CDE631A26C8A2C128638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8CC692DB5E54195D80D7D8623A9956222117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3A703B70628EAD7BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD1828451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE26055571C92BF10F03CEA74F0D118906D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE36089696B24BB1D196E0066C2D8992A16C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947C2D01283D1ACF37BA2E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89FC0F9454058DFE53C42539A7722CA490CB5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: 0D63561A33F958A50F8FC9FD315F8621CCD51DAE224A501764A5F1BB1F066830F87CCE6106E1FC07E67D4AC08A07B9B086D40F53BA192295CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFBF3F72BC62441837B70FB5EA95C211EA98622CE0F0AC916EC42BCBC16EA2819568A36B291CE9B2EBEBFDF7752E1FC3379250BAC7E8C2C0D657AA5A9ADFFF2DB4A74DFFEFA5DC0E7F02C26D483E81D6BE0DBAE6F56676BC7117BB6831D7356A2DEC5B5AD62611EEC62B5AFB4261A09AF0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojfbpVM+RcTJCiCBSTjlQ8CA== X-Mailru-Sender: 11C2EC085EDE56FAC07928AF2646A769DF9F3E0B29D2F228F62D443A229BBCEA228AB1844EA588C7EBA65886582A37BD66FEC6BF5C9C28D98A98C1125256619760D574B6FC815AB872D6B4FCE48DF648AE208404248635DF 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" Maxim, On 10/12/23 21:46, Maxim Kokryashkin wrote: > Sergey, > On Thu, Oct 12, 2023 at 04:28:36PM +0300, Sergey Bronnikov wrote: >> Hi, Max >> >> >> thanks for review! see my comments >> > > > >>> 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. > I don't get how it is more readable. For me it's quite the opposite -- there is > too much repetitions of the same pattern `list(APPEND CODESPELL_WHITELIST ...), > which makes the latter part with paths less readable. I don't get why it is a problem. However, I have updated a patch to reduce a number of `list` operators. --- a/cmake/CodeSpell.cmake +++ b/cmake/CodeSpell.cmake @@ -1,15 +1,17 @@  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) +string(JOIN "," CODESPELL_WHITELIST +  ${PROJECT_SOURCE_DIR}/src/lj_mapi.c +  ${PROJECT_SOURCE_DIR}/src/lj_sysprof.c +  ${PROJECT_SOURCE_DIR}/src/lj_utils_leb128.c +  ${PROJECT_SOURCE_DIR}/src/lj_wbuf.c +  ${PROJECT_SOURCE_DIR}/src/luajit-gdb.py +  ${PROJECT_SOURCE_DIR}/src/luajit_lldb.py +  ${PROJECT_SOURCE_DIR}/test/CMakeLists.txt +  ${PROJECT_SOURCE_DIR}/test/tarantool-c-tests +  ${PROJECT_SOURCE_DIR}/test/tarantool-tests +  ${PROJECT_SOURCE_DIR}/tools +)  set(IGNORE_WORDS ${PROJECT_SOURCE_DIR}/tools/codespell-ignore-words.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") >>> + 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. > You can just leave the target empty then. `message` can be called from > anywhere. Actually no. When codespell is not found CMake just prints a message about successful codespell running: $ cmake -S . -B build -- The C compiler identification is GNU 11.4.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- [SetVersion] Reading version from VCS: v2.1.0-beta3-405-g52d646ed -- [SetBuildParallelLevel] CMAKE_BUILD_PARALLEL_LEVEL is 8 -- The ASM compiler identification is GNU -- Found assembler: /bin/cc -- Configuring done -- Generating done -- Build files have been written to: /home/sergeyb/sources/MRG/tarantool/third_party/luajit/build $ cmake --build build --parallel -t LuaJIT-codespell Built target LuaJIT-codespell >> >>> 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. Ok, then we should implement the same approach for targets with prove. This is out of scope patches with codespell support. >>> + ) >>> +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