[Tarantool-patches] [PATCH luajit 15/15] test: run flake8 static analysis via CMake

Igor Munkin imun at tarantool.org
Mon Aug 7 16:35:21 MSK 2023


OK, this is sad. Again, something is not covered "by default" in CI.
All problems are described below.

The most important, flake8 is too old in our Linux repos (see below): |
flake8 is already the newest version (3.7.9-2). Hence, I decided to fix
the version to 6.1.0 as the newest one for the following reasons:
* New heuristics are added (AFAIR, you used 6.0.0 below), so more
  errors are found.
* Unexpected upgrade to the new version of flake8 can lead to new error
  errors, so CI can fail for no reason. Hence pinning the version
  provides more control for CI (and this is horosho).

Here is the diff:

================================================================================

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 2d227118..b4e66f53 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -41,8 +41,9 @@ jobs:
         run: |
           # TODO: Move this step to a separate action.
           sudo apt -y update
-          sudo apt -y install cmake ninja-build lua5.1 luarocks flake8
+          sudo apt -y install cmake ninja-build lua5.1 luarocks
           sudo luarocks install luacheck
+          sudo pip3 install flake8==6.1.0
           # Set CMAKE_BUILD_PARALLEL_LEVEL environment variable to
           # limit the number of parallel jobs for build/test step.
           echo CMAKE_BUILD_PARALLEL_LEVEL=$(($(nproc) + 1)) | tee -a $GITHUB_ENV

================================================================================

As a result of this change, all the errors mentioned below are reported
by our CI[1]. OK, what about the errors per se (see below).

On 03.08.23, Sergey Bronnikov wrote:
> LuaJIT-lint reports 4 warnings:
> 
> 
> Total: 0 warnings / 0 errors in 108 files
> Built target LuaJIT-luacheck
> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit-gdb.py:330:11:
> E275 missing whitespace after keyword
> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit-gdb.py:338:10:
> E275 missing whitespace after keyword
> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit_lldb.py:391:10:
> E275 missing whitespace after keyword
> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/src/luajit_lldb.py:519:11:
> E275 missing whitespace after keyword

The 1st and the 3rd errors are not just style issues, but the actual
errors. <assert> is a statement in Python, so the parenthesis are
considered as a tuple constructor. Fixed it in scope of the separate
commit (will send in reply to this message).

The remaining issues relates to missing whitespace, so I fixed it the
same way all other style violations were fixed (will also send the patch
in reply to this message).

> 
> On 8/3/23 17:23, Sergey Bronnikov via Tarantool-patches wrote:
> > 
> > Hi, Igor
> > 
> > 
> > thanks for the patch! see my comments
> > 
> 
> <snipped>
> 

[1]: https://github.com/tarantool/luajit/actions/runs/5785548226/job/15678397206

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list