From 2347cb9eae067e50ea27efd02acef27f068fc4a1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 15 Jul 2026 16:47:00 +0000 Subject: [PATCH] style(claude_desktop): use explicit if for the null path guard (SC2015) Codacy flagged the `A && B || continue` short-circuit pattern in the three tokensave path loops; rewrite it as an explicit if so the fallback can never run when both tests pass. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01KN8i26JrKSaBdvTrpVEyQ6 --- .../rootfs/etc/cont-init.d/81-tokensave_repositories.sh | 4 +++- claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh | 4 +++- claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/claude_desktop/rootfs/etc/cont-init.d/81-tokensave_repositories.sh b/claude_desktop/rootfs/etc/cont-init.d/81-tokensave_repositories.sh index c9ee94147f..7ff5292f28 100755 --- a/claude_desktop/rootfs/etc/cont-init.d/81-tokensave_repositories.sh +++ b/claude_desktop/rootfs/etc/cont-init.d/81-tokensave_repositories.sh @@ -11,7 +11,9 @@ declare -A REPOS_SEEN=() while IFS= read -r configured_path; do configured_path="${configured_path#"${configured_path%%[![:space:]]*}"}" configured_path="${configured_path%"${configured_path##*[![:space:]]}"}" - [ -n "$configured_path" ] && [ "$configured_path" != "null" ] || continue + if [ -z "$configured_path" ] || [ "$configured_path" = "null" ]; then + continue + fi case "$configured_path" in /*) ;; diff --git a/claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh b/claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh index b6c6e3cee1..719460c6bd 100755 --- a/claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh +++ b/claude_desktop/rootfs/etc/cont-init.d/82-claude_tools.sh @@ -171,7 +171,9 @@ if $TOKENSAVE_ENABLED; then # Trim surrounding whitespace while preserving spaces inside paths. configured_path="${configured_path#"${configured_path%%[![:space:]]*}"}" configured_path="${configured_path%"${configured_path##*[![:space:]]}"}" - [ -n "$configured_path" ] && [ "$configured_path" != "null" ] || continue + if [ -z "$configured_path" ] || [ "$configured_path" = "null" ]; then + continue + fi case "$configured_path" in /*) ;; diff --git a/claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh b/claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh index d34647c461..1d2c3c8c6a 100755 --- a/claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh +++ b/claude_desktop/rootfs/usr/local/bin/claude-tools-doctor.sh @@ -150,7 +150,9 @@ if bashio::config.true 'install_tokensave'; then tokensave doctor --agent claude || true tokensave gain --all --range 30d || true while IFS= read -r configured_path; do - [ -n "$configured_path" ] && [ "$configured_path" != "null" ] || continue + if [ -z "$configured_path" ] || [ "$configured_path" = "null" ]; then + continue + fi repo_root="$(s6-setuidgid abc env HOME="$HOME" git -c safe.directory='*' -C "$configured_path" rev-parse --show-toplevel 2> /dev/null || true)" if [ -z "$repo_root" ]; then echo "${configured_path}: not a Git repository"