pylint as part of build ?

Having trouble installing or compiling FreeCAD? Get help here.
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am

Re: pylint as part of build ?

Postby reox » Sun Jul 07, 2019 3:53 pm

What you could also do: there are tools for github which check the code style and can disable merging if the code style does not match.
That is the easiest solution to force everyone to write in the same style.

There seems to be also tools which will create new commits with linted code.
Posts: 1362
Joined: Fri Sep 16, 2016 9:28 pm

Re: pylint as part of build ?

Postby mlampert » Sun Jul 07, 2019 7:40 pm

All these are great solutions and suggestions. In truth though I'm not that much concerned about _style_ (as in there must be a space ...), what I really would like to catch are bugs, or potential bugs. Basically what a compiler/linker does for C++, making sure that all the code that can be exercised is at least syntactically correct and free of typos - the latter being a vivid companion of mine.

AFAICT there are two options, lgtm or pylint. lgtm's integration into github's PR system is a brand new feature and currently being explored elsewhere or use pylint locally and run it as part of the unit tests.

TBH I do not advocate shipping pylint with FC - every developer on *nix can install it quite easily and the same is true for Windows. If the build for your PR fails you can install it if the logs from the build aren't conclusive, but that is not a requirement - or it shouldn't be.