feat(DEP0206): remove provably redundant `Hmac.digest()` calls
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- tooling
Direzione di ricerca
Start by reading the repository’s existing codemod entry points and fixture conventions; this issue does not name specific files. Use the adjacent argument-free call example as the initial supported case, and add fixtures for the listed edge cases. Done means only provably redundant standalone calls are removed, consumed results are reported for manual review, and the transform is idempotent.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Node.js 27.0.0-alpha.0.0.0 introduces a runtime deprecation warning when Hmac.digest() is called on an already-finalized Hmac instance. This behavior is tracked by DEP0206; the repeated call has not yet been removed.
Add a narrowly scoped codemod that removes a redundant call only when the instance is provably already finalized and the repeated call's return value is unused.
Start with straight-line local code using an unmodified Hmac instance created through crypto.createHmac(). Support CommonJS and ESM bindings, aliases, and both crypto and node:crypto specifiers.
Additional Information
- The initial automatic transformation should handle adjacent calls on the same stable local binding: the first call finalizes the Hmac, and the following argument-free
hmac.digest();is a standalone expression statement. - Do not transform unresolved receivers, reassignments, escaped instances, overridden methods, or cases with uncertain control flow.
- Do not remove a repeated call with arguments that may have side effects or cause an encoding error. These cases are outside the initial scope.
- When the repeated result is consumed, report the call for manual review. Reusing the first digest changes behavior: a repeated call currently returns an empty Buffer or encoded empty string, not the original digest.
- Do not replace repeated results with cached digests or empty values automatically.
- Leave the first digest and unrelated methods unchanged. The transform must be idempotent.
- Include fixtures for the supported adjacent-call pattern, consumed results, aliases, shadowed bindings, invalid encodings, and calls in different branches.
Examples
Supported automatic cleanup:
import { createHmac } from 'node:crypto';
const hmac = createHmac('sha256', 'secret');
hmac.update('message');
const digest = hmac.digest('hex');
-hmac.digest();
console.log(digest);
Keep unchanged and report for manual review:
const first = hmac.digest('hex');
const second = hmac.digest('hex');
consume(first, second);
The codemod cannot assume that second should equal first.
Refs
- Lingua principale
- TypeScript
- Stelle
- 85
- Fork
- 58
- Merge medio
- 2g 4h
- PR unite (30g)
- 6
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nodejs/userland-migrations
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
nodejs/userland-migrations#562 · 4 reazioni ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
nodejs/userland-migrations#561 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
good first issue human help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
nodejs/userland-migrations#560 · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
good first issue human help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
nodejs/userland-migrations#559 ·
I maintainer di solito rispondono entro 2 giorni
-
good first issue human help wanted
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
nodejs/userland-migrations#558 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di nodejs/userland-migrations
Issue simili
-
content triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tensorflow/tfjs#8754 ·
-
tool-submission
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
BraveOPotato/NoSignups#2348 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
code-yeongyu/oh-my-openagent#12784 ·
I maintainer di solito rispondono entro 1 giorno
-
external-issue to-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
I maintainer di solito rispondono entro 1 giorno