-
Notifications
You must be signed in to change notification settings - Fork 30
Adds local pre-commit hook for ruff linting auto fixes #678
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| default_install_hook_types: [pre-commit, pre-push] | ||
|
|
||
| repos: | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.12.9 | ||
| hooks: | ||
| # Run the linter, applying any available fixes | ||
| - id: ruff-check | ||
| stages: [ pre-commit, pre-push ] | ||
| args: [ --fix-only ] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't we just report the issue, rather than try fixing them?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that these fixes will be applied in the CI if they are not done locally.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we ARE fixing then maybe it makes sense to add formatting as well?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given the current state of the code, adding formatting would result in a large number of changes, substantially increasing the burden for developers and PR reviewers. I am keen to introduce formatting at a later stage but this will require work done to go through the codebase, and applying formatting to what is there already. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| pre-commit |
Large diffs are not rendered by default.
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.
According to https://github.com/astral-sh/ruff-action ,
latestis the default. This directive might not be necessaryThere 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.
Without that there, we'd get an unwanted annotation on every CI run that it's using the latest version, that might not be what we want, and we should specify a version.
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.
As @llimeht stated, in spite of it being the default, this proved to be an issue in the SasView repo, see SasView/sasview#3605 and SasView/sasview#3608