-
Notifications
You must be signed in to change notification settings - Fork 318
[task] Organize scattered helper functions into dedicated helper files #3538
Copy link
Copy link
Closed
Description
Objective
Create dedicated helper files and move generic helper functions from various files to improve code organization and reduce duplication.
Context
Generic helper functions are distributed across multiple files without clear organizational pattern. Examples include configuration parsing helpers in config.go and generic utilities in frontmatter_extraction.go.
Part of issue #3435.
Approach
1. Create helper files
pkg/workflow/config_helpers.go- Configuration parsing helperspkg/workflow/frontmatter_helpers.go- Frontmatter extraction utilities
2. Move configuration parsing helpers from config.go
Move these functions to config_helpers.go:
parseLabelsFromConfig(configMap map[string]any) []stringparseTitlePrefixFromConfig(configMap map[string]any) stringparseTargetRepoFromConfig(configMap map[string]any) string- Any other similar config parsing helper functions
3. Move frontmatter utilities from frontmatter_extraction.go
Move these functions to frontmatter_helpers.go:
extractStringValue(frontmatter map[string]any, key string) stringparseIntValue(value any) (int, bool)filterMapKeys(m map[string]any, keysToKeep []string) map[string]any- Any other similar generic utility functions
4. Update imports and references
- Update all files that call these helper functions
- Ensure no circular dependencies
- Verify helper functions are exported (capitalized) if needed across packages
Files to Modify
Create:
pkg/workflow/config_helpers.gopkg/workflow/frontmatter_helpers.go
Update:
pkg/workflow/config.go(remove moved functions)pkg/workflow/frontmatter_extraction.go(remove moved functions)- Any files that import these helper functions
- Update test files as needed
Acceptance Criteria
- New helper files created with clear purpose
- Generic helper functions moved from scattered locations
- All imports updated correctly
- No circular dependencies introduced
- All tests pass (
make test-unit) - Code follows Go best practices for helper organization
- Helper functions are properly documented
Related to [refactor] 🔧 Semantic Function Clustering Analysis - Code Organization Opportunities #3435
AI generated by Plan Command for #3435
Reactions are currently unavailable
Metadata
Metadata
Assignees
Type
Fields
Give feedbackNo fields configured for issues without a type.