Refactor six non-workflow large functions via targeted helper extraction - #48535
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
PR Triage
Mechanical lint-monster function-splitting cleanup. Draft, no CI signal yet. Low urgency — safe to defer until undrafted and CI runs.
|
|
@copilot resolve the merge conflicts on this branch. |
There was a problem hiding this comment.
Pull request overview
Refactors six largefunc findings into focused helpers while preserving existing behavior.
Changes:
- Decomposes CLI compilation, initialization, usage, and command registration.
- Splits Git clone fallback into phase-specific helpers.
- Simplifies analyzer logic and linter registry construction.
Show a summary per file
| File | Description |
|---|---|
cmd/gh-aw/main.go |
Extracts CLI orchestration and setup helpers. |
pkg/parser/remote_download_file.go |
Decomposes Git clone fallback logic. |
pkg/linters/stringbytesroundtrip/stringbytesroundtrip.go |
Splits round-trip analysis into focused helpers. |
pkg/linters/registry.go |
Moves analyzers into a package-level registry with defensive copying. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Medium
| githubHost := GetGitHubHostForRepo(owner, repo) | ||
| if host != "" { | ||
| githubHost = "https://" + host |
…ain.go Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Resolved in commit |
This PR addresses the non-workflow
largefuncfindings 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)RunEliteral with named orchestration helpers:runCompileCommandreadCompileFlags/resolveCompileGhAwRefbuildCompileConfiginitsetup flow into focused setup units:Git fallback clone flow split (
pkg/parser/remote_download_file.go)downloadFileViaGitCloneinto phase-specific helpers:Analyzer logic decomposition (
pkg/linters/stringbytesroundtrip/stringbytesroundtrip.go)analyzeRoundTripinto discrete helpers for:generated/nolint)string([]byte(s))vs[]byte(string(b)))Registry
Allsimplification (pkg/linters/registry.go)allAnalyzers.All()now returns a defensive copy viaappend([]*analysis.Analyzer(nil), allAnalyzers...)to preserve caller isolation while eliminating oversized function body.