Skip to content

Rename file-close AST walker helper for clearer intent#37568

Merged
pelikhan merged 2 commits into
mainfrom
copilot/function-namer-rename-plan
Jun 7, 2026
Merged

Rename file-close AST walker helper for clearer intent#37568
pelikhan merged 2 commits into
mainfrom
copilot/function-namer-rename-plan

Conversation

Copilot AI commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

This update addresses the function-namer recommendation in pkg/linters/fileclosenotdeferred by replacing an ambiguous internal helper name with one that explicitly describes its role in AST-based file-close pattern analysis. The goal is better readability and discoverability without changing analyzer behavior.

  • Scope

    • Renamed inspectFileNode to analyzeASTNodeForFileClosePatterns in pkg/linters/fileclosenotdeferred/fileclosenotdeferred.go.
    • Updated the single in-package call site in inspectFileFuncDecl.
  • Behavioral impact

    • No logic, control-flow, or diagnostic-message changes.
    • Internal naming-only refactor; analyzer semantics remain unchanged.
  • Representative diff

    ast.Inspect(fn.Body, func(node ast.Node) bool {
        return analyzeASTNodeForFileClosePatterns(pass, fileVars, node)
    })
    
    func analyzeASTNodeForFileClosePatterns(
        pass *analysis.Pass,
        fileVars map[types.Object]*fileVarState,
        node ast.Node,
    ) bool { ... }

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update function names in pkg/linters/fileclosenotdeferred Rename file-close AST walker helper for clearer intent Jun 7, 2026
Copilot AI requested a review from pelikhan June 7, 2026 13:41
@pelikhan pelikhan marked this pull request as ready for review June 7, 2026 13:46
Copilot AI review requested due to automatic review settings June 7, 2026 13:46
@pelikhan pelikhan merged commit 75da8eb into main Jun 7, 2026
@pelikhan pelikhan deleted the copilot/function-namer-rename-plan branch June 7, 2026 13:46

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

This PR performs a naming-only refactor in the fileclosenotdeferred analyzer to make an internal AST-walker helper’s intent more explicit, improving readability and discoverability without changing diagnostics or control flow.

Changes:

  • Renamed the internal helper inspectFileNode to analyzeASTNodeForFileClosePatterns.
  • Updated the single in-package call site used by ast.Inspect to call the renamed helper.
Show a summary per file
File Description
pkg/linters/fileclosenotdeferred/fileclosenotdeferred.go Renames the AST inspection callback helper and updates its call site to match.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[function-namer] Go function rename plan: pkg/linters/fileclosenotdeferred

3 participants