Skip to content

Feat: ruff#18

Open
MarceloRobert wants to merge 4 commits into
kernelci:mainfrom
MarceloRobert:feat/ruff
Open

Feat: ruff#18
MarceloRobert wants to merge 4 commits into
kernelci:mainfrom
MarceloRobert:feat/ruff

Conversation

@MarceloRobert
Copy link
Copy Markdown

@MarceloRobert MarceloRobert commented Apr 22, 2026

Description

Ruff is a fast python linter and formatter which is going to be adopted by the KernelCI repositories (following the contributing guidelines discussion).

For now, the selected rules were just the basic ones selected by default for ruff as in this example.
A list of all rules can be found here.

Note

I didn't enable the function complexity rule because there are many functions over the complexity limit of 10, which means there would be too much refactor to be done. Some functions exceeded 60 in complexity.

Changes

  • Adds ruff as a formatter and linter
  • Adds pre-commit-config to run ruff on pre-commit
  • Adds Github CI to run ruff on pull requests

This PR also adds a .git-blame-ignore-revs so that we can ignore the reformatting commit when using the git blame command.

All commits are related, but if a PR split is required we can review that too.

How to test

Check the instructions in the documentation, install the dev dependencies, run ruff format and ruff check --fix and see that everything is already formatted. Try adding some formatting error such as "blank line after class definition" or a linting error such as "unused import" and check that ruff will catch those problems.

Closes #3

Running ruff auto-formatting and auto-linting
Configures the ruff standards and adds an ignore to the formatting commit so that it doesn't show on git blame commands
Add pre-commit hooks to run ruff automatically and flag problems
Adds ci file to run ruff automatically on pull requests

Closes kernelci#3
Copy link
Copy Markdown
Collaborator

@tales-aparecida tales-aparecida left a comment

Choose a reason for hiding this comment

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

LGTM I personally prefer double quotes to allow contraction, but I understand this was done to

continue with repository style

@tales-aparecida tales-aparecida requested a review from knurd May 14, 2026 11:42
@tales-aparecida
Copy link
Copy Markdown
Collaborator

Pls add sign-off to your commits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub Actions: Linting with ruff

2 participants