这是indexloc提供的服务,不要输入任何密码
Skip to content

don't run cargo fmt --all in pre-commit hook #3403

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

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

wbinnssmith
Copy link
Member

@wbinnssmith wbinnssmith commented Jan 20, 2023

This action started failing because cargo fmt was added to the pre-commit hook and the tool is not available without running Rust setup. Instead, we should just skip applying hooks when creating commits from this workflow.

Since the create-pull-request doesn't have a way of disabling hooks, simply remove the file before husky installs it into place. Let cargo fmt run on individual files through lint-staged, but don't run it on everything on every precommit.

Test Plan: Manual workflow run on this branch which opened #3401

@vercel
Copy link

vercel bot commented Jan 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
examples-basic-web 🔄 Building (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)
9 Ignored Deployments
Name Status Preview Comments Updated
examples-cra-web ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)
examples-nonmonorepo ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)
turbo-site ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)
turbo-vite-web ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2023 at 4:39PM (UTC)

@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2023

🟢 CI successful 🟢

Thanks

Copy link
Contributor

@mehulkar mehulkar left a comment

Choose a reason for hiding this comment

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

is it possible to only run cargo fmt when relevant rust files change? this looks like it's not going to touch any of those files, so the pre-commit hook shouldn't apply. (I'm not sure if lint-staged is already supposed to be doing that?)

@wbinnssmith
Copy link
Member Author

is it possible to only run cargo fmt when relevant rust files change? this looks like it's not going to touch any of those files, so the pre-commit hook shouldn't apply. (I'm not sure if lint-staged is already supposed to be doing that?)

it actually does already: https://github.com/vercel/turbo/blob/a3bfa40ccd67862b3640731d06a2529a455fd2e5/package.json#L51

...but cargo fmt --all was added to the hook in #3179: daaeabf#diff-d2bc4bbf14eadc292d84e0ef5f7a93115c23557f533809fc80b896934291529dR5

@ForsakenHarmony was there a reason to format everything on every change? cargo fmt is probably fast enough to do so, but it requires the rust toolchain in situations like these.

@ForsakenHarmony
Copy link
Contributor

@wbinnssmith we can remove it

@wbinnssmith wbinnssmith force-pushed the wbinnssmith/font-google-update-no-precommit branch from a3bfa40 to a4ea2d4 Compare January 23, 2023 16:38
@wbinnssmith wbinnssmith changed the title update-google-fonts workflow: don't run pre-commit hook don't run cargo fmt --all in pre-commit hook Jan 23, 2023
@ForsakenHarmony
Copy link
Contributor

ForsakenHarmony commented Jan 23, 2023

Why do we have the google font data in our repo though, I thought we wanted to use it from the next package directly (@next/font/dist/google/font-data.json)

@wbinnssmith wbinnssmith requested a review from mehulkar January 23, 2023 16:43
@wbinnssmith
Copy link
Member Author

wbinnssmith commented Jan 23, 2023

Why do we have the google font data in our repo though, I thought we wanted to use it from the next package directly (@next/font/dist/google/font-data.json)

Yeah, we do (WEB-415). We just haven't gotten to it yet, and this was breaking.

@wbinnssmith wbinnssmith merged commit f0c3c72 into main Jan 24, 2023
@wbinnssmith wbinnssmith deleted the wbinnssmith/font-google-update-no-precommit branch January 24, 2023 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants