Skip to content

SonarCloud: JavaScript/TypeScript code quality #546

Closed

Description

@don-petry

SonarCloud: JavaScript/TypeScript code quality

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

View in SonarCloud →

Findings

Rule Count Representative message
javascript:S8754 14 Rename this test title to make it unique within the suite.
javascript:S5976 1 Replace these 3 tests with a single Parameterized one.

Affected files

  • src/calendar-to-sheets/tests/index.test.js (14)
  • src/gmail-to-drive-by-labels/tests/gas-utils.test.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 Aug 25, 2026

    @don-petry
    CollaboratorAuthor

    SonarCloud Audit (2026-08-25): still open — 15 finding(s), worst severity MAJOR.

  2. added
    dev-leadFor dev-lead agent pickup
    and removed
    dev-leadFor dev-lead agent pickup
    on Aug 25, 2026
  3. don-petry commented on Sep 1, 2026

    @don-petry
    CollaboratorAuthor

    SonarCloud Audit (2026-09-01): still open — 15 finding(s), worst severity MAJOR.

  4. added
    dev-leadFor dev-lead agent pickup
    and removed
    dev-leadFor dev-lead agent pickup
    on Sep 1, 2026
  5. don-petry commented on Sep 1, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead Implementation Plan

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

    Scope

    Resolve the 15 open SonarCloud findings — 14 duplicate test titles (S8754) in calendar-to-sheets and 1 parameterizable-test group (S5976) in gmail-to-drive-by-labels — via a behavior-preserving test-file cleanup, with no production-code and no coverage change.

    Findings analysis

    • S8754 (14): src/calendar-to-sheets/tests/index.test.js contains 14 duplicate test-title groups. Verified programmatically: 13 are byte-identical copy-paste blocks and 1 (getConfigs handles empty array SYNC_CONFIGS) is a functionally-equivalent copy (same code paths, toHaveLength/toBeNull vs .length).toBe/toBe(null)). The genuine fix for copy-paste duplication is removing each redundant second occurrence; the surviving twin exercises the identical src/ code, so coverage is unchanged.
    • S5976 (1): src/gmail-to-drive-by-labels/tests/gas-utils.test.js has 3 consecutive structurally-identical single-input/single-assertion tests (the non-breaking-space reply-header cases) that should collapse into one test.each, matching the file's existing test.each style. Exact input literals (which contain U+00A0 non-breaking spaces) are preserved byte-for-byte.

    Implementation Checklist

    • Remove the 14 redundant duplicate test blocks in src/calendar-to-sheets/tests/index.test.js (keep the first occurrence of each title)
    • Convert the 3 NBSP reply-header tests in src/gmail-to-drive-by-labels/tests/gas-utils.test.js into a single test.each, preserving exact titles, inputs, and expectations

    Tests to Write

    • No new tests — this is a behavior-preserving refactor of existing test files (Phase 2 TDD exception). Verification is that the full suite still passes and coverage stays at/above thresholds.

    Test Command

    npm test

  6. don-petry commented on Sep 1, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead: Progress (in progress — not yet durable)

    Provisional. Nothing is pushed yet; the automation posts the authoritative
    completion record (with PR number + head SHA) after the push. Treat the notes
    below as intent, not delivered results.

    Plan Execution (intended)

    • S8754 (14 findings) in src/calendar-to-sheets/tests/index.test.js: removed the 14 redundant duplicate test blocks (verified programmatically as 13 byte-identical + 1 functionally-equivalent copy-paste), keeping the first occurrence of each title. Pure deletion — surviving originals untouched, so each removed block's twin still exercises the same src/ code (no coverage impact). Chose removal over rename because these are genuine copy-paste duplicates; renaming would leave identical bodies under different names, itself a smell and inconsistent with this issue's sibling dedup rule (S5976).
    • S5976 (1 finding) in src/gmail-to-drive-by-labels/tests/gas-utils.test.js: collapsed the 3 non-breaking-space reply-header tests into one test.each, matching the file's existing test.each style. The input literals contain U+00A0 non-breaking spaces — these were preserved byte-for-byte (rewrite done via script, not retyping) along with the exact titles and expectations.

    Local check output (provisional — not the pushed run)

    • No production/.gs code changed; test-file refactor only (Phase 2 TDD exception: behavior-preserving).
    • Local npm test, coverage-threshold check, prettier --check, and eslint were run and looked green locally, but these are pre-push and not authoritative.

    Files touched (this workspace, not yet pushed)

    • src/calendar-to-sheets/tests/index.test.js: removed 14 duplicate test blocks (deletion-only).
    • src/gmail-to-drive-by-labels/tests/gas-utils.test.js: 3 tests → 1 parameterized test.each.

    Notes

    No production behavior change and no coverage change expected (every removed test is a duplicate of a retained one; parameterized cases run identically). Follow-ups: none.

  7. don-petry commented on Sep 1, 2026

    @don-petry
    CollaboratorAuthor

    Dev-Lead: Implementation Complete — PR #565

    The implementation for issue #546 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.

  8. added a commit that references this issue on Sep 1, 2026
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