Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions