Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions bin/mac-ops
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ _mac_ops_cmd_run() {
mac_ops_log_warn "Some modules timed out or failed during parallel execution"

# Sum up from statistics files
# shellcheck disable=SC1073,SC1036,SC1058,SC1072
for stats_file in "${stats_dir}"/*.stats(N); do
[[ ! -f "${stats_file}" ]] && continue
mod_count=0; mod_bytes=0
Expand Down
1 change: 1 addition & 0 deletions lib/core/logger.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MAC_OPS_LOG_FILE="${MAC_OPS_LOG_DIR}/mac-ops.log"

# Log level constants
typeset -A MAC_OPS_LOG_LEVELS
# shellcheck disable=SC2190
MAC_OPS_LOG_LEVELS=(
DEBUG 0
INFO 1
Expand Down
7 changes: 5 additions & 2 deletions lib/core/trash.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ _mac_ops_json_escape() {
# -----------------------------------------------------------------------------
_mac_ops_json_extract_string() {
local line="${1}"
# shellcheck disable=SC2076
if [[ "${line}" =~ ':[[:space:]]*"(.*)"' ]]; then
local val="${match[1]}"
# Unescape
Expand All @@ -50,6 +51,7 @@ _mac_ops_json_extract_string() {
# -----------------------------------------------------------------------------
_mac_ops_json_extract_number() {
local line="${1}"
# shellcheck disable=SC2076
if [[ "${line}" =~ ':[[:space:]]*([0-9]+)' ]]; then
print -- "${match[1]}"
fi
Expand Down Expand Up @@ -132,7 +134,7 @@ mac_ops_index_read() {
'"expire_after":'*)
_MAC_OPS_IDX_EXPIRE[${current_key}]="$(_mac_ops_json_extract_string "${trimmed}")"
;;
'}'*|'},')
'}'*) # matches both '}' and '},'
current_key=""
;;
esac
Expand Down Expand Up @@ -274,6 +276,7 @@ _mac_ops_migrate_plist_to_index() {
[[ ! -d "${MAC_OPS_META_DIR}" ]] && return 0

local plist_files
# shellcheck disable=SC1036
plist_files=("${MAC_OPS_META_DIR}"/*.plist(N))
[[ ${#plist_files} -eq 0 ]] && return 0

Expand Down Expand Up @@ -322,7 +325,7 @@ _mac_ops_migrate_plist_to_index() {
'"expire_after":'*)
_MAC_OPS_IDX_EXPIRE[${current_key}]="$(_mac_ops_json_extract_string "${trimmed}")"
;;
'}'*|'},')
'}'*) # matches both '}' and '},'
current_key=""
;;
esac
Expand Down
1 change: 1 addition & 0 deletions lib/modules/orphan-app-cleanup.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ _mac_ops_collect_installed_bundles() {
for app_base in "${app_dirs[@]}"; do
[[ ! -d "${app_base}" ]] && continue

# shellcheck disable=SC1073,SC1036,SC1058,SC1072
for app_path in "${app_base}"/*.app(N); do
[[ ! -d "${app_path}" ]] && continue

Expand Down
3 changes: 3 additions & 0 deletions lib/utils/format.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ mac_ops_format_bytes() {
if (( bytes < 1024 )); then
echo "${bytes} B"
elif (( bytes < 1048576 )); then
# shellcheck disable=SC2079
printf "%.1f KB\n" $(( bytes / 1024.0 ))
elif (( bytes < 1073741824 )); then
# shellcheck disable=SC2079
printf "%.1f MB\n" $(( bytes / 1048576.0 ))
else
# shellcheck disable=SC2079
printf "%.1f GB\n" $(( bytes / 1073741824.0 ))
fi
}
Expand Down
1 change: 1 addition & 0 deletions lib/utils/notify.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ mac_ops_notify_completion() {
fi

# Join message parts
# shellcheck disable=SC2296
message="${(j:, :)message_parts}"

# Send notification
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/parallel.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ mac_ops_parallel_wait_with_timeout() {
# Record start time for each PID
typeset -A start_times
typeset -A completed
local current_time=$(date +%s)
local current_time
current_time=$(date +%s)
for pid in "${pids[@]}"; do
start_times[$pid]=$current_time
completed[$pid]=0
Expand Down
4 changes: 2 additions & 2 deletions tests/test-modules.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ print "[TEST] test_analyze"
local analyze_output
analyze_output=$(mac_ops_analyze 2>/dev/null)
assert_exit_code "$?" "0" "analyze completes without error"
assert_output_contains "${analyze_output}" "총 절약 가능 공간" "analyze output contains total summary"
assert_output_contains "${analyze_output}" "Total Reclaimable Space" "analyze output contains total summary"

print ""

Expand Down Expand Up @@ -247,7 +247,7 @@ cli_analyze_output=$("${MAC_OPS_ROOT}/bin/mac-ops" analyze 2>&1)
local cli_analyze_exit=$?

assert_exit_code "${cli_analyze_exit}" "0" "bin/mac-ops analyze exits 0"
assert_output_contains "${cli_analyze_output}" "총 절약 가능 공간" "analyze CLI output contains total summary"
assert_output_contains "${cli_analyze_output}" "Total Reclaimable Space" "analyze CLI output contains total summary"

print ""

Expand Down