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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KN8i26JrKSaBdvTrpVEyQ6
This commit is contained in:
Claude
2026-07-15 16:47:00 +00:00
parent 0cfe28a405
commit 2347cb9eae
3 changed files with 9 additions and 3 deletions

View File

@@ -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
/*) ;;

View File

@@ -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
/*) ;;

View File

@@ -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"