nasa / fprime-tools

F´ Python tooling and helpers.
https://github.com/nasa/fprime
Apache License 2.0
21 stars 39 forks source link

Replace all python linters (flake8, pylama,...) with `ruff` #140

Closed ThibFrgsGmz closed 1 year ago

ThibFrgsGmz commented 1 year ago
Originating Project/Creator
Affected Component Static Analyzer
Affected Architectures(s) Infrastructure
Related Issue(s) None
Has Unit Tests (y/n) n
Builds Without Errors (y/n) see CI
Unit Tests Pass (y/n) see CI
Documentation Included (y/n) n

Change Description

Ruff, by Astral is a very fast linter implemented in Rust that can replace pylama, flake8, ....

Ruff also implements the rules of other popular Python linters such as pylint, isort and pyupgrade. There are even plans to implement feature parity with black in the future. Ultimately, it can become our one-stop shop for all things Python linting and formatting.

Rationale

This stack should replace all our Python lint tools with ruff, except for:

It provides:

Testing/Review Recommendations

To avoid noise in others' patches, violated rules are currently all ignored.

Configuration

Ruff is configured in the root file pyproject.toml. In addition, ruff retrieves any pyproject.toml file. In addition, ruff retrieves any pyproject.toml or ruff.toml files in the subdirectories. The settings in these files will only apply to the whole system. The settings in these files will only apply to the files contained in these subdirectories.

Additional information

Future Work

thomas-bc commented 1 year ago

I'll have to take some time to sit down and look at all this, but this looks really promising. Thank you @ThibFrgsGmz ! I'll get to this as soon as I can.

ThibFrgsGmz commented 1 year ago

For the time being, it's best to wait for the SARIF output format to be supported. That's for the best, as other rules will be added in the meantime.

Closing.