Compare commits
3 Commits
29622dd54c
...
quality-de
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c8fbdd385 | |||
| eb0a3860ff | |||
| 476dc7e647 |
8
.github/workflows/code-quality.yml
vendored
8
.github/workflows/code-quality.yml
vendored
@@ -29,11 +29,6 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --prefer-dist --no-progress
|
run: composer install --prefer-dist --no-progress
|
||||||
|
|
||||||
- name: Install WordPress Coding Standards
|
|
||||||
run: |
|
|
||||||
composer require --dev wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installer
|
|
||||||
vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs
|
|
||||||
|
|
||||||
- name: Run PHPCS
|
- name: Run PHPCS
|
||||||
run: composer phpcs
|
run: composer phpcs
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
@@ -61,9 +56,6 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --prefer-dist --no-progress
|
run: composer install --prefer-dist --no-progress
|
||||||
|
|
||||||
- name: Install PHPStan WordPress stubs
|
|
||||||
run: composer require --dev szepeviktor/phpstan-wordpress
|
|
||||||
|
|
||||||
- name: Run PHPStan
|
- name: Run PHPStan
|
||||||
run: composer phpstan
|
run: composer phpstan
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|||||||
7
.github/workflows/tests.yml
vendored
7
.github/workflows/tests.yml
vendored
@@ -34,11 +34,8 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --prefer-dist --no-progress
|
run: composer install --prefer-dist --no-progress
|
||||||
|
|
||||||
# - name: Debug test file content
|
- name: Run tests
|
||||||
# run: echo "--- Debugging tests/test-admin.php lines 75-95 ---" && sed -n '75,95p' tests/test-admin.php && echo "--- End Debugging ---"
|
run: ./vendor/bin/phpunit
|
||||||
|
|
||||||
# - name: Run tests
|
|
||||||
# run: ./vendor/bin/phpunit
|
|
||||||
|
|
||||||
code-style:
|
code-style:
|
||||||
name: Code Style
|
name: Code Style
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ if ($condition) {
|
|||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
* All classes, methods, and functions should be documented using PHPDoc
|
* 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
|
```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**
|
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
|
* 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
|
* 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:
|
* Example prompt:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
|
|||||||
@@ -72,33 +72,33 @@ If you want to contribute code:
|
|||||||
|
|
||||||
#### Pull Request Guidelines
|
#### Pull Request Guidelines
|
||||||
|
|
||||||
- Follow the coding standards (see [Coding Standards](Coding-Standards))
|
* Follow the coding standards (see [Coding Standards](Coding-Standards))
|
||||||
- Write tests for your changes
|
* Write tests for your changes
|
||||||
- Update documentation as needed
|
* Update documentation as needed
|
||||||
- Keep pull requests focused on a single change
|
* Keep pull requests focused on a single change
|
||||||
- Write a clear, descriptive title and description
|
* Write a clear, descriptive title and description
|
||||||
- Reference any related issues
|
* Reference any related issues
|
||||||
- Ensure your code passes the automated code quality checks (see below)
|
* Ensure your code passes the automated code quality checks (see below)
|
||||||
|
|
||||||
#### Code Quality Tools
|
#### 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:
|
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
|
1. **CodeRabbit**: AI-powered code review tool
|
||||||
- [Website](https://www.coderabbit.ai/)
|
* [Website](https://www.coderabbit.ai/)
|
||||||
- Provides automated feedback on pull requests
|
* Provides automated feedback on pull requests
|
||||||
|
|
||||||
2. **CodeFactor**: Continuous code quality monitoring
|
2. **CodeFactor**: Continuous code quality monitoring
|
||||||
- [Website](https://www.codefactor.io/)
|
* [Website](https://www.codefactor.io/)
|
||||||
- Provides a grade for your codebase
|
* Provides a grade for your codebase
|
||||||
|
|
||||||
3. **Codacy**: Code quality and static analysis
|
3. **Codacy**: Code quality and static analysis
|
||||||
- [Website](https://www.codacy.com/)
|
* [Website](https://www.codacy.com/)
|
||||||
- Identifies issues related to code style, security, and performance
|
* Identifies issues related to code style, security, and performance
|
||||||
|
|
||||||
4. **SonarCloud**: Code quality and security analysis
|
4. **SonarCloud**: Code quality and security analysis
|
||||||
- [Website](https://sonarcloud.io/)
|
* [Website](https://sonarcloud.io/)
|
||||||
- Provides detailed analysis of code quality and security
|
* Provides detailed analysis of code quality and security
|
||||||
|
|
||||||
#### Using AI Assistants with Code Quality Tools
|
#### 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
|
1. Copy the output from the code quality tool
|
||||||
2. Paste it into your AI assistant chat
|
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
|
4. Apply the suggested fixes
|
||||||
5. Commit the changes and verify that the issues are resolved
|
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 JavaScript coding standards: `npm run lint:js`
|
||||||
* Check CSS coding standards: `npm run lint:css`
|
* 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
|
## Documentation
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
1. Copy the output from the code quality tool
|
||||||
2. Paste it into your AI assistant chat
|
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
|
4. Apply the suggested fixes
|
||||||
5. Commit the changes and verify that the issues are resolved
|
5. Commit the changes and verify that the issues are resolved
|
||||||
|
|
||||||
|
|||||||
78
build.sh
78
build.sh
@@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
# Check if version is provided
|
# Check if version is provided
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
echo "❌ Error: Version number is required"
|
echo "❌ Error: Version number is required"
|
||||||
echo "Usage: ./build.sh <version>"
|
echo "Usage: ./build.sh <version>"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSION=$1
|
VERSION=$1
|
||||||
@@ -22,15 +22,15 @@ mkdir -p "$BUILD_DIR"
|
|||||||
|
|
||||||
# Run code quality checks
|
# Run code quality checks
|
||||||
echo "Running code quality checks..."
|
echo "Running code quality checks..."
|
||||||
if command -v composer &> /dev/null; then
|
if command -v composer &>/dev/null; then
|
||||||
echo "Running PHPCS..."
|
echo "Running PHPCS..."
|
||||||
composer run phpcs || { echo "⚠️ PHPCS found issues. Consider running 'composer run phpcbf' to fix them."; }
|
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
|
# Uncomment the following line to automatically fix coding standards issues
|
||||||
# echo "Running PHPCBF..."
|
# echo "Running PHPCBF..."
|
||||||
# composer run phpcbf
|
# composer run phpcbf
|
||||||
else
|
else
|
||||||
echo "⚠️ Composer not found, skipping code quality checks"
|
echo "⚠️ Composer not found, skipping code quality checks"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Install composer dependencies
|
# 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
|
# Copy assets if they exist
|
||||||
if [ -d "assets/banner" ]; then
|
if [ -d "assets/banner" ]; then
|
||||||
cp -R assets/banner/* "$BUILD_DIR/assets/banner/"
|
cp -R assets/banner/* "$BUILD_DIR/assets/banner/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "assets/icon" ]; then
|
if [ -d "assets/icon" ]; then
|
||||||
cp -R assets/icon/* "$BUILD_DIR/assets/icon/"
|
cp -R assets/icon/* "$BUILD_DIR/assets/icon/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "assets/screenshots" ]; then
|
if [ -d "assets/screenshots" ]; then
|
||||||
cp -R assets/screenshots/* "$BUILD_DIR/assets/screenshots/"
|
cp -R assets/screenshots/* "$BUILD_DIR/assets/screenshots/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy vendor directory if it exists
|
# Copy vendor directory if it exists
|
||||||
if [ -d "vendor" ]; then
|
if [ -d "vendor" ]; then
|
||||||
cp -R vendor "$BUILD_DIR/"
|
cp -R vendor "$BUILD_DIR/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create ZIP file
|
# Create ZIP file.
|
||||||
echo "Creating 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*"
|
zip -r "../$ZIP_FILE" "$PLUGIN_SLUG" -x "*.DS_Store" -x "*.git*" -x "*.github*"
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Check if ZIP file was created successfully
|
# Check if ZIP file was created successfully
|
||||||
if [ -f "$ZIP_FILE" ]; then
|
if [ -f "$ZIP_FILE" ]; then
|
||||||
echo "✅ Build successful: $ZIP_FILE created"
|
echo "✅ Build successful: $ZIP_FILE created"
|
||||||
echo "File path: $(pwd)/$ZIP_FILE"
|
echo "File path: $(pwd)/$ZIP_FILE"
|
||||||
|
|
||||||
# Deploy to local WordPress installation if environment variable is set
|
# Deploy to local WordPress installation if environment variable is set
|
||||||
if [ -n "$WP_LOCAL_PLUGIN_DIR" ]; then
|
if [ -n "$WP_LOCAL_PLUGIN_DIR" ]; then
|
||||||
echo "\nDeploying to local WordPress installation..."
|
echo "\nDeploying to local WordPress installation..."
|
||||||
echo "Deploying to local WordPress installation..."
|
echo "Deploying to local WordPress installation..."
|
||||||
|
|
||||||
# Remove existing plugin directory
|
# Remove existing plugin directory.
|
||||||
rm -rf "$WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG"
|
rm -rf "${WP_LOCAL_PLUGIN_DIR:?}/$PLUGIN_SLUG"
|
||||||
|
|
||||||
# Copy files to local WordPress installation
|
# Copy files to local WordPress installation
|
||||||
rsync -av --exclude=".git" --exclude=".github" --exclude=".DS_Store" \
|
rsync -av --exclude=".git" --exclude=".github" --exclude=".DS_Store" \
|
||||||
"$BUILD_DIR/" "$WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG"
|
"$BUILD_DIR/" "$WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG"
|
||||||
|
|
||||||
# Clear WordPress transients if WP-CLI is available
|
# Clear WordPress transients if WP-CLI is available
|
||||||
if command -v wp &> /dev/null; then
|
if command -v wp &>/dev/null; then
|
||||||
echo "Clearing WordPress transients..."
|
echo "Clearing WordPress transients..."
|
||||||
wp transient delete --all --path="$WP_LOCAL_PLUGIN_DIR/../.."
|
wp transient delete --all --path="$WP_LOCAL_PLUGIN_DIR/../.."
|
||||||
else
|
else
|
||||||
echo "⚠️ WP-CLI not found, skipping transient clearing"
|
echo "⚠️ WP-CLI not found, skipping transient clearing"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "✅ Local deployment successful!"
|
echo "✅ Local deployment successful!"
|
||||||
echo "Plugin deployed to: $WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG"
|
echo "Plugin deployed to: $WP_LOCAL_PLUGIN_DIR/$PLUGIN_SLUG"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "❌ Build failed: ZIP file was not created"
|
echo "❌ Build failed: ZIP file was not created"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<exclude-pattern>*/build/*</exclude-pattern>
|
<exclude-pattern>*/build/*</exclude-pattern>
|
||||||
<exclude-pattern>*/dist/*</exclude-pattern>
|
<exclude-pattern>*/dist/*</exclude-pattern>
|
||||||
|
|
||||||
<!-- Command line arguments -->
|
<!-- Command line arguments: combined short flags (-s shows sniff codes, -p shows progress) -->
|
||||||
<arg value="sp"/>
|
<arg value="sp"/>
|
||||||
<arg name="extensions" value="php"/>
|
<arg name="extensions" value="php"/>
|
||||||
<arg name="basepath" value="."/>
|
<arg name="basepath" value="."/>
|
||||||
|
|||||||
@@ -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
|
1. Copy the output from the code quality tool
|
||||||
2. Paste it into your AI assistant chat
|
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
|
4. Apply the suggested fixes
|
||||||
5. Commit the changes and verify that the issues are resolved
|
5. Commit the changes and verify that the issues are resolved
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user