Skip to content

Bug: \parseInt()\ result not validated for NaN #7

@404-Page-Found

Description

@404-Page-Found

Description

In \src/index.ts:49,68,76:

\\ s
staleDays: opts.staleDays ? parseInt(opts.staleDays, 10) : undefined,
\\

When the user passes a non-numeric value like --stale-days abc, \parseInt('abc', 10)\ returns \NaN. This \NaN\ is passed directly into the config object with no validation.

Impact

\NaN\ flows through the config into \getStaleBranches(NaN, cwd), which computes \cutoff.setDate(NaN)\ producing an Invalid Date. All comparisons against Invalid Date are \ alse, so no branches are ever classified as stale. The tool silently ignores the invalid input instead of rejecting it with an error message.

Suggested Fix

Validate the result of \parseInt()\ and throw a user-friendly error if \isNaN()\ returns true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions