Skip to content

[lint-monster] Function Length Refactoring Tracking #37046

@github-actions

Description

@github-actions

[lint-monster] Function Length Refactoring Tracking

Status

Current Issue Count: 636 long functions
Last Updated: 2026-06-05

Overview

This is the authoritative tracking issue for the function-length custom linter finding. The linter enforces a 60-line limit per function across pkg/workflow/ and pkg/cli/.

Directories Affected

Path Count Status
pkg/workflow/ ~600 Not started
pkg/cli/ ~36 Partial (1 issue open: #36947)

Largest Functions Requiring Refactoring

Critical (500+ lines)

  • buildMaintenanceWorkflowYAML (936 lines) — pkg/workflow/maintenance_workflow_yaml.go:33
  • commentOutProcessedFieldsInOnSection (625 lines) — pkg/workflow/frontmatter_extraction_yaml.go:107
  • buildConclusionJob (592 lines) — pkg/workflow/notify_comment.go:28
  • buildPreActivationJob (489 lines) — pkg/workflow/compiler_pre_activation_job.go:20

Very Large (200-400 lines)

  • GetExecutionSteps (382 lines) — pkg/workflow/claude_engine.go:138
  • GetExecutionSteps (350 lines) — pkg/workflow/engine.go:216
  • GetExecutionSteps (338 lines) — pkg/workflow/codex_engine.go:161
  • buildMainJob (385 lines) — pkg/workflow/compiler_main_job.go:26

Refactoring Strategy

Extract Logical Sub-Functions

  • Identify distinct phases or operations within each function
  • Extract into private helper functions prefixed with appropriate naming
  • Preserve function signatures (no breaking changes)

Use Local Structs for Intermediate Results

  • Group related intermediate values into temporary structs
  • Reduces parameter passing between sub-functions

Options Struct Pattern

  • For complex configuration building (many parameters)
  • Reference: .github/skills/developer/SKILL.md code organization guidelines

Validation Workflow

After each refactoring:

make golint-custom   # Verify function passes length check
make build           # Ensure compilation
make fmt             # Format code

Next Steps

  • Slice 1: Refactor 5 largest functions (500+ lines)
  • Slice 2: Refactor 20 very large functions (200-400 lines)
  • Slice 3: Remaining medium functions (60-200 lines)

Related Issues

Generated by 🧌 LintMonster · 177 AIC ·

  • expires on Jun 12, 2026, 3:50 AM UTC

Metadata

Metadata

Assignees

No one assigned

    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