Bug Description
reset in src/commands/config/getSetReset.ts (lines 38-50)
contains a completely useless delete config[key] statement
that modifies a local object which is never written back to disk.
Root Cause
reset(key: string): void {
const config = this.getConfig(); // reads fresh config from disk
if (!(key in config)) {
this.failSpinner(`Configuration key '${key}' does not exist.`);
return;
}
delete config[key]; // modifies LOCAL object — NEVER persisted
this.writeConfig(key, undefined); // reads ANOTHER fresh config from disk
this.succeedSpinner(`Configuration successfully reset`);
}
Impact
The delete config[key] on line 47 is dead code — it modifies
a local variable that is immediately discarded. writeConfig
then reads a completely fresh copy from disk anyway. This suggests
a logic misunderstanding that could cause real bugs if someone
refactors this code expecting the delete to have been persisted.
Suggested Fix
reset(key: string): void {
const config = this.getConfig();
if (!(key in config)) {
this.failSpinner(`Configuration key '${key}' does not exist.`);
return;
}
// Remove dead code - writeConfig handles persistence
this.writeConfig(key, undefined);
this.succeedSpinner(`Configuration successfully reset`);
}
File
src/commands/config/getSetReset.ts lines 38-50
Severity: Medium
Bug Description
resetinsrc/commands/config/getSetReset.ts(lines 38-50)contains a completely useless
delete config[key]statementthat modifies a local object which is never written back to disk.
Root Cause
Impact
The
delete config[key]on line 47 is dead code — it modifiesa local variable that is immediately discarded.
writeConfigthen reads a completely fresh copy from disk anyway. This suggests
a logic misunderstanding that could cause real bugs if someone
refactors this code expecting the delete to have been persisted.
Suggested Fix
File
src/commands/config/getSetReset.tslines 38-50Severity: Medium