Skip to content

Simplify initialization code by removing redundant operations#47

Merged
cfuehrmann merged 2 commits intomainfrom
refactor/simplify-initialization
Oct 6, 2025
Merged

Simplify initialization code by removing redundant operations#47
cfuehrmann merged 2 commits intomainfrom
refactor/simplify-initialization

Conversation

@cfuehrmann
Copy link
Owner

@cfuehrmann cfuehrmann commented Oct 6, 2025

Summary

Simplifies initialization code by removing redundant operations and unnecessary wrapper functions.

Changes

  • Remove redundant create_dir_all: Directory is guaranteed to exist after create_data_files succeeds
  • Remove template accessor methods: Use template constants directly instead of wrapper functions

Rationale

Directory Creation:
The create_schemas function is called after create_data_files in the initialization flow. Since create_data_files writes files directly to the output directory, the directory must already exist for those writes to succeed.

Template Accessors:
The get_recipe_template() and get_ingredient_template() functions were simple wrappers around constants with no additional logic, making them unnecessary indirection.

Benefits

  • Cleaner, more direct code
  • Fewer function calls and indirection
  • Same functionality with less complexity

All 36 tests pass, confirming no behavioral changes.

Directory is guaranteed to exist after create_data_files succeeds
Use template constants directly instead of wrapper functions
@cfuehrmann cfuehrmann changed the title Remove redundant directory creation in initialization Simplify initialization code by removing redundant operations Oct 6, 2025
@cfuehrmann cfuehrmann merged commit 8e30bb1 into main Oct 6, 2025
5 checks passed
@cfuehrmann cfuehrmann deleted the refactor/simplify-initialization branch October 6, 2025 10:51
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.

1 participant