Skip to content

SonarCloud: JavaScript/TypeScript code quality #665

Open

Description

@don-petry

SonarCloud: JavaScript/TypeScript code quality

1 open SonarCloud finding(s) in combsmith/google-app-scripts, worst severity MAJOR. Generated by the org SonarCloud Audit.

View in SonarCloud →

Findings

Rule Count Representative message
javascript:S8786 1 Simplify this regular expression to reduce its runtime, as it has super-linear performance

Affected files

  • src/gmail-ai-classifier/src/index.js (1)

Priority

Labeled priority:major — mapped from this bucket's worst SonarCloud severity (MAJOR).

Acceptance

  • All findings in this workstream resolved to zero in SonarCloud
  • No behavior change; CI green
  • Real fixes (no blanket NOSONAR unless a confirmed false positive, noted inline)

Idempotent issue — updated automatically each audit run; auto-closed when the finding count reaches zero.

Activity

  1. don-petry commented on Nov 3, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead Implementation Plan

    Issue: #665 — SonarCloud: JavaScript/TypeScript code quality

    Provisional: posted after local work started. Nothing has been pushed yet. The automation posts the authoritative completion record after the push.

    Scope

    Remove the super-linear regex /([^\s<>,"']+@[a-z0-9.-]+\.[a-z]{2,})/i in extractSenderAddress_ (S8786, src/gmail-ai-classifier/src/index.js:1134) without changing behavior.

    Implementation Checklist

    • src/gmail-ai-classifier/src/index.js: split the sender on the same delimiter class ([\s<>,"']+), then scan each token with small linear helpers (findPlainEmailInToken_, plainDomainMatchEnd_). These keep the old regex's leftmost-longest semantics: the last viable @, and the longest domain.tld with at least 2 letters in the TLD.
    • src/gmail-ai-classifier/code.gs: make the same change so the GAS copy stays in sync.
    • Export extractSenderAddress_ from both files so it can be tested.

    Tests to Write

    • tests/sender-address.test.js, run against both code.gs and src/index.js:
      • table cases, each also asserted equal to the legacy regex
      • 3000 seeded random inputs checked for parity with the legacy regex
      • an adversarial input that must finish in under 500ms (the legacy regex took about 24s locally)

    Test Command

    npm test / npx jest --coverage, npm run check

  2. don-petry commented on Nov 3, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead: Implementation Complete — PR #666

    The implementation for issue #665 is durable: commits are pushed and a pull request is open. This record is backed by verifiable artifacts you can confirm in one click.

    Review happens on the PR. Acceptance criteria and test results are evidenced by the PR's diff and CI checks — not asserted here. If a later stage fails, this claim is retracted in place.

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

    dev-leadFor dev-lead agent pickuppriority:majorSonarCloud MAJOR severitysonarcloud-auditSonarCloud audit finding (idempotent marker)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions