Skip to content

fix(quality): move inner helper functions to module scope (S7721)#479

Merged
RobertLD merged 2 commits intomainfrom
fix/sonar-s7721-inner-functions
Mar 22, 2026
Merged

fix(quality): move inner helper functions to module scope (S7721)#479
RobertLD merged 2 commits intomainfrom
fix/sonar-s7721-inner-functions

Conversation

@RobertLD
Copy link
Copy Markdown
Owner

Summary

  • Moves 10 inner helper functions from inside describe blocks to module scope
  • Functions don't close over any outer-scope variables, so this is a safe pure refactor
  • Fixes SonarCloud S7721 in: confluence.test.ts, slack.test.ts, onenote.test.ts, code-chunker.test.ts, obsidian.test.ts (deduplicates two identical copies of setupVaultFs), config.test.ts

Closes #473

Test plan

  • npm run typecheck passes
  • All 1488 tests pass

🤖 Generated with Claude Code

@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 Preview Mar 22, 2026 2:07am

@RobertLD RobertLD force-pushed the fix/sonar-s7721-inner-functions branch 2 times, most recently from e7ddeed to a04dfd1 Compare March 22, 2026 01:40
Move pure helper functions that do not close over any outer-scope
variables from inside describe blocks to module scope, preventing
them from being recreated on every test invocation.

Files changed:
- tests/unit/confluence.test.ts: mockFetchResponse
- tests/unit/slack.test.ts: setupChannelList, setupMessages, setupUserInfo, setupThreadReplies
- tests/unit/onenote.test.ts: setupGraphMocks
- tests/unit/code-chunker.test.ts: MockNode interface, makeMockNode, createMockedChunker
- tests/unit/obsidian.test.ts: setupVaultFs (deduplicated — both copies merged into one module-scope function)
- tests/unit/config.test.ts: makeConfig

Closes #473

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@RobertLD RobertLD force-pushed the fix/sonar-s7721-inner-functions branch from a04dfd1 to 6dcfe9f Compare March 22, 2026 01:52
@sonarqubecloud
Copy link
Copy Markdown

@RobertLD RobertLD merged commit ae17bd8 into main Mar 22, 2026
10 checks passed
@RobertLD RobertLD deleted the fix/sonar-s7721-inner-functions branch March 22, 2026 02:09
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