Skip to content

Refactor six non-workflow large functions via targeted helper extraction - #48535

Open
pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/lint-monster-function-length-cleanup
Open

Refactor six non-workflow large functions via targeted helper extraction#48535
pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/lint-monster-function-length-cleanup

Conversation

Copilot AI commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the non-workflow largefunc findings identified by lint-monster by splitting the six flagged functions/literals into smaller, cohesive helpers without changing behavior. Scope is limited to the reported parser, CLI entrypoint, and linter-registry/analyzer paths.

  • CLI compile/run wiring cleanup (cmd/gh-aw/main.go)

    • Replaced oversized compile RunE literal with named orchestration helpers:
      • runCompileCommand
      • readCompileFlags / resolveCompileGhAwRef
      • buildCompileConfig
    • Split oversized init setup flow into focused setup units:
      • root command setup, usage rendering, custom help wiring
      • command creation/grouping/registration
      • flag and completion registration
    • Preserved existing flag surface and command behavior while reducing function size hotspots.
  • Git fallback clone flow split (pkg/parser/remote_download_file.go)

    • Broke downloadFileViaGitClone into phase-specific helpers:
      • input validation, temp dir creation, repo URL construction
      • SHA clone+checkout path vs branch/tag clone path
      • validated file read from clone root
    • Kept existing fallback semantics and error text shape.
  • Analyzer logic decomposition (pkg/linters/stringbytesroundtrip/stringbytesroundtrip.go)

    • Refactored analyzeRoundTrip into discrete helpers for:
      • call-shape extraction
      • skip filtering (generated / nolint)
      • type extraction
      • diagnostic emission per pattern (string([]byte(s)) vs []byte(string(b)))
    • Diagnostic messages and detection semantics remain unchanged.
  • Registry All simplification (pkg/linters/registry.go)

    • Moved analyzer list literal into package-level allAnalyzers.
    • All() now returns a defensive copy via append([]*analysis.Analyzer(nil), allAnalyzers...) to preserve caller isolation while eliminating oversized function body.
func All() []*analysis.Analyzer {
	return append([]*analysis.Analyzer(nil), allAnalyzers...)
}

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix function length issues in non-workflow subsystems Refactor six non-workflow large functions via targeted helper extraction Jul 28, 2026
Copilot AI requested a review from pelikhan July 28, 2026 06:28
@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

  • Category: refactor | Risk: medium | Score: 45/100
  • Impact 25 · Urgency 10 · Quality 10
  • Recommended action: defer

Mechanical lint-monster function-splitting cleanup. Draft, no CI signal yet. Low urgency — safe to defer until undrafted and CI runs.

Generated by 🔧 PR Triage Agent · sonnet50 · 50.9 AIC · ⌖ 5.23 AIC · ⊞ 7.5K ·

@pelikhan
pelikhan marked this pull request as ready for review July 28, 2026 07:34
Copilot AI review requested due to automatic review settings July 28, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[lint-monster] Non-workflow function-length cleanup (2026-07-26)

2 participants