Skip to content

fix(quality): reduce cognitive complexity of spiderUrl generator (S3776)#476

Merged
RobertLD merged 1 commit intomainfrom
fix/sonar-s3776-spider-complexity
Mar 22, 2026
Merged

fix(quality): reduce cognitive complexity of spiderUrl generator (S3776)#476
RobertLD merged 1 commit intomainfrom
fix/sonar-s3776-spider-complexity

Conversation

@RobertLD
Copy link
Copy Markdown
Owner

Summary

  • Flattens if (depth > 0) { if (skipped) continue; } into a single guarded continue
  • Removes a redundant inner maxPages check (already guarded by the while-loop condition)
  • Reduces cognitive complexity of spiderUrl from 21 → 14 (threshold: 15)

Resolves SonarCloud CRITICAL issue typescript:S3776 in src/core/spider.ts.

Closes #473

Test plan

  • npm run typecheck passes
  • npm test passes
  • SonarCloud scan shows S3776 resolved for spider.ts

🤖 Generated with Claude Code

Flatten the nested `if (depth > 0) { if (skipped) continue; }` block
into a single guarded continue, and remove the redundant inner
maxPages check (already guarded by the while condition and the
post-loop abortReason assignment). Brings cognitive complexity from
19 down to 14, resolving SonarCloud CRITICAL S3776.

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

vercel bot commented Mar 22, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
libscope Ignored Ignored Mar 22, 2026 0:35am

@sonarqubecloud
Copy link
Copy Markdown

@RobertLD RobertLD merged commit 595ec42 into main Mar 22, 2026
10 checks passed
@RobertLD RobertLD deleted the fix/sonar-s3776-spider-complexity branch March 22, 2026 01:25
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(quality): move inner functions to module scope (S7721)

1 participant