Skip to content

benchmarks/loc.js: block comment regex corrupts string literals containing /* */ #389

Description

@nanaubusiness

In benchmarks/loc.js line 9:

const code = (blocks.length ? blocks.join('\n') : text).replace(/\/\*[\s\S]*?\*\//g, '');

Removes all /* ... */ patterns without checking if they're inside string literals. Code like const s = "/* not a comment */"; would lose that line's content, undercounting LOC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions