refactor(pkg/cli): partial decomposition of largefunc linter violations#36006
Closed
Copilot wants to merge 11 commits into
Closed
refactor(pkg/cli): partial decomposition of largefunc linter violations#36006Copilot wants to merge 11 commits into
Copilot wants to merge 11 commits into
Conversation
5 tasks
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
…od files Fix all 10 function-length violations (>60 lines) in pkg/cli codemod files: - codemod_engine_env_secrets.go: extract engineEnvKeyRemover struct + processLine - codemod_engine_max_runs.go: extract applyEngineMaxRunsMigration, hasInlineEngineMaxRuns, findEngineMaxRunsSuffix, transformEngineMaxRunsLines - codemod_engine_steps.go: extract findEngineStepsStart, findIndentedBlockEnd, deindentStepsLines, findTopLevelStepsEnd, buildLinesWithoutRange, isEngineBlockEmpty, stripEmptyEngineBlock, removeEngineBlockIfEmpty, mergeEngineStepsToTopLevel, applyEngineStepsTransform - codemod_factory.go: extract findFieldAndOnBlock, collectMoveFieldLines, buildOnBlockFromField, insertFieldIntoExistingOnBlock, applyMoveTopLevelKeyToOnBlock - codemod_github_app.go: extract appRenameBlockState struct with updateExit/updateEntry/shouldRenameApp methods - codemod_github_repos.go: extract renameReposToAllowedRepos helper - codemod_mcp_network.go: extract collectMCPNetworkDomains, collectExistingNetworkDomains, transformMCPNetworkLines, applyMCPNetworkMigration, mcpFieldRemover struct, shouldSkipAllowedItem - codemod_network_firewall.go: extract findAgentBlockEnd Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
…nter (≤60 lines) - logs_cache.go: extract runFolderDate helper; cleanupOldRunFolders 65→~45 lines - logs_utils.go: extract extractWorkflowNameFromContent + 7 helpers for findAgentLogFile; both functions reduced to ≤46 lines - logs_command.go: extract logsCommandLong var, addLogsFlags, runLogsCommand, runLogsStdin, resolveLogsWorkflowArg, resolveLogsDateFlags, validateLogsEngine, runLogsDownload - logs_download.go: extract flattenSingleArtifactDir, removeFlattenedDir, buildWorkflowLogsArgs, validateAndBuildZipPath, copyZipEntry, checkArtifactCache, listAndClassifyArtifacts, performArtifactDownload, downloadSelectiveArtifacts, downloadBulkArtifacts, buildBulkDownloadArgs, handleBulkDownloadError, retryAfterCaseCollision, verboseEnumerateArtifacts - Fix pre-existing syntax errors: audit.go multi-line string literals, add_interactive_schedule.go missing context import Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
…d files Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
…rs and failing tests Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor functions in pkg/cli exceeding 60 lines
refactor(pkg/cli): partial decomposition of largefunc linter violations
May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The custom
largefunclinter flagged ~777 functions inpkg/cliexceeding the 60-line limit. This PR makes a first pass at decomposing the largest and most structurally clear offenders.Production files refactored
apply,shouldSkipAllowedItem, and related helpersfindAgentBlockEndTest files refactored
*TestCases()helpersBuild fixes
add_interactive_schedule.go— missingcontextimport addedcompile_summary_output_test.go— restored from a broken state (literal newlines inside string literals caused parse failures)Remaining work
~426 violations remain across ~187 production files (mcp, audit, logs, trial, run, update families). This PR reduces the count from 777 → ~426.