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 1D023562379; Thu, 3 Aug 2023 10:51:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1D023562379 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1691049088; bh=C2e5X8SiIKn3pwgcJRUywkud70LHLG4vdlflZ7b0Fi4=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Mvkhv5EKGC7DckHIBm0Kq+6G814kKaKk/kru3VAXsCAZJmWACwNT+54b7KI/r+mj9 elqZfmNekQNZvekewh0+9bJWu4isCeEg8R/R2PoA+16zWajcAR2jcOOWIQjvUu+K0y jujU3QiPMzk4GkQjradX+T308K5EUYk948w41gOc= Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [95.163.41.96]) (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 1C37A562379 for ; Thu, 3 Aug 2023 10:44:17 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1C37A562379 Received: by smtp58.i.mail.ru with esmtpa (envelope-from ) id 1qRT0J-000EDQ-1H; Thu, 03 Aug 2023 10:44:15 +0300 To: Maxim Kokryashkin , Sergey Bronnikov Date: Thu, 3 Aug 2023 07:30:40 +0000 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9262A61978FA9877606B8C81B99FA656A412859FB6553D32E182A05F5380850404C228DA9ACA6FE279BA496B3CCE39C0F1D0F2C323AD5539B0367674DED877F0FF1690EDA16D5562B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70CF6737295EB4C15EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637835928C62272F24E8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D84384E0DF9DD423B8C88D698E2C137142117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC5FC25ED3FCEC3375A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735204B6963042765DA4BF04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE4B6963042765DA4B1421F57CABF51D54D8FC6C240DEA76429C9F4D5AE37F343AA9539A8B242431040A6AB1C7CE11FEE30085B890FD2717DAC0837EA9F3D19764C4224003CC836476E2F48590F00D11D6E2021AF6380DFAD1A18204E546F3947C1D471462564A2E192E808ACE2090B5E1725E5C173C3A84C3ED8438A78DFE0A9E089D37D7C0E48F6C8AA50765F79006379FC65886B7F75608EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-C1DE0DAB: 0D63561A33F958A5C87F97BBB89DC12243F7D6B393291FE0545E0F8763B059BCF87CCE6106E1FC07E67D4AC08A07B9B0B28C6475D0D323309C5DF10A05D560A950611B66E3DA6D700B0A020F03D25A0997E3FB2386030E77 X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF2F037B2CC47922337C1365B703B2A4F7DA1E61C5972C9042AE45F3D377DB008EEB3733EA1EE6A1F28553022043D0BC9A55A28CBE22752A13E672666B53F10693A74DFFEFA5DC0E7F02C26D483E81D6BEECAEF3E2CCC1ED8C383653B6C8D9AE0FD16FCAA6493B703A X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojcir52QaMQ83ameVXE3KYuQ== X-Mailru-Sender: 2FEBA92C8E508479FE7B9A1DF348D531C55F6AC43F6B0328E58383AEB814ABE1341E2255796083062326FE6F2A341ACE0FB9F97486540B4CD9E8847AB8CFED4D9ABF8A61C016C2CFB0DAF586E7D11B3E67EA787935ED9F1B X-Mras: Ok Subject: [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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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, + # 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} + ) +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