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:
- Swap the branches:
x !== y ? a : b → x === y ? b : a
- 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