Skip to content

fix: miscellaneous minor SonarCloud issues (S7755, S4325, S3863, S7748, S7778)#448

Merged
RobertLD merged 5 commits intomainfrom
fix/misc-minor-sonar-443
Mar 19, 2026
Merged

fix: miscellaneous minor SonarCloud issues (S7755, S4325, S3863, S7748, S7778)#448
RobertLD merged 5 commits intomainfrom
fix/misc-minor-sonar-443

Conversation

@RobertLD
Copy link
Copy Markdown
Owner

Summary

Resolve 33 minor SonarCloud issues across 5 linting rules:

  • S7755: Prefer .at() over bracket index (9 fixes)
  • S4325: Remove unnecessary type assertions (7 fixes)
  • S3863: Merge duplicate imports (6 fixes)
  • S7748: Remove zero fractions from numeric literals (6 fixes)
  • S7778: Combine consecutive Array#push calls (5 fixes)

Changes

S7755: Use .at() for negative indexing

  • src/core/indexing.ts: Replace headingStack[headingStack.length - 1] with headingStack.at(-1)

S4325: Remove unnecessary type assertions

  • src/core/url-fetcher.ts: Remove explicit ReadableStreamDefaultReader<Uint8Array> | undefined cast
  • src/web/server.ts: Remove non-null assertion from server!
  • tests/unit/watcher.test.ts: Replace as ReturnType<typeof vi.fn> with proper vi.mocked() calls
  • tests/unit/reindex.test.ts: Remove as EmbeddingProvider["embedBatch"] and as ReturnType<typeof vi.fn>

S3863: Consolidate duplicate imports

  • tests/unit/batch-search.test.ts: Merge two imports from fixtures/helpers.js
  • src/cli/index.ts: Consolidate imports from connectors/index.js
  • tests/unit/obsidian.test.ts: Merge imports from connectors/obsidian.js

S7748: Remove zero fractions

  • src/core/search.ts: 1.01, 0.00
  • src/core/tags.ts: 2.02, 1.01
  • src/core/dedup.ts: 1.01
  • tests/unit/dedup.test.ts: 1.01

S7778: Combine consecutive push calls

  • src/core/search.ts: Combine three pairs of params.push() calls
  • src/core/parsers/csv.ts: Combine two lines.push() calls
  • tests/unit/api.test.ts: Combine req.push() calls

Test Results

All tests pass (1324 passed, 27 pre-existing timeouts in api.test.ts). Code quality checks passing: format, lint, and typecheck all green.

Closes #443

S7755: prefer .at() over bracket index (9 fixes)
S4325: remove unnecessary type assertions (7 fixes)
S3863: merge duplicate imports (6 fixes)
S7748: remove zero fractions (6 fixes)
S7778: combine consecutive push calls (5 fixes)

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:02am

RobertLD and others added 4 commits March 19, 2026 00:53
Readable.push() does not accept multiple arguments like Array.push().
The null signals end-of-stream and must be a separate call.

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

@RobertLD RobertLD merged commit ef2a6f7 into main Mar 19, 2026
10 checks passed
@RobertLD RobertLD deleted the fix/misc-minor-sonar-443 branch March 19, 2026 01:05
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: miscellaneous SonarCloud findings (small groups, 1-9 each)

1 participant