pylint as part of build ?
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
pylint as part of build ?
We've started using linters and cleaning up the Path python sources - and I was wondering if it was possible to have pylint installed on the build boxes so we could integrate a lint run into Path's unit tests?
I think it would be OK if we run it only on say linux builds if pylint is not available for Windows - or it's a pain to get installed.
I think it would be OK if we run it only on say linux builds if pylint is not available for Windows - or it's a pain to get installed.
Re: pylint as part of build ?
It should just require adding pylint and pylint3 @line 152 of https://github.com/FreeCAD/FreeCAD/blob ... s.yml#L152
I can make a pull request if you want, or you can do it in the commit set that starts using it.
If this is going to be a hard dependency for Path tests we will need to add it to the PPA, which is straight forward.
For the Win Travis builds I would need to add pylint and astroid to the libpack. Both are pure python so it should be straight forward.
For the OSX Travis builds I don't know, but they are disabled, so I wouldn't worry now. Maybe a comment in the travis.yml in case someone gets it working again in the future.
For the Conda based builds there is a Conda package available, it should be straight forward to add.
So the question is to make it a hard dependency or use it in some try/except block?
I can do most of it either way. If it becomes a hard dependency we need to document on the wiki and make an announcement for other Distros' package manager.
"fight the good fight"
Re: pylint as part of build ?
It's probably OK to have it as a soft dependency and the unit test checks if it is installed or not. Linting should lead to the same results regardless of the platform it is being run on so if we can enable it for one of the builds we can automatically run it.
Re: pylint as part of build ?
Sounds good.mlampert wrote: ↑Tue Jul 02, 2019 12:22 am It's probably OK to have it as a soft dependency and the unit test checks if it is installed or not. Linting should lead to the same results regardless of the platform it is being run on so if we can enable it for one of the builds we can automatically run it.
How about we add this to the travis linux (py3 and py2 builds) Please tell me if you want me to do it.
I will work on adding the dependencies to the Win Libpack, so Win developers can use it locally, but I won't add it to the Libpack that Travis uses (thus saving resources).
"fight the good fight"
Re: pylint as part of build ?
That sounds great. For py2 it would be pylint and for py3 it is pylint3 - given that py2 is EOL there's probably not much value in installing it. pylin3 also has more checks so it would be the better solution. I still have to clean up quite a bit of Path before it runs through without warnings. I can add it to the PR once I have it all cleaned up, I'll ping you once I get everything together.sgrogan wrote: ↑Wed Jul 03, 2019 9:44 pm How about we add this to the travis linux (py3 and py2 builds) Please tell me if you want me to do it.
I will work on adding the dependencies to the Win Libpack, so Win developers can use it locally, but I won't add it to the Libpack that Travis uses (thus saving resources).
Re: pylint as part of build ?
How about license? Pylint seems to be gpl3. So I guess the dependency must be optional?
Re: pylint as part of build ?
Another thread about code quality checker: https://forum.freecadweb.org/viewtopic.php?f=10&t=32602
Re: pylint as part of build ?
Is flake8 that we are already running basically not the same thing ? https://travis-ci.org/FreeCAD/FreeCAD/jobs/554080767
Linters like this are IMO best used directly in developers IDE's where the code is checked as you write it. It would be best to agree on a common setup for the python code and since FEM developers are using it already from the beginning it is probably best to just follow their standard...
Linters like this are IMO best used directly in developers IDE's where the code is checked as you write it. It would be best to agree on a common setup for the python code and since FEM developers are using it already from the beginning it is probably best to just follow their standard...
Re: pylint as part of build ?
I wasn't aware of flake8 - will have to look into it.saso wrote: ↑Thu Jul 04, 2019 8:00 am Is flake8 that we are already running basically not the same thing ? https://travis-ci.org/FreeCAD/FreeCAD/jobs/554080767
which is why I want it to be part of the (at least one) build - not every programmer is running linters and as we grow it becomes harder to maintain a level of consistency. My goto solution for such issues to automate it and make sure developers (especially myself) don't "forget" to clean up after themLinters like this are IMO best used directly in developers IDE's where the code is checked as you write it.