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

chore: refactor should_print_version into helper for clarity #10006

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

erikareads
Copy link
Contributor

Description

Small refactor pulling the boolean condition should_print_version into a helper function with the same name. I also decompose the boolean condition into the two relevant states: whether print version is disabled by environment variable, and whether this run of turbo is in continuous integration.

I used enums to disambiguate these states, because previously we were negating a negative boolean to produce a positive one, and it would easy during modification to inadvertently produce opposite behavior by forgetting a negation. The enums make it clear which state each of the two relevant conditions are in, and make the final boolean calculation easy to read.

@erikareads erikareads requested a review from a team as a code owner February 19, 2025 18:14
@turbo-orchestrator turbo-orchestrator bot added the needs: triage New issues get this label. Remove it after triage label Feb 19, 2025
Copy link

vercel bot commented Feb 19, 2025

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

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:14pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:14pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:14pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:14pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:14pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:14pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:14pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:14pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:14pm

@erikareads erikareads changed the title [chore] refactor should_print_version into helper for clarity chore: refactor should_print_version into helper for clarity Feb 19, 2025
Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

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

Thanks for this clean up!

@chris-olszewski chris-olszewski merged commit 882fb08 into main Feb 19, 2025
40 checks passed
@chris-olszewski chris-olszewski deleted the erikarowland/refactor-should-print-version branch February 19, 2025 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: triage New issues get this label. Remove it after triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants