-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add a rust linter and formatter (Take 2) #137
Conversation
.pre-commit-config.yaml
Outdated
hooks: | ||
- id: cargo-check | ||
- id: clippy | ||
args: ["--allow-staged", "--fix", "--", "-A", "clippy::needless_return"] |
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.
You didn't want to config this?
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 far as I can tell there isn't a decent way to config this which works with the slightly old rust I have on my system :p
@@ -0,0 +1,20 @@ | |||
name: pre-commit |
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.
The nuclear option.
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.
Indeed.
This adds some rust specific pre-commit hooks as recommended by @Will-Shanks in #110
It seems that these checks don't play nice with pre-commit.ci so I have swapped to using pre-commit.ci lite and GH actions to run them, which means enabling autofix.
Oh, also somewhat controversially I have configured clippy to enforce the presence of return statements, as I think that will be better for people likely to contribute here who are more familiar with Python.