Skip to content

fix(quality): eliminate negated ternary conditions (S7735) #471

@RobertLD

Description

@RobertLD

Summary

13 SonarCloud issues (S7735) across 9 files where ternary conditions use a negated form (!== undefined, !x) when the positive form would be clearer.

Why

x !== undefined ? doA : doB is harder to read than x === undefined ? doB : doA. Sonar flags these to encourage writing conditions in their natural positive form.

Scope

~13 occurrences across:

  • src/cli/index.ts
  • src/core/
  • src/api/
  • src/connectors/
  • and others

Fix

For each flagged ternary, either:

  1. Swap the branches: x !== y ? a : bx === y ? b : a
  2. Or extract to an if statement when the ternary is being used as a statement (not an expression)

Estimated effort

~26 min total (~2 min/issue)

SonarCloud

View issues

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