Skip to content

[lint-monster] Lint Remediation: Parser Infrastructure (Group 2/3) #32704

@github-actions

Description

@github-actions

Summary

Refactor parser infrastructure in pkg/parser/ and pkg/actionpins/ to eliminate ~900 lint findings related to excessive function line length (>60 lines). The parser is the most complex subsystem with functions exceeding 400+ lines.

Affected Packages

  • pkg/parser/ - ~50+ functions with excessive line length (62-599 lines), many in MCP, import, and include processing
  • pkg/actionpins/ - 1+ function with excessive line length

Critical Long Functions (Priority Order)

  1. pkg/parser/frontmatter_extraction_yaml.go:107 - commentOutProcessedFieldsInOnSection is 599 lines (LARGEST)
  2. pkg/parser/schedule_fuzzy_scatter.go:184 - ScatterSchedule is 441 lines
  3. pkg/parser/import_bfs.go:21 - processImportsFromFrontmatterWithManifestAndSource is 492 lines
  4. pkg/parser/schedule_parser.go:300 - parseBase is 207 lines
  5. pkg/parser/schedule_parser.go:93 - parseInterval is 203 lines
  6. pkg/parser/mcp.go:484 - ParseMCPConfig is 253 lines
  7. pkg/parser/mcp.go:255 - processBuiltinMCPTool is 225 lines
  8. pkg/parser/schema_compiler.go:340 - validateWithSchemaAndLocation is 165 lines
  9. pkg/parser/import_field_extractor.go:152 - prepareFrontmatter is 123 lines
  10. pkg/parser/remote_fetch.go:262 - downloadIncludeFromWorkflowSpec is 101 lines

And 40+ additional functions ranging 62-100+ lines.

Remediation Strategy

Phase 1: Ultra-Long Functions (>250 lines)

  • Analyze commentOutProcessedFieldsInOnSection (599 lines):
    1. Identify major logical sections/branches
    2. Extract each section into separate helper functions
    3. Preserve the main function as high-level orchestrator
    4. Write unit tests for each extracted helper
  • Repeat for remaining >250 line functions (import_bfs, schedule_parser, mcp.go)
  • Test parsing workflows with various configurations

Phase 2: Long Functions (100-250 lines)

  • For each function 100-250 lines:
    1. Map out logical sub-operations
    2. Extract 2-3 helper functions per function
    3. Ensure helpers are <60 lines
    4. Preserve error handling and validation flow
    5. Run unit tests for the modified modules
  • Focus on include_field_extractor, remote_fetch, schema_compiler

Phase 3: Moderate Functions (60-100 lines)

  • For each function 60-100 lines:
    1. Extract 1-2 helper functions
    2. Keep helpers focused and readable
    3. Run unit tests
  • 30+ functions in this range

Validation

  • Run make golint-custom and confirm zero errors in pkg/parser/ and pkg/actionpins/
  • Run parser-specific tests: go test -v ./pkg/parser/... ./pkg/actionpins/...
  • Test with sample workflows: ./gh-aw compile <test-workflow.md>
  • Run make agent-report-progress (build + fmt + lint + test-unit) before commit

Important Notes

  • Parser functions have complex logic; decomposition requires careful testing
  • Maintain existing error messages and validation boundaries
  • Extract helpers should have clear, single responsibility
  • Use file suffixes (e.g., _helpers.go) for extracted utility functions if creating new files

Success Criteria

✅ All lint findings in pkg/parser/ and pkg/actionpins/ resolved
✅ All unit tests pass
✅ Workflow compilation still works correctly
✅ No regression in parser behavior

Generated by 🧌 LintMonster · ● 573.9K ·

  • expires on May 23, 2026, 9:19 PM UTC

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions