-
Notifications
You must be signed in to change notification settings - Fork 58
Closed as not planned
Closed as not planned
Copy link
Labels
automationcode-qualitycookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!refactoringtask-mining
Description
Description
The CompileWorkflowData() function in pkg/workflow/compiler.go is 374 lines long with 15+ validation steps, making it difficult to test, maintain, and understand.
Current State
- File:
pkg/workflow/compiler.go - Function:
CompileWorkflowData()(lines 96-446) - Size: 374 lines (far exceeds ideal 100-200 line guideline)
- Validation steps: 15+ different validations in a single function
- Test coverage: 0.63:1 ratio (below ideal 1:1)
Suggested Changes
Split the monolithic function into focused validation functions:
func (c *Compiler) CompileWorkflowData(data *WorkflowData, path string) error {
if err := c.validateWorkflowConfiguration(data, path); err != nil {
return err
}
if err := c.validateToolConfiguration(data, path); err != nil {
return err
}
return c.generateAndValidateYAML(data, path)
}Create three new functions:
validateWorkflowConfiguration()- Group feature flags, permissions, sandbox validationvalidateToolConfiguration()- Group GitHub tools, MCP, dispatch-workflow validationgenerateAndValidateYAML()- Group YAML generation and post-generation validation
Files Affected
pkg/workflow/compiler.go- RefactorCompileWorkflowData()functionpkg/workflow/compiler_test.go- Add tests for new validation functions
Success Criteria
- Each validation function is 20-50 lines
-
CompileWorkflowData()orchestrates validation, not implements it - Test coverage improved to 1:1 ratio (500+ test lines)
- All existing tests pass
- Error messages remain clear and actionable
Source
Extracted from Daily Compiler Code Quality Report - 2026-02-02
Quote from report:
Function Length (Medium Priority)
CompileWorkflowData()is 374 lines (lines 96-446)- Recommendation: Extract validation logic into dedicated validator functions
Priority
High - This is the primary recommendation from the compiler quality analysis. Improves maintainability and testability of core compilation logic.
Benefits
- Easier testing: Can test each validation group independently
- Clearer errors: Each validator can provide focused error messages
- Better maintainability: Changes to validation logic are isolated
- Follows guidelines: Aligns with 100-200 line validation complexity guidelines
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 16, 2026, 9:16 AM UTC
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
automationcode-qualitycookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!refactoringtask-mining