Skip to content

[Code Quality] Refactor compiler to use grouped shell redirects (fix SC2129) #13142

@github-actions

Description

@github-actions

Description

The workflow compiler generates shell scripts that use multiple individual redirects instead of grouped redirects, triggering 315 shellcheck SC2129 style warnings across all 148 compiled workflows.

Current Pattern (Problematic)

cat << 'EOF' > "$FILE"
content
EOF
cat file1 >> "$FILE"
cat file2 >> "$FILE"

Issue: Each redirect opens the file separately, reducing performance and readability.

Recommended Pattern

{
  cat << 'EOF'
  content
  EOF
  cat file1
  cat file2
} > "$FILE"

Benefits: Single file operation, better performance, cleaner code.

Files Affected

  • pkg/workflow/compiler*.go - Template generation code
  • All 148 .lock.yml files (will be auto-regenerated after compiler fix)

Success Criteria

  • Compiler generates grouped redirects for multi-line file writes
  • All shellcheck SC2129 warnings eliminated (315 → 0)
  • Existing workflows recompiled with new pattern
  • No regression in workflow functionality
  • Unit tests verify new code generation pattern

Impact

  • Severity: Low (style issue, not functional bug)
  • Scope: 315 instances across 148 workflows (100% affected)
  • Benefit: Improved code quality, better performance, cleaner audits

Source

Extracted from:

Implementation Hints

Look for code that generates shell script output in the compiler. Search for patterns like:

// Find code that writes multiple cat/echo commands with >> redirects
// Replace with grouped command pattern

Priority: Medium - Systematic issue affecting all workflows, but low severity

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 15, 2026, 5:09 PM UTC

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions