fix: resolve ShellCheck violations in shell scripts (#91)
- SC2155 (bin/localwp-setup.sh): declare local variables separately from command substitution assignments to avoid masking return values (13 fixes) - SC2034 (bin/localwp-setup.sh): remove unused PLUGIN_TEXT_DOMAIN variable - SC2162 (bin/localwp-setup.sh): add -r flag to read to avoid backslash mangling - SC2154 (bin/setup-test-env.sh): add shellcheck disable for PHP variables in heredoc that ShellCheck incorrectly identifies as unassigned shell variables - bin/setup-test-env.sh: remove self-modifying chmod +x $0 (unnecessary and bad practice; file permissions should be set once in version control) - bin/setup-test-env.sh: change == to = in POSIX [ ] test expressions - build.sh: add ./ prefix to directory glob copies for clarity - build.sh: use subshell (cd build || exit 1; zip ...) instead of bare cd/cd.. to avoid SC2103 and ensure working directory is always restored Fixes part of #20 (shell script quality issues)
This commit is contained in:
13
build.sh
13
build.sh
@@ -46,9 +46,9 @@ cp -R README.md LICENSE CHANGELOG.md readme.txt composer.json "$BUILD_DIR/"
|
||||
# Copy directories
|
||||
echo "Copying directories..."
|
||||
mkdir -p "$BUILD_DIR/admin" "$BUILD_DIR/includes" "$BUILD_DIR/languages" "$BUILD_DIR/assets"
|
||||
cp -R admin/* "$BUILD_DIR/admin/"
|
||||
cp -R includes/* "$BUILD_DIR/includes/"
|
||||
cp -R languages/* "$BUILD_DIR/languages/"
|
||||
cp -R ./admin/* "$BUILD_DIR/admin/"
|
||||
cp -R ./includes/* "$BUILD_DIR/includes/"
|
||||
cp -R ./languages/* "$BUILD_DIR/languages/"
|
||||
|
||||
# Create assets directory structure
|
||||
mkdir -p "$BUILD_DIR/assets/banner" "$BUILD_DIR/assets/icon" "$BUILD_DIR/assets/screenshots"
|
||||
@@ -73,9 +73,10 @@ fi
|
||||
|
||||
# Create ZIP file.
|
||||
echo "Creating ZIP file..."
|
||||
cd build || exit 1
|
||||
zip -r "../$ZIP_FILE" "$PLUGIN_SLUG" -x "*.DS_Store" -x "*.git*" -x "*.github*"
|
||||
cd ..
|
||||
(
|
||||
cd build || exit 1
|
||||
zip -r "../$ZIP_FILE" "$PLUGIN_SLUG" -x "*.DS_Store" -x "*.git*" -x "*.github*"
|
||||
)
|
||||
|
||||
# Check if ZIP file was created successfully
|
||||
if [ -f "$ZIP_FILE" ]; then
|
||||
|
||||
Reference in New Issue
Block a user