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 BED2C58EA63; Fri, 4 Aug 2023 00:02:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BED2C58EA63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1691096526; bh=OKvfBQGrS+MLYOqrSr9rCNCtB1txxV4yOuqmDBZlXLA=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=q/G2+1MrLGyanWnPAW9HJy7ii1DAREuJ/74wxG4k7Y5QPLKywhxmERG0Yz8QKQ17G wV1m3YZlRhvmN3dC2WN7yVwtBhWtramuYnR3pu/EKDv2upe/QljHyoKUeXmMSfrTzy DRyLcdxUzL8shibwuTioHvYtp1FoY5oU9/CMeN10= Received: from smtp35.i.mail.ru (smtp35.i.mail.ru [95.163.41.76]) (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 B2BBB4C3781 for ; Fri, 4 Aug 2023 00:02:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B2BBB4C3781 Received: by smtp35.i.mail.ru with esmtpa (envelope-from ) id 1qRfSO-002a4g-2a; Fri, 04 Aug 2023 00:02:05 +0300 Date: Fri, 4 Aug 2023 00:02:04 +0300 To: Igor Munkin Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD969E04B5EED670DC804E38A5F9341E5D8C5E4A5EF3DB2E749182A05F5380850403609CD0893BD7177E8F283E1F80B03230832E708DB63E0B3E8956AC2405DB4D6 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7747FD4AFDBA6C67AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637629A2DB6D7098C1B8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8253304536A21E42CCBE247883C975EFC117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAE9A1BBD95851C5BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735200AC5B80A05675ACD28451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EEB28585415E75ADA9CEDA8D6C8C3B0531D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE367F1C1C3ABB44F3A6E0066C2D8992A16C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407978DA827A17800CE7649B83402744A6742DBA43225CD8A89F83C798A30B85E16B5E1C53F199C2BB95B5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: 1B70FBA5C9BEEE72C9761FC34675ADEB871C96603B655635EE9D5CB6078CC77C267BAF6B934BA6D650B8A193DD8A991A X-C1DE0DAB: 0D63561A33F958A56CDF1AFFE0365EE724BD2D2DD45BC6CBA83E14F4A05CDC4FF87CCE6106E1FC07E67D4AC08A07B9B0CF7CD7A0D5AA5F25CB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0AD75DCE07D45A749953FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF52EA62F40DD284E99A23557C121CC788AC0ECB91AF7FE748CA441E5B6CC3F14304D7482423E9A0B88553022043D0BC9A63BC4A5E0FA4FE26CD1D45DFAD96DB91E48CAC7CA610320002C26D483E81D6BE64ACE4A408B72B61B0CA6F94E606A667A52EF62A646584F811BD90D3D42C882D43082AE146A756F3 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojcir52QaMQ81bqk38CSNb3A== X-Mailru-Sender: 7940E2A4EB16C9974CFF14AB62FAC1503775605D448D6CAB7768724F6BF530A0E2527C969975515CFF9FCECFB8D89CB6C77752E0C033A69E235A20A81F3B0E39AB3C5F247CB2F7F93A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Igor! Thanks for the patch! Aside from comments left by Sergey, please consider a few of mine. On Thu, Aug 03, 2023 at 07:30:40AM +0000, Igor Munkin wrote: > This patch introduces a separate target to run flake8 against all Python > scripts within LuaJIT repository (i.e. debugger extensions). There are > some tweaks in .flake8rc regarding our style: one can find more info in > the config file. > > The new target is a dependency for the new target, that > joins both luacheck and flake8 linter runs. CI job with linters is > adjusted respectively. > > Signed-off-by: Igor Munkin > --- > .flake8rc | 12 ++++++++++++ > .github/workflows/lint.yml | 4 ++-- > test/CMakeLists.txt | 28 ++++++++++++++++++++++++++++ > 3 files changed, 42 insertions(+), 2 deletions(-) > create mode 100644 .flake8rc > > diff --git a/.flake8rc b/.flake8rc > new file mode 100644 > index 00000000..b6f7ad48 > --- /dev/null > +++ b/.flake8rc > @@ -0,0 +1,12 @@ > +[flake8] > +extend-ignore = > + # TODO: I have no idea, how to fix this. flake8 suggests nothing > + # (like clang-format or checkpatch.pl do). Help needed. > + E131, > + # TODO: I have no idea, how to fix this. flake8 suggests nothing > + # (like clang-format or checkpatch.pl do). Help needed. > + E501, I dont't think we should disable the continuation line alignment rule (E131), which has explanation in the docs[1] and the line length limit[2] (E501), which is easily fixed. > + # XXX: Suppress F821, since we have autogenerated names for > + # 'ptr' type complements in luajit_lldb.py. > + F821 > +max-line-length = 80 > diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml > index 70c98104..6b420f68 100644 > --- a/.github/workflows/lint.yml > +++ b/.github/workflows/lint.yml > @@ -41,7 +41,7 @@ jobs: > run: | > # TODO: Move this step to a separate action. > sudo apt -y update > - sudo apt -y install cmake ninja-build lua5.1 luarocks > + sudo apt -y install cmake ninja-build lua5.1 luarocks flake8 > sudo luarocks install luacheck > # Set CMAKE_BUILD_PARALLEL_LEVEL environment variable to > # limit the number of parallel jobs for build/test step. > @@ -49,5 +49,5 @@ jobs: > - name: configure > run: cmake -S . -B ${{ env.BUILDDIR }} -G Ninja > - name: test > - run: cmake --build . --target LuaJIT-luacheck > + run: cmake --build . --target LuaJIT-lint > working-directory: ${{ env.BUILDDIR }} > diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt > index 47296a22..17ac5cac 100644 > --- a/test/CMakeLists.txt > +++ b/test/CMakeLists.txt > @@ -42,6 +42,34 @@ else() > ) > endif() > > +find_program(FLAKE8 flake8) > +if(FLAKE8) > + get_filename_component(FLAKE8_SOURCE_DIR "${PROJECT_SOURCE_DIR}" REALPATH) > + set(FLAKE8_RC ${FLAKE8_SOURCE_DIR}/.flake8rc) > + file(GLOB_RECURSE FLAKE8_DEPS ${FLAKE8_SOURCE_DIR}/*.py) > + add_custom_target(${PROJECT_NAME}-flake8 > + DEPENDS ${FLAKE8_DEPS} > + ) > + add_custom_command(TARGET ${PROJECT_NAME}-flake8 > + COMMENT "Running flake8 static analysis" > + COMMAND > + ${FLAKE8} ${FLAKE8_DEPS} > + --config ${FLAKE8_RC} > + --jobs ${CMAKE_BUILD_PARALLEL_LEVEL} > + WORKING_DIRECTORY ${FLAKE8_SOURCE_DIR} > + ) I suggest moving this logic to a separate cmake module. It will make the test/CMakeLists.txt cleaner and more readable. > +else() > + add_custom_target(${PROJECT_NAME}-flake8) > + add_custom_command(TARGET ${PROJECT_NAME}-flake8 > + COMMENT "`flake8' is not found, so ${PROJECT_NAME}-flake8 target is dummy" > + ) > +endif() > + > +add_custom_target(${PROJECT_NAME}-lint DEPENDS > + ${PROJECT_NAME}-luacheck > + ${PROJECT_NAME}-flake8 > +) > + > set(LUAJIT_TEST_COMMAND "${LUAJIT_TEST_BINARY} -e dofile[[${LUAJIT_TEST_INIT}]]") > separate_arguments(LUAJIT_TEST_COMMAND) > > -- > 2.30.2 > [1]: https://www.flake8rules.com/rules/E131.html [2]: https://www.flake8rules.com/rules/E501.html Best regards, Maxim Kokryashkin