Extract error formatting helper in compiler.go to reduce duplication#12308
Merged
Extract error formatting helper in compiler.go to reduce duplication#12308
Conversation
- Add formatCompilerError() helper function to reduce repetitive error formatting - Add formatCompilerMessage() helper function for warning messages - Replace 24 instances of repetitive error formatting code with helper calls - Reduce code by 180 lines (240 deleted, 60 added) - Add comprehensive unit tests for both helper functions - All existing compiler tests pass - No change to error message output format Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Replace assert.True with strings.Contains with direct assert.Contains calls - Remove unused strings import - Address testifylint warnings Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Address code review feedback by adding comments explaining why some error cases store the error in a variable before returning (to allow writing invalid YAML to file for debugging) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Extract error formatting helper in compiler.go to reduce duplication
Extract error formatting helper in compiler.go to reduce duplication
Jan 28, 2026
Contributor
|
@copilot format, lint go |
Contributor
Author
Formatting and linting completed successfully. Both
Formatting and linting completed successfully. Both |
Align struct fields per Go formatting standards Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
🔍 PR Triage ResultsCategory: bug | Risk: low | Priority: 60/100 Scores Breakdown
📋 Recommended Action: batch_reviewThis PR should be reviewed as part of a batch of similar bug fixes and refactoring work. The low risk and moderate priority make it suitable for coordinated review. Triaged by PR Triage Agent on 2026-01-28T18:16:26Z
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✅ Completed: Extract Error Formatting Helper in compiler.go
formatCompilerError()in compiler.goSummary
Successfully extracted error formatting logic into helper functions, reducing code duplication:
Code Changes:
formatCompilerError()helper for error returnsformatCompilerMessage()helper for warning stringsTesting:
Code Review:
Files Changed:
pkg/workflow/compiler.go- Added helper functions and replaced 24 instancespkg/workflow/compiler_error_formatting_test.go- New test file with comprehensive coveragepkg/workflow/action_pins_test.go- Formatting alignmentImpact:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.