-
Notifications
You must be signed in to change notification settings - Fork 7
[CI] Linter and formatter #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The PR is split into two commits to make reviewing simpler. Current lint config is a simple opinionated collection of rules. |
|
If a PR fails on formatting, is there an actionable thing for developers to do to fix the formatting without having to patch by hand every difference? |
Would be great to set it up as on llvm-project, e.g. llvm/llvm-project#146732 (comment) where a Github action comments something like and then on further revisions the comment is edited to become: Just need to find the right Github workflows to copy (and appropriately massage) from llvm-project/.github. |
|
On the topic of copying from llvm-project: I would prefer if we also just keep to whichever code style is being enforced upstream. Just need to dig around a bit to find the right files that specify it. |
Most cases can be addressed automatically by running In case of "unsafe" fixes, they have to be addressed manually but errors are reported and, when possible, hints are provided: Example of failing CI from my fork [link]. |
Do we really need comments spam?
Makes sense. I'll have a look how it's configured. |
9fd08a3 to
554b268
Compare
If the failing CI has a clear message on how to reproduce locally and fix, then we don't need additional comments. |
|
You need to rebase your branch to run the two new workflows from |
It is already rebased |
|
On the topic of comparison to Ruff formatter is largely aligned with Black with minor deviations. I'd suggest we keep lint to aim for higher code quality. Exact rules can be refined over time. |
|
Ok, now #22 is merged, we can rebase. |
|
Reshuffled and amended commits to keep reviewing simpler. Most recent change: dropped non-default Edit: reformatted again but preserved custom args comment layout in |
Adds 'ruff' as Python linter and code formatter and 'pre-commit' for easy rules application both locally and in CI. New lint CI workflow is also added. The formatting tools are added as optional dependencies. They can be installed using: uv sync --extra dev-tools
|
Tweaked rules and rerun formatter after more experimentation and offline discussions. Changes:
|
rengolin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with CI fixed.
Adds 'ruff' as Python linter and code formatter, and 'pre-commit' for easy rules application both locally and in CI.
New lint CI workflow is also added.
The formatting tools are added to the 'dev' dependency group.
They are installed by default with
uv syncand can be run locally with:pre-commit run -a