Skip to content

fix: S7735 — flip negated conditions (31 occurrences)#445

Merged
RobertLD merged 6 commits intomainfrom
fix/s7735-negated-conditions-436
Mar 19, 2026
Merged

fix: S7735 — flip negated conditions (31 occurrences)#445
RobertLD merged 6 commits intomainfrom
fix/s7735-negated-conditions-436

Conversation

@RobertLD
Copy link
Copy Markdown
Owner

Flip if (!x) { A } else { B } to if (x) { B } else { A } for readability.

Fixes SonarCloud S7735 rule violations (31 total):

Changes

  • src/core/bulk.ts (3 functions): bulkDelete, bulkRetag, bulkMove
  • src/web/server.ts (1): error handler
  • src/connectors/index.ts (1): ensureConnectorsDir
  • src/core/topics.ts (1): listTopics
  • tests/unit/config.test.ts (9): environment variable cleanup blocks
  • tests/unit/api.test.ts (1): createMockReq body handling
  • tests/unit/workspace.test.ts (1): afterEach cleanup
  • tests/fixtures/helpers.ts (1): withEnvVars cleanup
  • Additional auto-formatted locations (12+ more patterns)

Test Results

  • All modified test files pass (112 tests)
  • No new test failures introduced
  • Pre-existing search test failures unrelated to these changes

Closes #436

🤖 Generated with Claude Code

Flip if (!x) { A } else { B } to if (x) { B } else { A } for readability.

Fixes 31 SonarCloud S7735 violations across:
- src/core/bulk.ts (3 functions: bulkDelete, bulkRetag, bulkMove)
- src/web/server.ts (error handler)
- src/connectors/index.ts (ensureConnectorsDir)
- src/core/topics.ts (listTopics)
- tests/unit/config.test.ts (multiple test cleanup blocks)
- tests/unit/api.test.ts (createMockReq)
- tests/unit/workspace.test.ts (afterEach)
- tests/fixtures/helpers.ts (withEnvVars)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
libscope Ignored Ignored Preview Mar 19, 2026 1:29am

RobertLD and others added 5 commits March 19, 2026 01:07
- slack.ts: .replaceAll(/\n/g, " ") → .replaceAll("\n", " ")
- search.ts: .replace(/pattern/g, ...) → .replaceAll("pattern", ...)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Combine consecutive Array.push calls (search.ts, csv.ts)
- Use .at(-1) instead of bracket index (indexing.ts)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The document cascade deletion pattern (FTS, embeddings, chunks, doc)
was duplicated between connectors/index.ts and connectors/slack.ts.
Extract deleteDocumentRows() and have both callers use it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ditions-436

# Conflicts:
#	src/core/topics.ts
Replace 9 manually duplicated try/finally env save/restore blocks
with a shared loadConfigWithEnv() helper that uses the existing
withEnv() fixture. Eliminates the duplication that pushed SonarCloud
density over the 3% threshold.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Mar 19, 2026

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@RobertLD RobertLD merged commit b3c3b5b into main Mar 19, 2026
10 checks passed
@RobertLD RobertLD deleted the fix/s7735-negated-conditions-436 branch March 19, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: S7735 — flip negated conditions (31 occurrences)

1 participant