-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
"cargo new" should add pre-commit hooks for autoformatter and linter #13758
Comments
A pre-commit hook is fairly opinionated choice
Also, for myself, one of the most frustrating thing about project scaffolding tools is all of the content you have to delete. I'd rather not be generating this content unless its going to be used or else we are pushing for people to delete it. imo this seems better suited to be solved by either |
But it just an idea, thank you for nice tooling! |
From the previous discussion #12102 (comment), the team generally leans toward adding extra VCS support via some extension points in Cargo, to lighten the maintenance burden. Adding new features for existing VCS support falls into the same category as that, I think. |
Rustup's minimal profile does not include rustfmt or clippy. I do not really believe Cargo should add anything that assumes or significantly varies its user experience based on whether it ships with tools that do not appear in the minimal profile. |
...My opinion is admittedly also informed by the fact that I run |
That's a pretty fair point! Cargo also has no knowledge about rustup profiles. At least Cargo needs extra executable probes to find their existence. |
Problem
cargo new
even does initialization of new git repo, has all tools, but doesn't configure pre-commit hooks, but why to not add them as it clearly good practice?Proposed Solution
cargo new
should depends on pre-commit or something similar and add config (.pre-commit-config.yaml
for pre-commit).Notes
For rustfmt I found example here:
another example, plus example for clippy can be found here:
The text was updated successfully, but these errors were encountered: