Skip to content

Commit 0c07272

Browse files
committed
fix: separate variable declaration and assignment to resolve ShellCheck SC2155
- Split SCRIPT_DIR and WORK_DIR declaration and assignment - Improves error handling by avoiding masking return values - Follows ShellCheck best practices for readonly variables
1 parent 53f82a5 commit 0c07272

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

scripts/mikrotik-domain-filter-bash.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ set -e
2525

2626
# Path settings
2727
# Automatically determine working directory based on script location
28-
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
29-
readonly WORK_DIR="${WORK_DIR:-${SCRIPT_DIR%/*}}"
28+
# Declare and assign separately to avoid masking return values (SC2155)
29+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
30+
readonly SCRIPT_DIR
31+
WORK_DIR="${WORK_DIR:-${SCRIPT_DIR%/*}}"
32+
readonly WORK_DIR
3033
readonly SOURCES_FILE="${WORK_DIR}/sources.txt"
3134
readonly SOURCESSPECIAL_FILE="${WORK_DIR}/sources_special.txt"
3235
readonly WHITELIST_FILE="${WORK_DIR}/sources_whitelist.txt"

0 commit comments

Comments
 (0)