Skip eol-normalizer's work on edits that already have the right line endings

Aberta
#20,934 4 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
65/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
shell
Domínio
tooling

Direção de pesquisa

Read the eol-normalizer hook and the hook-budget contract referenced by the acceptance criteria; inspect how the PostToolUse payload supplies the edited file. Start by tracing when normalization work begins and how the existing fixtures verify output bytes. Done means unchanged line endings take no normalization work beyond one process start, wrong line endings still produce the existing fixture output, and the budget contract matches.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Context

With the formatter rows on PostToolUse (#20551), eol-normalizer runs one Write|Edit row with no if, so its full script runs on every Write and Edit, whatever the file type. Measured on Windows (Claude Code 2.1.335, 3 runs, CPU 38 to 74%): about 1 s per edit, which sets the per-edit hook wait even for a .txt edit no formatter matches. On PostToolBatch it skipped most batches, so its median there was about 170 ms.

Proposed work

  • Skip the normalization work when the edited file already has the line endings the repository expects, before any slower step runs.
  • Or run the row with async: true if nothing downstream needs the normalized bytes before the next tool call. Record which and why.

Acceptance criteria

  • An Edit of a file that already has the expected line endings costs eol-normalizer no more than one process start and no normalization work, shown by a test that feeds the PostToolUse payload.
  • An Edit that introduces wrong line endings is still normalized, with output byte-identical to today on the existing fixtures.
  • The hook-budget contract's eol-normalizer row matches.

References

  • #20551 (PR #20927), #20549
Linguagem predominante
Shell
Estrelas
22
Forks
2
Merge médio
3h 20min
PRs com merge (30d)
956

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de melodic-software/claude-code-plugins

Todas as issues de melodic-software/claude-code-plugins

Issues semelhantes

Mais issues de Shell/Bash

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.