Skip to content

Reduce cognitive complexity in TemplateReader#2827

Merged
tastybento merged 1 commit intodevelopfrom
fix/sonar-template-reader-complexity
Mar 4, 2026
Merged

Reduce cognitive complexity in TemplateReader#2827
tastybento merged 1 commit intodevelopfrom
fix/sonar-template-reader-complexity

Conversation

@tastybento
Copy link
Member

Summary

  • Extract readTemplateItem to eliminate duplicated border/background parsing blocks
  • Extract populateContentGrid to flatten the double nested loop that fills the panel grid
  • Extract readFallback to simplify the 3-branch fallback logic
  • Extract readActionsFromSection and readActionsFromList to reduce forEach nesting in action parsing

No behaviour changes. No public API changes. All new methods are private static.

Test plan

  • ./gradlew test passes (all existing tests green)
  • ./gradlew build passes

🤖 Generated with Claude Code

Extract five private static methods (readTemplateItem, populateContentGrid,
readFallback, readActionsFromSection, readActionsFromList) to eliminate
duplicated parsing blocks and flatten deeply nested control flow in
readPanelTemplate and readPanelItemTemplate. No behaviour changes.

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

sonarqubecloud bot commented Mar 4, 2026

@tastybento tastybento merged commit 4da5477 into develop Mar 4, 2026
3 checks passed
@tastybento tastybento deleted the fix/sonar-template-reader-complexity branch March 4, 2026 06:15
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