Skip to content
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

Merged
merged 9 commits into from
May 7, 2024
Merged

Conversation

Cadair
Copy link
Member

@Cadair Cadair commented May 4, 2024

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.

hooks:
- id: cargo-check
- id: clippy
args: ["--allow-staged", "--fix", "--", "-A", "clippy::needless_return"]
Copy link
Contributor

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?

Copy link
Member Author

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

@Cadair Cadair requested a review from nabobalis May 7, 2024 09:57
@Cadair Cadair marked this pull request as ready for review May 7, 2024 09:57
@Cadair Cadair mentioned this pull request May 7, 2024
@@ -0,0 +1,20 @@
name: pre-commit
Copy link
Contributor

Choose a reason for hiding this comment

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

The nuclear option.

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed.

@Cadair Cadair merged commit 73b51f9 into sunpy:main May 7, 2024
14 checks passed
@Cadair Cadair deleted the rust_lint_2 branch May 7, 2024 14:42
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.

None yet

2 participants