-
Notifications
You must be signed in to change notification settings - Fork 266
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 pkg/workflow/compiler.go file contains a repetitive error formatting pattern that appears approximately 20 times throughout the file. This pattern creates significant code duplication (~300 lines) and makes maintenance difficult.
Current Pattern
Lines throughout the file repeat this structure:
formattedErr := console.FormatError(console.CompilerError{
Position: console.ErrorPosition{
File: markdownPath,
Line: 1,
Column: 1,
},
Type: "error",
Message: err.Error(),
})
return errors.New(formattedErr)Suggested Changes
Extract this pattern into a reusable helper function:
func formatCompilerError(markdownPath string, err error) error {
formattedErr := console.FormatError(console.CompilerError{
Position: console.ErrorPosition{
File: markdownPath,
Line: 1,
Column: 1,
},
Type: "error",
Message: err.Error(),
})
return errors.New(formattedErr)
}Usage: Replace ~20 repetitive blocks with:
return formatCompilerError(markdownPath, err)Files Affected
pkg/workflow/compiler.go(~20 occurrences to refactor)
Success Criteria
- Helper function
formatCompilerErrorcreated - All repetitive error formatting blocks replaced with helper call
- Code duplication reduced by ~200 lines
- All existing tests continue to pass
- No change to error message format or behavior
Impact
- Maintainability: Reduces code duplication by ~30%
- Readability: Simplifies error handling patterns
- Effort: 30 minutes estimated
- Priority: Medium - Improves code quality without affecting functionality
Source
Extracted from Daily Compiler Code Quality Report - 2026-01-28 discussion #12164
Quote from source:
"Pattern repeated ~20 times throughout the file... Reduces ~300 lines to ~100 lines, improves maintainability"
Priority
Medium - Improves maintainability but not blocking
AI generated by Discussion Task Miner - Code Quality Improvement Agent
- expires on Feb 18, 2026, 5:21 AM UTC
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
automationcode-qualitycookieIssue Monster Loves Cookies!Issue Monster Loves Cookies!refactoringtask-mining