Skip to content

refactor: reduce cognitive complexity across 13 modules - #486

Merged
yacosta738 merged 8 commits into
mainfrom
refactor/reduce-cognitive-complexity
Aug 2, 2026
Merged

yacosta738 merged 8 commits into
mainfrom
refactor/reduce-cognitive-complexity

Conversation

@yacosta738

Copy link
Copy Markdown
Contributor

Summary

Resolves all 28 open SonarQube Cognitive Complexity issues (rule rust:S3776) by decomposing oversized functions using the Extract Method pattern.

Motivation

All 28 issues were CRITICAL severity on SonarCloud. Each function exceeded the maximum allowed cognitive complexity of 15.

Changes

File Issues Fixed Key Extractions
src/update_check.rs 1 should_skip_update_check, fetch_latest_version, check_and_notify
src/config.rs 1 collect_agent_gitignore_entries, collect_target_gitignore_entries
src/commands/status.rs 1 validate_children_directory, collect_child_issues
src/commands/doctor.rs 1 6 per-check diagnostic functions
src/commands/skill.rs 3 Suggest/install renderers, URL converter
src/main.rs 1 handle_init, handle_apply, handle_clean
src/linker.rs 6 Path validators, fence detection, glob matching, clean per-type, symlink handling
src/mcp.rs 1 resolve_config_content, write_or_report_config
src/init.rs 2 Scan helpers, wizard phase extractors
src/skills/detect.rs 6 Rule evaluators, metadata collectors, workspace expanders
src/skills/suggest.rs 2 Render sections, format_installed_status
src/skills/update.rs 1 Update phase extractors
src/skills/install.rs 1 Fetch/unpack archive helpers

Verification

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --all-features (675 tests, 0 failures)
  • make verify-all (includes JS build, docs build)

Notes

  • Pure structural refactoring — zero behavior changes
  • Each extracted function has a descriptive name that documents its purpose
  • No new dependencies added

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant