Skip to content

Fix targeted custom-linter findings outside function-length backlog - #50177

Open
pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/lint-monster-fix-custom-linter-findings
Open

Fix targeted custom-linter findings outside function-length backlog#50177
pelikhan with Copilot wants to merge 2 commits into
mainfrom
copilot/lint-monster-fix-custom-linter-findings

Conversation

Copilot AI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

make golint-custom reported six findings unrelated to the shared function-length backlog: two functions one line over the 60-line limit, one sort.Slice, two loop string concatenations, and one len(s) > 0 emptiness check. Each is addressed with a minimal, local edit.

Function length (61 → under limit)

  • pkg/parser/import_field_extractor.go: moved the six MergedMax* assignments out of the ImportsResult literal into a small applyMergedLimits method.
  • pkg/linters/sortslice/sortslice.go: extracted the selector/package resolution chain in run into sortPackageSelector.

Type-safe sorting

  • pkg/cli/compile_pipeline.go: sort.Sliceslices.SortFunc; the sort import is dropped in favor of slices.
slices.SortFunc(features, func(a, b featureCount) int {
    if a.count != b.count {
        return b.count - a.count
    }
    return strings.Compare(a.name, b.name)
})

Loop concatenation → strings.Builder

  • pkg/workflow/copilot_engine_execution.go: heredoc delimiter escalation loop.
  • pkg/cli/mcp_tools_readonly.go: shellcheck diagnostic accumulator; current becomes a builder, with current.Len() > 0 replacing the current != "" guards and Reset() on flush.

Misc

  • pkg/workflow/copilot_logs.go: len(content.Content) > 0content.Content != "".
  • pkg/ctxutil/ctxutil.go: //nolint:ctxbackground on OrBackground, whose sole purpose is to centralize the context.Background() fallback — the linter cannot distinguish the definition from its misuse.

Remaining golint-custom output is limited to the pre-existing function-length backlog.


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 3.69 AIC · ⌖ 5.78 AIC · ⊞ 8.3K ·
Comment /souschef to run again


Run: https://github.com/github/gh-aw/actions/runs/30886362119

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 4.67 AIC · ⌖ 4.74 AIC · ⊞ 8.3K ·
Comment /souschef to run again


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 5.43 AIC · ⌖ 5.88 AIC · ⊞ 8.3K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix custom linter findings outside function-length backlog Fix targeted custom-linter findings outside function-length backlog Aug 4, 2026
Copilot AI requested a review from pelikhan August 4, 2026 05:14
@pelikhan
pelikhan marked this pull request as ready for review August 4, 2026 05:17
Copilot AI balanced review requested due to automatic review settings August 4, 2026 05:17
@pelikhan

pelikhan commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Resolves targeted custom-linter findings through small, behavior-preserving Go refactors.

Changes:

  • Extracts helpers to satisfy function-length limits.
  • Replaces unsafe sorting and loop concatenation patterns.
  • Applies targeted lint-compliant checks and suppression.
Show a summary per file
File Description
pkg/cli/compile_pipeline.go Uses type-safe feature sorting.
pkg/cli/mcp_tools_readonly.go Builds diagnostics with strings.Builder.
pkg/ctxutil/ctxutil.go Documents intentional background-context fallback.
pkg/linters/sortslice/sortslice.go Extracts sort package resolution.
pkg/parser/import_field_extractor.go Extracts merged-limit assignments.
pkg/workflow/copilot_engine_execution.go Builds heredoc delimiters efficiently.
pkg/workflow/copilot_logs.go Uses an idiomatic string emptiness check.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 7/7 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot This PR needs a quick maintainer-ready refresh.

  • Please update the branch with the latest base changes.
  • Then run the pr-finisher skill and address any remaining feedback before handing back.

Run: https://github.com/github/gh-aw/actions/runs/30882770542

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 3.69 AIC · ⌖ 5.78 AIC · ⊞ 8.3K ·
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot This PR needs a quick maintainer-ready refresh.

  • Please update the branch with the latest base changes.
  • Then run the pr-finisher skill and address any remaining feedback before handing back.

Run: https://github.com/github/gh-aw/actions/runs/30886362119

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 4.67 AIC · ⌖ 4.74 AIC · ⊞ 8.3K ·
Comment /souschef to run again

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Triage: refactor / medium risk

  • Category: refactor
  • Risk: medium
  • Priority score: 35/100 (impact 20, urgency 10, quality 5)
  • Recommended action: defer — not mergeable (dirty/conflicting), CI copilot checks failing (2x failure)
  • Notes: Targeted lint-finding fixes across 7 files (sort.Slice→slices.SortFunc, string-builder loops, function-length reductions). Needs rebase and CI fix before further review.

Generated by 🔧 PR Triage Agent · auto · 28.5 AIC · ⌖ 2.46 AIC · ⊞ 8K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot This PR needs a quick maintainer-ready refresh.

  • Please update the branch with the latest base changes.
  • Then run the pr-finisher skill and address any remaining feedback before handing back.

Run: https://github.com/github/gh-aw/actions/runs/30890137680

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 5.43 AIC · ⌖ 5.88 AIC · ⊞ 8.3K ·
Comment /souschef to run again

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot This PR has merge conflicts and needs a maintainer-ready refresh.

  • Please run make merge-main to resolve the conflicts on this branch.
  • Then run the pr-finisher skill, address any remaining review or CI issues, and hand back when ready.

Run: https://github.com/github/gh-aw/actions/runs/30903169885

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.2 AIC · ⌖ 8.95 AIC · ⊞ 8.3K ·
Comment /souschef to run again

@pelikhan

pelikhan commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

@pelikhan

pelikhan commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile.

Do not use agentfinder

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output.

Review the workflow run logs for details.

@copilot This PR has merge conflicts and needs a maintainer-ready refresh.

  • Please run make merge-main to resolve the conflicts on this branch.
  • Then run the pr-finisher skill, address any remaining review or CI issues, and hand back when ready.

Run: https://github.com/github/gh-aw/actions/runs/30909334614

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 11.8 AIC · ⌖ 11.3 AIC · ⊞ 8.3K ·
Comment /souschef to run again

@pelikhan

pelikhan commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

@copilot resolve the merge conflicts on this branch.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection results could not be parsed.

Review the workflow run logs for details.

Triage update: refactor / medium risk

  • Category: refactor
  • Risk: medium (unchanged)
  • Score: 28 (impact 10 + urgency 8 + quality 10)
  • Recommended action: defer — mergeable_state dirty, repeated merge-conflict refresh requests unresolved, all copilot check-runs failing. Lower priority until conflicts are resolved.

Generated by 🔧 PR Triage Agent · auto · 29.9 AIC · ⌖ 2.62 AIC · ⊞ 8K ·

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot This PR has merge conflicts and needs a maintainer-ready refresh.

  • Please run make merge-main to resolve the conflicts on this branch.
  • Then run the pr-finisher skill, address any remaining review or CI issues, and hand back when ready.

Run: https://github.com/github/gh-aw/actions/runs/30912825871

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 18.4 AIC · ⌖ 7.69 AIC · ⊞ 5.9K ·
Comment /souschef to run again

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] lint-monster: fix targeted custom-linter findings outside function-length backlog

4 participants