Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions setup-modules/core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,16 @@ check_requirements() {
missing_deps+=("rg")
missing_packages+=("ripgrep")
fi
if ! command -v sqlite3 >/dev/null 2>&1; then
missing_deps+=("sqlite3")
# Package name varies: sqlite3 on Debian/Ubuntu/apt, sqlite on brew/Fedora/Arch/Alpine
local pkg_mgr
pkg_mgr=$(detect_package_manager)
Comment on lines +447 to +448

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This call to detect_package_manager is redundant, as the same function is called again on line 459 if any dependencies are missing. To improve efficiency, you could call detect_package_manager once at the beginning of the check_requirements function and store the result in a variable for reuse.

References
  1. Avoid redundant pre-checks or function calls that perform checks, especially when a helper function handles the logic internally. This prevents logic duplication and improves efficiency.

case "$pkg_mgr" in
apt) missing_packages+=("sqlite3") ;;
*) missing_packages+=("sqlite") ;;
esac
fi

if [[ ${#missing_deps[@]} -gt 0 ]]; then
print_warning "Missing required dependencies: ${missing_deps[*]}"
Expand Down
Loading