Skip to content

Typo in dangerfile.js leads to unreachable code path #32278

@davegregg

Description

@davegregg

There is a typo in dangerfile.js which results in an unreachable code path which ought to be hit when there is no matching base artifact during DangerCI automated code review.

See:

if (Number === Infinity) {

Compare:
change: Infinity,

And the case which should hit this code path:
// There's no matching base artifact. This is a new file.

Given the above context, the condition Number === Infinity is clearly meant to be decimal === Infinity, which it will be if the catch statement triggers when there is no matching base artifact. Without this fix, the primitive value Infinity is passed to percentFormatter.format(decimal), resulting in the string '+∞%'. With this fix, the resulting string will be the intended 'New file'.

PR 32277 resolves this

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