From 66ad3b34ee22edc14abf40b2697884ea212d8515 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sun, 28 Dec 2025 11:39:34 +0000 Subject: [PATCH] chore: auto format code --- cmd/analyze/format_test.go | 10 +++++----- lib/clean/system.sh | 4 ++-- lib/core/file_ops.sh | 4 ++-- lib/optimize/tasks.sh | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmd/analyze/format_test.go b/cmd/analyze/format_test.go index 2e95d60..0cc214e 100644 --- a/cmd/analyze/format_test.go +++ b/cmd/analyze/format_test.go @@ -293,11 +293,11 @@ func TestCalculateNameWidth(t *testing.T) { wantMin int wantMax int }{ - {80, 19, 60}, // 80 - 61 = 19 - {120, 59, 60}, // 120 - 61 = 59 - {200, 60, 60}, // Capped at 60 - {70, 24, 60}, // Below minimum, use 24 - {50, 24, 60}, // Very small, use minimum + {80, 19, 60}, // 80 - 61 = 19 + {120, 59, 60}, // 120 - 61 = 59 + {200, 60, 60}, // Capped at 60 + {70, 24, 60}, // Below minimum, use 24 + {50, 24, 60}, // Very small, use minimum } for _, tt := range tests { diff --git a/lib/clean/system.sh b/lib/clean/system.sh index cd6624b..0271004 100644 --- a/lib/clean/system.sh +++ b/lib/clean/system.sh @@ -137,7 +137,7 @@ clean_deep_system() { debug_log "Symbolication cache directory found, checking size..." # Quick size check with timeout (max 5 seconds) local symbolication_size_mb="" - symbolication_size_mb=$(run_with_timeout 5 du -sm "/System/Library/Caches/com.apple.coresymbolicationd/data" 2>/dev/null | awk '{print $1}') + symbolication_size_mb=$(run_with_timeout 5 du -sm "/System/Library/Caches/com.apple.coresymbolicationd/data" 2> /dev/null | awk '{print $1}') # Validate that we got a valid size (non-empty and numeric) if [[ -n "$symbolication_size_mb" && "$symbolication_size_mb" =~ ^[0-9]+$ ]]; then @@ -170,7 +170,7 @@ clean_deep_system() { # Clean each path if exists for ali_path in "${ali_paths[@]}"; do - if sudo test -e "$ali_path" 2>/dev/null; then + if sudo test -e "$ali_path" 2> /dev/null; then debug_log "Found Aliyun component: $ali_path, removing..." safe_sudo_remove "$ali_path" && ((ali_cleaned++)) || true fi diff --git a/lib/core/file_ops.sh b/lib/core/file_ops.sh index 5adf9e9..47c347e 100644 --- a/lib/core/file_ops.sh +++ b/lib/core/file_ops.sh @@ -186,12 +186,12 @@ safe_sudo_find_delete() { local type_filter="${4:-f}" # Validate base directory (use sudo for permission-restricted dirs) - if ! sudo test -d "$base_dir" 2>/dev/null; then + if ! sudo test -d "$base_dir" 2> /dev/null; then debug_log "Directory does not exist (skipping): $base_dir" return 0 fi - if sudo test -L "$base_dir" 2>/dev/null; then + if sudo test -L "$base_dir" 2> /dev/null; then log_error "Refusing to search symlinked directory: $base_dir" return 1 fi diff --git a/lib/optimize/tasks.sh b/lib/optimize/tasks.sh index fcf46c9..8f70a79 100644 --- a/lib/optimize/tasks.sh +++ b/lib/optimize/tasks.sh @@ -210,7 +210,7 @@ opt_network_optimization() { opt_sqlite_vacuum() { local optimized_count=0 local total_saved_kb=0 - local min_size_kb=1024 # Only optimize databases larger than 1MB + local min_size_kb=1024 # Only optimize databases larger than 1MB # List of safe databases to optimize # Exclude critical system databases like Mail, Messages, Photos @@ -228,7 +228,7 @@ opt_sqlite_vacuum() { [[ ! -f "$db_path" ]] && continue # Check if it's a SQLite database - if ! file "$db_path" 2>/dev/null | grep -q "SQLite"; then + if ! file "$db_path" 2> /dev/null | grep -q "SQLite"; then continue fi @@ -252,7 +252,7 @@ opt_sqlite_vacuum() { fi # Verify database integrity before VACUUM - if ! sqlite3 "$db_path" "PRAGMA integrity_check;" 2>/dev/null | grep -q "ok"; then + if ! sqlite3 "$db_path" "PRAGMA integrity_check;" 2> /dev/null | grep -q "ok"; then debug_log "Skipping $db_path - integrity check failed" continue fi @@ -261,9 +261,9 @@ opt_sqlite_vacuum() { local size_before=$db_size_kb # Perform VACUUM with error handling - if sqlite3 "$db_path" "VACUUM;" 2>/dev/null; then + if sqlite3 "$db_path" "VACUUM;" 2> /dev/null; then # Verify database integrity after VACUUM - if ! sqlite3 "$db_path" "PRAGMA integrity_check;" 2>/dev/null | grep -q "ok"; then + if ! sqlite3 "$db_path" "PRAGMA integrity_check;" 2> /dev/null | grep -q "ok"; then debug_log "Warning: $db_path integrity check failed after VACUUM" continue fi