From 476dc7e647602712f829dfa10898c7ed20198463 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Mon, 16 Mar 2026 20:11:05 +0000 Subject: [PATCH] fix: address PR #10 CodeRabbit review feedback - Fix SC2115 shellcheck warning in build.sh (use ${var:?} for safe rm -rf) - Fix SC2164 shellcheck warning in build.sh (cd build || exit 1) - Standardise bullet points from hyphens to asterisks in .wiki/Contributing.md - Refine verb formality in readme.txt, README.md, .wiki/Contributing.md, .wiki/Coding-Standards.md - Clarify PHPDoc wording in .wiki/Coding-Standards.md - Add clarifying comment to phpcs-simple.xml arg value --- .wiki/Coding-Standards.md | 4 +- .wiki/Contributing.md | 34 ++++++++--------- README.md | 2 +- build.sh | 78 +++++++++++++++++++-------------------- phpcs-simple.xml | 2 +- readme.txt | 2 +- 6 files changed, 61 insertions(+), 61 deletions(-) diff --git a/.wiki/Coding-Standards.md b/.wiki/Coding-Standards.md index c2efa87..88ac6aa 100644 --- a/.wiki/Coding-Standards.md +++ b/.wiki/Coding-Standards.md @@ -67,7 +67,7 @@ if ($condition) { ### Documentation * All classes, methods, and functions should be documented using PHPDoc -* Include a description, parameters, return values, and exceptions +* Include descriptions of parameters, return values, and any exceptions thrown ```php /** @@ -271,7 +271,7 @@ To ensure your code passes the quality checks from these tools, follow these gui 3. **Using AI Assistants with Code Quality Tools** * When you receive feedback from code quality tools, you can use AI assistants to help address the issues * Copy the output from the code quality tool and paste it into your AI assistant chat - * Ask the AI to help you understand and resolve the issues + * Request the AI's assistance to interpret and resolve the reported issues * Example prompt: ```text diff --git a/.wiki/Contributing.md b/.wiki/Contributing.md index 240f997..d9a6087 100644 --- a/.wiki/Contributing.md +++ b/.wiki/Contributing.md @@ -72,33 +72,33 @@ If you want to contribute code: #### Pull Request Guidelines -- Follow the coding standards (see [Coding Standards](Coding-Standards)) -- Write tests for your changes -- Update documentation as needed -- Keep pull requests focused on a single change -- Write a clear, descriptive title and description -- Reference any related issues -- Ensure your code passes the automated code quality checks (see below) +* Follow the coding standards (see [Coding Standards](Coding-Standards)) +* Write tests for your changes +* Update documentation as needed +* Keep pull requests focused on a single change +* Write a clear, descriptive title and description +* Reference any related issues +* Ensure your code passes the automated code quality checks (see below) #### Code Quality Tools This project uses several automated code quality tools to ensure high standards. These tools are free for public repositories and will automatically analyze your code when you create a pull request: 1. **CodeRabbit**: AI-powered code review tool - - [Website](https://www.coderabbit.ai/) - - Provides automated feedback on pull requests + * [Website](https://www.coderabbit.ai/) + * Provides automated feedback on pull requests 2. **CodeFactor**: Continuous code quality monitoring - - [Website](https://www.codefactor.io/) - - Provides a grade for your codebase + * [Website](https://www.codefactor.io/) + * Provides a grade for your codebase 3. **Codacy**: Code quality and static analysis - - [Website](https://www.codacy.com/) - - Identifies issues related to code style, security, and performance + * [Website](https://www.codacy.com/) + * Identifies issues related to code style, security, and performance 4. **SonarCloud**: Code quality and security analysis - - [Website](https://sonarcloud.io/) - - Provides detailed analysis of code quality and security + * [Website](https://sonarcloud.io/) + * Provides detailed analysis of code quality and security #### Using AI Assistants with Code Quality Tools @@ -106,7 +106,7 @@ When you receive feedback from these code quality tools, you can use AI assistan 1. Copy the output from the code quality tool 2. Paste it into your AI assistant chat -3. Ask the AI to help you understand and resolve the issues +3. Request the AI's assistance to interpret and resolve the reported issues 4. Apply the suggested fixes 5. Commit the changes and verify that the issues are resolved @@ -143,7 +143,7 @@ To ensure your code meets the quality standards, run these commands before submi * Check JavaScript coding standards: `npm run lint:js` * Check CSS coding standards: `npm run lint:css` -These checks will help identify and fix issues before they are caught by the automated code quality tools in the pull request process. +These checks will assist in identifying and resolving issues before they are caught by the automated code quality tools in the pull request process. ## Documentation diff --git a/README.md b/README.md index c87d4fd..e2abc99 100644 --- a/README.md +++ b/README.md @@ -376,7 +376,7 @@ When you receive feedback from these code quality tools, you can use AI assistan 1. Copy the output from the code quality tool 2. Paste it into your AI assistant chat -3. Ask the AI to help you understand and resolve the issues +3. Request the AI's assistance to interpret and resolve the reported issues 4. Apply the suggested fixes 5. Commit the changes and verify that the issues are resolved diff --git a/build.sh b/build.sh index 9bd6f6c..def83ce 100755 --- a/build.sh +++ b/build.sh @@ -5,9 +5,9 @@ # Check if version is provided if [ -z "$1" ]; then - echo "❌ Error: Version number is required" - echo "Usage: ./build.sh " - exit 1 + echo "❌ Error: Version number is required" + echo "Usage: ./build.sh " + exit 1 fi VERSION=$1 @@ -22,15 +22,15 @@ mkdir -p "$BUILD_DIR" # Run code quality checks echo "Running code quality checks..." -if command -v composer &> /dev/null; then - echo "Running PHPCS..." - composer run phpcs || { echo "⚠️ PHPCS found issues. Consider running 'composer run phpcbf' to fix them."; } +if command -v composer &>/dev/null; then + echo "Running PHPCS..." + composer run phpcs || { echo "⚠️ PHPCS found issues. Consider running 'composer run phpcbf' to fix them."; } - # Uncomment the following line to automatically fix coding standards issues - # echo "Running PHPCBF..." - # composer run phpcbf + # Uncomment the following line to automatically fix coding standards issues + # echo "Running PHPCBF..." + # composer run phpcbf else - echo "⚠️ Composer not found, skipping code quality checks" + echo "⚠️ Composer not found, skipping code quality checks" fi # Install composer dependencies @@ -54,57 +54,57 @@ mkdir -p "$BUILD_DIR/assets/banner" "$BUILD_DIR/assets/icon" "$BUILD_DIR/assets/ # Copy assets if they exist if [ -d "assets/banner" ]; then - cp -R assets/banner/* "$BUILD_DIR/assets/banner/" + cp -R assets/banner/* "$BUILD_DIR/assets/banner/" fi if [ -d "assets/icon" ]; then - cp -R assets/icon/* "$BUILD_DIR/assets/icon/" + cp -R assets/icon/* "$BUILD_DIR/assets/icon/" fi if [ -d "assets/screenshots" ]; then - cp -R assets/screenshots/* "$BUILD_DIR/assets/screenshots/" + cp -R assets/screenshots/* "$BUILD_DIR/assets/screenshots/" fi # Copy vendor directory if it exists if [ -d "vendor" ]; then - cp -R vendor "$BUILD_DIR/" + cp -R vendor "$BUILD_DIR/" fi -# Create ZIP file +# Create ZIP file. echo "Creating ZIP file..." -cd build +cd build || exit 1 zip -r "../$ZIP_FILE" "$PLUGIN_SLUG" -x "*.DS_Store" -x "*.git*" -x "*.github*" cd .. # Check if ZIP file was created successfully if [ -f "$ZIP_FILE" ]; then - echo "✅ Build successful: $ZIP_FILE created" - echo "File path: $(pwd)/$ZIP_FILE" + echo "✅ Build successful: $ZIP_FILE created" + echo "File path: $(pwd)/$ZIP_FILE" - # Deploy to local WordPress installation if environment variable is set - if [ -n "$WP_LOCAL_PLUGIN_DIR" ]; then - echo "\nDeploying to local WordPress installation..." - echo "Deploying to local WordPress installation..." + # Deploy to local WordPress installation if environment variable is set + if [ -n "$WP_LOCAL_PLUGIN_DIR" ]; then + echo "\nDeploying to local WordPress installation..." + echo "Deploying to local WordPress installation..." - # Remove existing plugin directory - rm -rf "$WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG" + # Remove existing plugin directory. + rm -rf "${WP_LOCAL_PLUGIN_DIR:?}/$PLUGIN_SLUG" - # Copy files to local WordPress installation - rsync -av --exclude=".git" --exclude=".github" --exclude=".DS_Store" \ - "$BUILD_DIR/" "$WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG" + # Copy files to local WordPress installation + rsync -av --exclude=".git" --exclude=".github" --exclude=".DS_Store" \ + "$BUILD_DIR/" "$WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG" - # Clear WordPress transients if WP-CLI is available - if command -v wp &> /dev/null; then - echo "Clearing WordPress transients..." - wp transient delete --all --path="$WP_LOCAL_PLUGIN_DIR/../.." - else - echo "⚠️ WP-CLI not found, skipping transient clearing" - fi + # Clear WordPress transients if WP-CLI is available + if command -v wp &>/dev/null; then + echo "Clearing WordPress transients..." + wp transient delete --all --path="$WP_LOCAL_PLUGIN_DIR/../.." + else + echo "⚠️ WP-CLI not found, skipping transient clearing" + fi - echo "✅ Local deployment successful!" - echo "Plugin deployed to: $WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG" - fi + echo "✅ Local deployment successful!" + echo "Plugin deployed to: $WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG" + fi else - echo "❌ Build failed: ZIP file was not created" - exit 1 + echo "❌ Build failed: ZIP file was not created" + exit 1 fi diff --git a/phpcs-simple.xml b/phpcs-simple.xml index 1be1b41..7aae52c 100644 --- a/phpcs-simple.xml +++ b/phpcs-simple.xml @@ -14,7 +14,7 @@ */build/* */dist/* - + diff --git a/readme.txt b/readme.txt index ce954b1..3322c9c 100644 --- a/readme.txt +++ b/readme.txt @@ -150,7 +150,7 @@ When you receive feedback from these code quality tools, you can use AI assistan 1. Copy the output from the code quality tool 2. Paste it into your AI assistant chat -3. Ask the AI to help you understand and resolve the issues +3. Request the AI's assistance to interpret and resolve the reported issues 4. Apply the suggested fixes 5. Commit the changes and verify that the issues are resolved