Skip to content

Conversation

tiran
Copy link
Contributor

@tiran tiran commented Apr 19, 2024

Changes

Which issue is resolved by this Pull Request:
See: #739

Description of your changes:
Ruff is an extremely fast Python linter and code formatter, written in Rust. It is a fantastic tool that combines the features of flake8 linter, isort, Black code formatter, and (to some degree) pylint in one tool. It comes with over 800 linting rules. Ruff is not only blazing fast, it can also fix most code violation. The code fixer is a fantastic quality of life feature for developers.

Gradually introduce Ruff for linting and code formatting. Replaces Black as code formatting tool. Ruff is configured to create the same results as Black's default configuration.

More Ruff linters will be enabled in future commits.

make verify now performs a fast and lean check, which detects most problems except for some import errors.

$ rm -rf .tox
$ make verify
tox p -e fastlint,ruff
ruff: OK ✔ in 4.09 seconds
  fastlint: OK (13.21=setup[7.08]+cmd[6.13] seconds)
  ruff: OK (4.09=setup[3.85]+cmd[0.25] seconds)
  congratulations :) (13.49 seconds)
$ du --si -s .tox/
65M     .tox/

Normal lint downloads and creates a large virtual env, which takes several minutes:

$ tox -e lint
...
  lint: OK (178.89=setup[151.78]+cmd[27.10] seconds)
  congratulations :) (178.97 seconds)
$ du --si -s .tox/
1,6G    .tox/

@github-actions github-actions bot added the testing Relates to testing label Apr 19, 2024
@tiran
Copy link
Contributor Author

tiran commented Apr 19, 2024

This PR was formerly known as #740.

@tiran tiran requested review from soltysh and anik120 as code owners April 22, 2024 07:17
@tiran tiran requested a review from leseb April 22, 2024 07:19
@tiran tiran force-pushed the ruff-format branch 3 times, most recently from 59cbc62 to 2f5a5fe Compare April 23, 2024 18:06
Ruff is an extremely fast Python linter and code formatter, written in
Rust. It is a fantastic tool that combines the features of flake8 linter,
isort, Black code formatter, and (to some degree) pylint in one tool.
It comes with over 800 linting rules. Ruff is not only blazing fast,
it can also fix most code violation. The code fixer is a fantastic quality
of life feature for developers.

Gradually introduce Ruff for linting and code formatting. Replaces Black
as code formatting tool. Ruff is configured to create the same results as
Black's default configuration.

Linters will be enabled in future commits.

See: instructlab#739
Co-authored-by: Miroslav Vadkerti <mvadkert@redhat.com>
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Copy link
Member

@russellb russellb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been open for several weeks now (sorry). It still looks good to me. I think this is an important step toward taking our automated linting to another level to help catch stuff in CI.

@russellb russellb merged commit bc0bdf3 into instructlab:main Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Relates to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants