Skip to content

fix: use String#replaceAll() over replace() with global flag (S7781)#447

Merged
RobertLD merged 7 commits intomainfrom
fix/s7781-string-replaceall
Mar 19, 2026
Merged

fix: use String#replaceAll() over replace() with global flag (S7781)#447
RobertLD merged 7 commits intomainfrom
fix/s7781-string-replaceall

Conversation

@RobertLD
Copy link
Copy Markdown
Owner

Summary

Apply SonarCloud S7781 rule: prefer String#replaceAll() over String#replace() when using regex with the global flag.

This refactoring improves code clarity by using the purpose-built replaceAll() method instead of replace() with /g patterns.

Changes

Converted 23 instances across the codebase:

  • Parser fixes: CSV, HTML, EPUB escaping and cleanup
  • Core improvements: Search FTS queries, webhook IPv6 handling, pack glob patterns
  • Connector updates: OneNote, Slack, Obsidian markdown conversion
  • Helper updates: Spider/URL fetcher directory handling, topic normalization
  • Test fixes: String manipulation patterns in unit and integration tests

Test Plan

  • All 1351 existing tests pass
  • No functional changes, only refactoring to use more appropriate API

🤖 Generated with Claude Code

…S7781)

Apply SonarCloud S7781 rule: prefer .replaceAll() over .replace() when using
regex with the global flag. Converted simple literal patterns and regex patterns
that do not use capture groups.

Changes:
- CSV parser: escape special characters
- Search: FTS query double-quote escaping
- Spider/URL fetcher: directory suffix handling
- Webhooks: IPv6 bracket stripping
- Packs: glob pattern escaping
- Parsers: HTML and EPUB cleanup
- Connectors: OneNote, Slack, Obsidian replacements
- Tests: string manipulation patterns

Co-Authored-By: Claude Opus 4.6 (1M context) <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:13am

RobertLD and others added 6 commits March 19, 2026 00:51
Readable.push() does not accept multiple arguments like Array.push().
The null signals end-of-stream and must be a separate call, otherwise
the stream never ends and API tests hang with timeouts.

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>
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 1519ad1 into main Mar 19, 2026
10 checks passed
@RobertLD RobertLD deleted the fix/s7781-string-replaceall branch March 19, 2026 01:16
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.

1 participant