Skip to content

[linter-miner] Add splitindexzero linter #72731

Not planned

Description

@github-actions

Tip

Your pull request is ready to create! 🎉 ✅

Everything is OK—the changes have been pushed to a branch. Please review the protected files, then create the pull request when you are ready.

Create the pull request

The original pull request description is below.


Adds splitindexzero, which reports strings.Split(s, sep)[0] and strings.SplitN(s, sep, 2)[0] with a constant non-empty separator. These allocate a slice just to read the first segment; strings.Cut does not.

Evidence: the codebase has ~8 such sites (e.g. pkg/workflow/known_action_credentials.go, pkg/cli/mcp_tools_management.go, pkg/cli/setup_repository.go). No existing linter or default golangci-lint rule covers this.

Details: type-aware matching of stdlib strings (aliases ok, shadowing ignored), skips generated files and honours (nolint/redacted):splitindexzero. It is registered in pkg/linters/registry.go and listed in doc.go and the README. It is added to notYetEnforced because existing violations need remediation first. Tests pass in pkg/linters and pkg/linters/splitindexzero.

The discussion-miner and code-pattern-scanner sub-agents were not run; candidates came from direct codebase grep.


Note

Protected files

This patch modifies protected files, which may affect project dependencies, CI/CD pipelines, or agent behaviour.

Protected files
  • README.md

To route changes like this to a review issue instead of blocking, configure protected-files: fallback-to-issue in your workflow configuration.

Generated by Linter Miner · copilot · sonnet55 · ~37 AIC · ⌖ ~22 AIC · ⊞ 9.9K · ◷

  • expires on Nov 4, 2026, 9:36 AM UTC-08:00

Activity

  1. linked a pull request that will close this issueAdd splitindexzero analyzer #74904on Nov 4, 2026
  2. github-actions commented on Nov 4, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, Copilot will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt50 · ~1 AIC · ⌖ ~1 AIC · ⊞ 12.9K · ◷

  3. github-actions commented on Nov 4, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-11-04T17:36:31.045Z.

    Closed by Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions