Skip to content

Numeric CLI flags accept partial values such as 1e4 and 500ms #176

Done

Description

@dacharyc

The numeric flags on afdocs check are parsed with parseInt, which reads only the leading digits of the argument and ignores the rest. A value that is not a plain integer is silently turned into a different number instead of being rejected:

Input Parsed as
--request-delay 500ms 500
--request-delay 1e3 1
--max-concurrency 2.5 2
--pass-threshold 50k 50

The parsed value then passes validation, so the run proceeds with a setting the user did not ask for. The same values in a config file are rejected by the config loader, so the CLI and the config file disagree.

--request-timeout already parses the whole value (fixed in #175). The remaining affected flags are:

  • --max-concurrency
  • --request-delay
  • --max-links
  • --pass-threshold, --fail-threshold
  • --transfer-pass-threshold, --transfer-fail-threshold
  • --coverage-pass-threshold, --coverage-warn-threshold
  • --parity-pass-threshold, --parity-warn-threshold
  • --bulk-table-rows, --bulk-blob-chars, --bulk-dominant-share

Expected: each flag parses the whole argument, so non-integer or non-numeric input fails with the existing validation error. This is a behavior change for anyone passing a value with a trailing unit or a decimal today, so it should be called out in the release notes.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions