Bug 1358 - DTS: Enable Pylint or replace current linters with Ruff
Summary: DTS: Enable Pylint or replace current linters with Ruff
Status: UNCONFIRMED
Alias: None
Product: DPDK
Classification: Unclassified
Component: DTS (show other bugs)
Version: unspecified
Hardware: All All
: Normal minor
Target Milestone: ---
Assignee: Juraj Linkeš
URL:
Depends on:
Blocks:
 
Reported: 2024-01-10 12:01 CET by Juraj Linkeš
Modified: 2024-02-14 14:57 CET (History)
3 users (show)



Attachments

Description Juraj Linkeš 2024-01-10 12:01:48 CET
The first question is do we want to actually enable Pylint?

This linter provides additional linting, such as telling us when a class/method/function is too big or pointing to a class that maybe shouldn't be a class, among others.

Of note is that this shouldn't be added to Pylama, but executed standalone.
Comment 1 Robin Jarry 2024-01-10 15:27:23 CET
Hi Juraj,

Adding feedback on my personal experience with such tools.

Pylint is far more than just a style and/or complexity checker like flake8 or pycodestyle. It can do type inference based on heuristics and type annotations in the code. This allows (for example) failing during CI checks when accessing a non-existent object field or referencing an undefined symbol.

A more complete static type checking is https://mypy-lang.org/. However, it requires a lot more involvement since you need to add type annotations everywhere for it to be worth it.

Cheers
Comment 2 Robin Jarry 2024-01-10 15:32:46 CET
I didn't reply to the original question: YES I think using pylint (or mypy if you are really motivated) is a must have.
Comment 3 Juraj Linkeš 2024-01-11 13:16:12 CET
Thanks for the feedback, Robin.

We already use Mypy with type annotations, so the value of adding Pylint would be in the extra linting capabilities on top of mccabe, pycodestyle and pyflakes which we also already use.
Comment 4 Robin Jarry 2024-01-11 14:09:24 CET
Oh my bad, I didn't know mypy was already in use. Then pylint is probably redundant. I find that too much linting only introduces noise for little benefit.
Comment 5 Juraj Linkeš 2024-01-22 13:17:49 CET
There is an exciting, fast linter written in Rust called Ruff: https://docs.astral.sh/ruff/

The linter should cover everything already covered by our linters. The benefits are faster linting (which will be appreciated when we have more code) and familiarity with just one tool.

Note You need to log in before you can comment on or make changes to this bug.