Feat: ruff#18
Conversation
tales-aparecida
left a comment
There was a problem hiding this comment.
LGTM I personally prefer double quotes to allow contraction, but I understand this was done to
continue with repository style
|
Pls add sign-off to your commits |
I can try to change it and see if there's too much difference, I saw that there were some places where the original code also used double quotes so it might not be too bad |
Will do too, as soon as I set up the repo on my personal machine |
|
@tales-aparecida Done. I also changed the quotes to be double, the same files were changed so I don't think it should be an issue. cc @knurd |
| "venv", | ||
| ] | ||
|
|
||
| # Will format at line-length 88 but will only give error at max-line-length 110 |
There was a problem hiding this comment.
From the bike-shedding department:
Where does 88 come from? Personal style, KCI guidelines, some template this is based on?
I understand that too long lines are a problem, but 88 seems a bit short these days; how about 100 or 110 as line-length an 120 as max-line-length
There was a problem hiding this comment.
I'm also a 100/120 guy myself! ✨
There was a problem hiding this comment.
It comes from the black formatter default, but it's also close to what was suggested in our contributing guidelines. I'm fine with 100/120 though, I'll make the changes and you guys can check if it's good, otherwise I can revert it back no problem.
There was a problem hiding this comment.
Oh, I forgot Denys had suggested
Line length: soft 80 / hard 110
:T
Applies auto formatting and linting, required to be a separate commit for the git-blame-ignore-refs file Signed-off-by: Marcelo Robert Santos <4mrSantos@gmail.com>
Configures the ruff standards and adds an ignore to the formatting commit so that it doesn't show on git blame commands Signed-off-by: Marcelo Robert Santos <4mrSantos@gmail.com>
Add pre-commit hooks to run ruff automatically and flag problems Signed-off-by: Marcelo Robert Santos <4mrSantos@gmail.com>
Adds ci file to run ruff automatically on pull requests Closes kernelci#3 Signed-off-by: Marcelo Robert Santos <4mrSantos@gmail.com>
|
Rebased to main too |
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
This PR also adds a
.git-blame-ignore-revsso that we can ignore the reformatting commit when using thegit blamecommand.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 formatandruff check --fixand 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