mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-09-01 17:53:32 +02:00
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:
@@ -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
|
||||
/*) ;;
|
||||
|
||||
@@ -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
|
||||
/*) ;;
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user