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

[CLI] Refactor & simplify schema helpers #11896

Merged
merged 7 commits into from
Jan 15, 2025

Conversation

Philzen
Copy link
Contributor

@Philzen Philzen commented Jan 13, 2025

While working on another PR i skimmed through this file and recognized some code block that could be written simpler and with less indentation by applying the early return pattern, thus reducing the cognitive complexity required to mentally process the code.

The iterative process of simplifying the code then uncovered a potential undefined return value (→ ec50ab8) in the getSchema() method, which i marked with a TODO comment for further consideration.

@Philzen Philzen force-pushed the refactor/simplify-schema-helpers branch from 5140fe7 to 2278409 Compare January 13, 2025 13:32
@Philzen Philzen force-pushed the refactor/simplify-schema-helpers branch from 2278409 to d65d975 Compare January 13, 2025 13:33
@Philzen Philzen changed the title [refactor] Simplify schema helpers [CLI] Refactor & simplify schema helpers Jan 13, 2025
@Tobbe Tobbe added the release:chore This PR is a chore (means nothing for users) label Jan 15, 2025
@Tobbe Tobbe added this to the chore milestone Jan 15, 2025
@Tobbe Tobbe enabled auto-merge (squash) January 15, 2025 07:37
@Tobbe
Copy link
Member

Tobbe commented Jan 15, 2025

I'm a big fan of early returns. Thanks for cleaning up the code @Philzen 🙏

@Tobbe Tobbe added the fixture-ok Override the test project fixture check label Jan 15, 2025
@Tobbe Tobbe merged commit 121a9b8 into redwoodjs:main Jan 15, 2025
58 of 64 checks passed
@Philzen
Copy link
Contributor Author

Philzen commented Jan 15, 2025

I'm a big fan of early returns. Thanks for cleaning up the code @Philzen 🙏

My pleasure – it's sort of my professional OCD anyway, causing me to act whenever i spot such code smells.

@Philzen Philzen deleted the refactor/simplify-schema-helpers branch January 15, 2025 13:52
Tobbe added a commit that referenced this pull request Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixture-ok Override the test project fixture check release:chore This PR is a chore (means nothing for users)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants