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

Abierto Apto para principiantes
#73,761 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
66/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
tooling

Línea de trabajo

Empieza en pkg/linters/sprintfbool/sprintfbool.go, donde se listan los tres renombrados: run, replacementForCall y buildImportEdits. Localiza cada definición y sus llamadores con grep en pkg/, incluyendo la variable Analyzer y buildFormatBoolFix, y confirma que los nuevos nombres no chocan con identificadores existentes. Ejecuta make build, luego make test-unit y make lint. Está terminado cuando los renombrados están aplicados sin cambio de comportamiento y esos comandos pasan.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

automated-analysis code-quality cookie refactoring
🏷️ Go Function Rename Plan

Package Analyzed: pkg/linters/sprintfbool
Analysis Date: 2026-11-01
Round-Robin Position: package 162 of 249 total packages (selected zero-based index 161; next index 162)
Functions Analyzed: 7 functions across 1 file
Analysis Run: §41302942388

Why This Matters

When AI coding agents search for functions to complete a task, they rely on function names to understand what code does. Clear, descriptive names increase the likelihood that an agent will find the right function instead of reimplementing existing logic. Functions in the same package also call each other, so reviewing them together gives better context for rename decisions.

Key Metrics and Findings
  • The package contains one non-test Go source file and seven functions.
  • Three unexported helper/entry-point names are generic enough to reduce discoverability outside their immediate call site.
  • Serena reference analysis found only local references for all three candidates; no interface method constraints or external package references were identified.
  • The remaining four function names already describe their linter-specific responsibilities clearly and should remain unchanged.
Rename Suggestions
pkg/linters/sprintfbool/sprintfbool.go
Current Name Suggested Name Reason
run() runSprintfBoolAnalyzer() Identifies the function as the entry point for the sprintfbool analyzer instead of leaving a generic run name that is difficult to discover across the repository. Serena found one reference, from the Analyzer variable.
replacementForCall() determineSprintfBoolReplacement() States that the function determines the replacement metadata and fixability for a fmt.Sprintf("%t", ...) call, rather than describing only a generic call-level replacement. Serena found one reference, from run.
buildImportEdits() buildFormatBoolImportEdits() Explains that the edits maintain the strconv/fmt imports needed by the bool-format replacement. Serena found one reference, from buildFormatBoolFix.

All functions in this file (for reference):

  • run() — ⚠️ Rename suggested to runSprintfBoolAnalyzer() (see table above)
  • collectSprintfBoolCandidates() — ✅ Clear, no change needed
  • computeOrphanFmtStatus() — ✅ Clear enough in this package; no change needed
  • reportSprintfBoolDiagnostics() — ✅ Clear, no change needed
  • buildFormatBoolFix() — ✅ Clear, no change needed
  • buildImportEdits() — ⚠️ Rename suggested to buildFormatBoolImportEdits() (see table above)
  • replacementForCall() — ⚠️ Rename suggested to determineSprintfBoolReplacement() (see table above)
🤖 Agentic Implementation Plan
Agentic Implementation Plan

This issue is designed to be assigned to a coding agent. The agent should implement all rename suggestions below in a single pull request.

Prerequisites
  • Read each rename suggestion and verify it is accurate by reviewing the function body.
  • Check for any Go interface constraints that prevent renaming. These functions are currently unexported and Serena found no interface implementation constraints, but verify before editing.
  • Preserve behavior exactly; this is a name-only refactor.
Implementation Steps
1. Rename run in pkg/linters/sprintfbool/sprintfbool.go
// Old
func run(pass *analysis.Pass) (any, error) {

// New
func runSprintfBoolAnalyzer(pass *analysis.Pass) (any, error) {

Update the callback passed to analyzerutil.New:

// Old
var Analyzer = analyzerutil.New("sprintfbool", `...`, run)

// New
var Analyzer = analyzerutil.New("sprintfbool", `...`, runSprintfBoolAnalyzer)
2. Rename replacementForCall in pkg/linters/sprintfbool/sprintfbool.go
// Old
func replacementForCall(pass *analysis.Pass, call *ast.CallExpr, arg ast.Expr, file *ast.File) replacement {

// New
func determineSprintfBoolReplacement(pass *analysis.Pass, call *ast.CallExpr, arg ast.Expr, file *ast.File) replacement {

Update the caller in the analyzer entry point:

// Old
repl := replacementForCall(pass, c.call, c.arg, c.file)

// New
repl := determineSprintfBoolReplacement(pass, c.call, c.arg, c.file)
3. Rename buildImportEdits in pkg/linters/sprintfbool/sprintfbool.go
// Old
func buildImportEdits(
	pass *analysis.Pass,
	file *ast.File,
	seenImportFiles map[token.Pos]bool,
	orphanFmtByFile map[token.Pos]bool,
) []analysis.TextEdit {

// New
func buildFormatBoolImportEdits(
	pass *analysis.Pass,
	file *ast.File,
	seenImportFiles map[token.Pos]bool,
	orphanFmtByFile map[token.Pos]bool,
) []analysis.TextEdit {

Update the caller in buildFormatBoolFix:

// Old
edits = append(edits, buildImportEdits(pass, file, seenImportFiles, orphanFmtByFile)...)

// New
edits = append(edits, buildFormatBoolImportEdits(pass, file, seenImportFiles, orphanFmtByFile)...)
4. Check all call sites

Use grep to find every caller and update the reference:

grep -rn "run\|replacementForCall\|buildImportEdits" pkg/ --include="*.go"

Also check test files:

grep -rn "run\|replacementForCall\|buildImportEdits" pkg/ --include="*_test.go"

The expected references are the Analyzer callback, the call in runSprintfBoolAnalyzer, and the call in buildFormatBoolFix; do not rename unrelated standard run identifiers.

5. Verify compilation after the renames
make build
6. Run tests and lint after all renames are complete
make test-unit
make lint
Commit Convention

Each rename should be a focused commit:

refactor: rename <oldName> to <newName> for clarity

A single pull request is requested for this issue; the agent may use one focused commit per rename or one focused refactor commit if repository policy prefers atomic changes.

Validation Checklist
  • All three renames implemented.
  • All call sites updated in Go files and checked in test files.
  • No unrelated run identifiers were changed.
  • make build passes with no errors.
  • make test-unit passes.
  • make lint passes.
  • Pull request description explains the agent-discoverability rationale.
Notes for the Agent
  • This is a pure rename refactor: behavior must not change, only names.
  • If a rename causes unexpected complexity, such as a name conflict or interface constraint, skip that rename and explain why in the pull request.
  • Follow existing naming conventions documented in AGENTS.md.
  • The other four functions in the file were reviewed and intentionally left unchanged because their names already describe their behavior.
Next Actions

Assign the issue to a coding agent to implement the three focused renames, update their local references, and complete the validation checklist before opening a pull request.

Generated by 🔧 Daily Go Function Namer · pi · routed: gpt56 max · ~3 AIC · ⌖ ~1 AIC · ⊞ 7.4K · ◷

  • expires on Nov 8, 2026, 3:49 AM UTC-08:00
Lenguaje dominante
Go
Estrellas
5.5k
Forks
606
Merge medio
4 h 47 min
PR fusionados (30 d)
797

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de github/gh-aw

Todos los issues de github/gh-aw

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.