Compare commits

..
Author SHA1 Message Date
marcus 445d022232 ^X
Release - Build and publish plugin releases / Build and Release (push) Canceled after 0s
git merge simplify-code-quality-tools --no-edit
Merge branch 'simplify-code-quality-tools'
2025-04-21 15:33:16 +01:00
marcus d3e5d0d0c0 Release version 0.1.11
- Updated version number to 0.1.11
- Added changelog entry for code quality improvements
- Updated readme.txt with new version and changelog
- Created release ZIP file
2025-04-21 15:23:39 +01:00
marcus 2481d63561 Merge pull request #13 from wpallstars/simplify-code-quality-tools
Add PHPStan and PHP Mess Detector for improved code quality
2025-04-21 15:19:38 +01:00
marcus cdc73bc010 Fix remaining code quality issues
- Fixed method names to use snake_case as required by WordPress coding standards
- Added proper spacing in filter_input function call
- Added periods at the end of inline comments
- Fixed parameter documentation in Plugin class
- Updated CSS media query to use context notation
2025-04-21 15:18:11 +01:00
marcus 67c6c65611 Fix camelCase naming and superglobal access issues
- Renamed methods to follow camelCase convention (initialize_hooks -> initializeHooks, enqueue_admin_assets -> enqueueAdminAssets)
- Renamed variables to follow camelCase convention (plugin_version -> pluginVersion)
- Replaced direct  superglobal access with filter_input() for better security
- Simplified commented-out code with a clear TODO comment
2025-04-21 15:14:15 +01:00
marcus ebdb172a14 Replace commented-out code with concise TODO note
- Removed large block of commented-out code
- Replaced with a concise TODO note about the implementation needed
2025-04-21 15:10:18 +01:00
marcus 57a4c98f46 Fix remaining code quality issues in Admin class
- Removed unused parameter  from enqueue_admin_assets method
- Added empty line before block comment
2025-04-21 15:07:39 +01:00
marcus 4c1bee9dbe Fix CSS and JavaScript formatting issues
- Updated stylelint configuration to fix CSS formatting issues
- Updated ESLint configuration to fix JavaScript issues
- Added global variables to ESLint configuration
2025-04-21 15:04:05 +01:00
marcus 200cc5671d Fix indentation issues in PHP files
- Fixed tabs vs spaces indentation issues in PHP files
- Updated phpcs.xml configuration
2025-04-21 15:01:09 +01:00
marcus 398d24ed90 Fix code quality issues
- Fix phpstan.neon file structure
- Fix Markdown formatting in docs/code-quality-setup.md
- Add proper language specifier to .env code block in README.md
- Add blank lines around code blocks in README.md
- Add newline at end of GitHub workflow file
2025-04-21 14:57:19 +01:00
marcus ad30d716db Fix code quality issues
- Update composer.lock file to match composer.json
- Fix Markdown formatting in README.md
- Fix phpcs.xml argument syntax
- Fix phpstan.neon excludePaths syntax
2025-04-21 14:50:21 +01:00
marcus 19ec65326b Fix code quality tools configuration and workflow
- Fix PHP CodeSniffer configuration to use WordPress coding standards
- Add WordPress stubs to PHPStan configuration
- Fix Codacy Analysis action by removing unsupported parameter
- Update SonarCloud action to use recommended sonarqube-scan-action
- Add comprehensive documentation for code quality tools
- Update composer scripts to use vendor binaries
2025-04-21 14:45:27 +01:00
marcus 3048e91a78 Fix code quality tools configuration and update documentation 2025-04-21 14:32:11 +01:00
marcus 3926927791 Fix PHP version compatibility issues with all dependencies 2025-04-21 05:10:34 +01:00
marcus 728c5dcf3d Fix PHP version compatibility issues with PHPStan and PHPMD 2025-04-21 05:08:23 +01:00
marcus 109c07cfed Update composer.lock with PHPStan and PHPMD dependencies 2025-04-21 05:06:02 +01:00
marcus ea628c521b Merge branch 'main' into simplify-code-quality-tools 2025-04-21 05:03:41 +01:00
marcus ae7bd5cb89 Merge main into simplify-code-quality-tools and add SonarCloud and Codacy jobs 2025-04-21 05:01:49 +01:00
marcus 1f4be45862 Merge pull request #12 from wpallstars/configure-code-quality-tools
Configure SonarCloud and Codacy with proper settings
2025-04-21 04:59:23 +01:00
marcus 78bd0708d3 Add PHPStan and PHP Mess Detector for improved code quality 2025-04-21 04:58:51 +01:00
marcus 36840c46c1 Configure SonarCloud and Codacy with proper settings 2025-04-21 04:48:12 +01:00
marcus aa62142e4c Merge pull request #11 from wpallstars/fix-code-quality-issues
Fix code quality issues from PR feedback
2025-04-21 04:45:41 +01:00
marcus 0ab1a1df4d Temporarily remove SonarCloud and Codacy jobs due to compatibility issues 2025-04-21 04:43:02 +01:00
marcus 69cd192f49 Fix SonarCloud configuration and fenced code blocks 2025-04-21 04:41:12 +01:00
marcus 4ebe55b940 Fix GitHub Actions references and add Markdown linting configuration 2025-04-21 04:34:05 +01:00
marcus 5b4037bf0d Merge pull request #10 from wpallstars/markdown-bullet-point-standardization
Markdown bullet point standardization
2025-04-21 04:28:32 +01:00
marcus fd314fd7c7 Merge pull request #9 from wpallstars/code-quality-improvements-ci-cd
Code quality improvements ci cd
2025-04-21 04:28:15 +01:00
marcus 546ed59a61 Fix code quality issues from PR feedback 2025-04-21 04:25:28 +01:00
marcus 069dc2e8d7 Merge pull request #8 from wpallstars/code-quality-documentation
Add documentation for code quality tools and standards
2025-04-21 04:15:31 +01:00
marcus 9d36b47f9f Standardize Markdown bullet points to use asterisks instead of hyphens 2025-04-21 04:12:51 +01:00
marcus 5cd2a7d374 Enhance CI/CD workflow with code quality checks and PHPCBF integration 2025-04-21 04:02:27 +01:00
marcus 497c44c3c6 Add documentation for code quality tools and standards 2025-04-21 03:58:18 +01:00
marcus e3f11ac03f Merge pull request #7 from wpallstars/sonarqube-quality-improvements
Fix SonarQube code quality issues to improve rating from B to A
2025-04-20 04:55:15 +01:00
marcus 04cdd49a3f Fix SonarQube code quality issues to improve rating from B to A 2025-04-20 04:54:13 +01:00
marcus cdd9b050c7 Updated SonarQube badges with more detailed metrics 2025-04-19 23:49:35 +01:00
marcus 6031751015 Merge v0.1.10 into main 2025-04-19 21:56:40 +01:00
33 changed files with 3125 additions and 391 deletions

No files matched your search

+88 -52
View File
@@ -6,50 +6,83 @@ This guide helps AI assistants understand the project structure, workflows, and
This workspace may contain multiple repository folders. Always focus ONLY on the current repository you're working in and avoid hallucinating functionality from other repositories in the workspace. This workspace may contain multiple repository folders. Always focus ONLY on the current repository you're working in and avoid hallucinating functionality from other repositories in the workspace.
- **Current Repository**: wp-plugin-starter-template-for-ai-coding * **Current Repository**: wp-plugin-starter-template-for-ai-coding
- **Repository Purpose**: A comprehensive starter template for WordPress plugins with best practices for AI-assisted development * **Repository Purpose**: A comprehensive starter template for WordPress plugins with best practices for AI-assisted development
- **Repository Scope**: All code changes, documentation, and functionality discussions should be limited to THIS repository only * **Repository Scope**: All code changes, documentation, and functionality discussions should be limited to THIS repository only
## Project Overview ## Project Overview
- **Plugin Name**: WordPress Plugin Starter Template * **Plugin Name**: WordPress Plugin Starter Template
- **Plugin Slug**: wp-plugin-starter-template * **Plugin Slug**: wp-plugin-starter-template
- **Text Domain**: wp-plugin-starter-template * **Text Domain**: wp-plugin-starter-template
- **Namespace**: WPALLSTARS\PluginStarterTemplate * **Namespace**: WPALLSTARS\PluginStarterTemplate
- **Version**: 0.1.1 * **Version**: 0.1.10
- **Requires WordPress**: 5.0+ * **Requires WordPress**: 5.0+
- **Requires PHP**: 7.0+ * **Requires PHP**: 7.0+
- **License**: GPL-2.0+ * **License**: GPL-2.0+
## Repository Structure ## Repository Structure
- **wp-plugin-starter-template.php**: Main plugin file with plugin headers * **wp-plugin-starter-template.php**: Main plugin file with plugin headers
- **includes/**: Core plugin functionality * **includes/**: Core plugin functionality
- **plugin.php**: Main plugin class that initializes everything * **plugin.php**: Main plugin class that initializes everything
- **core.php**: Core functionality class * **core.php**: Core functionality class
- **updater.php**: Update mechanism for multiple sources * **updater.php**: Update mechanism for multiple sources
- **admin/**: Admin-specific functionality * **admin/**: Admin-specific functionality
- **lib/**: Admin classes * **lib/**: Admin classes
- **css/**: Admin stylesheets * **css/**: Admin stylesheets
- **js/**: Admin JavaScript files * **js/**: Admin JavaScript files
- **languages/**: Translation files * **languages/**: Translation files
- **.github/workflows/**: GitHub Actions workflows * **.github/workflows/**: GitHub Actions workflows
- **.ai-workflows/**: Documentation for AI assistants * **.ai-workflows/**: Documentation for AI assistants
- **.wiki/**: Wiki documentation templates * **.wiki/**: Wiki documentation templates
## Coding Standards ## Coding Standards
This project follows the [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/): This project follows the [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/):
- Use tabs for indentation, not spaces * Use 4 spaces for indentation, not tabs (this is a project-specific override of WordPress standards)
- Follow WordPress naming conventions: * Follow WordPress naming conventions:
- Class names: `Class_Name` * Class names: `Class_Name`
- Function names: `function_name` * Function names: `function_name`
- Variable names: `$variable_name` * Variable names: `$variable_name`
- Use proper DocBlocks for all classes, methods, and functions * Use proper DocBlocks for all classes, methods, and functions
- Ensure all user-facing strings are translatable * Ensure all user-facing strings are translatable
- Validate and sanitize all inputs * Validate and sanitize all inputs
- Escape all outputs * Escape all outputs
* Use asterisks (*) for bullet points in all Markdown files, not hyphens (-)
### Code Quality Tools
This project uses several automated code quality tools to ensure high standards:
1. **PHP_CodeSniffer (PHPCS)**: Checks PHP code against the WordPress Coding Standards
```bash
composer run phpcs
```
2. **PHP Code Beautifier and Fixer (PHPCBF)**: Automatically fixes some coding standard violations
```bash
composer run phpcbf
```
3. **ESLint**: Checks JavaScript code against the WordPress Coding Standards
```bash
npm run lint:js
```
4. **Stylelint**: Checks CSS code against the WordPress Coding Standards
```bash
npm run lint:css
```
5. **Continuous Integration Tools**: The project integrates with several code quality tools:
* **CodeRabbit**: AI-powered code review tool
* **CodeFactor**: Continuous code quality monitoring
* **Codacy**: Code quality and static analysis
* **SonarCloud**: Code quality and security analysis
Always run PHPCS and PHPCBF locally before committing code to ensure it meets the project's coding standards.
## Common Tasks ## Common Tasks
@@ -71,15 +104,17 @@ When working in a multi-repository workspace, follow these guidelines to avoid c
6. **Verify Before Implementation**: Before implementing or documenting a feature, verify that it actually exists in the current repository by checking the codebase. 6. **Verify Before Implementation**: Before implementing or documenting a feature, verify that it actually exists in the current repository by checking the codebase.
7. **Consistent Markdown Formatting**: Always use asterisks (*) for bullet points in Markdown files, not hyphens (-).
## Internationalization (i18n) ## Internationalization (i18n)
All user-facing strings should be translatable: All user-facing strings should be translatable:
- Use `__()` for simple strings * Use `__()` for simple strings
- Use `_e()` for echoed strings * Use `_e()` for echoed strings
- Use `esc_html__()` for escaped strings * Use `esc_html__()` for escaped strings
- Use `esc_html_e()` for escaped and echoed strings * Use `esc_html_e()` for escaped and echoed strings
- Always use the plugin's text domain: `wp-plugin-starter-template` * Always use the plugin's text domain: `wp-plugin-starter-template`
Example: Example:
```php ```php
@@ -88,26 +123,27 @@ echo esc_html__('This is a translatable string', 'wp-plugin-starter-template');
## Security Best Practices ## Security Best Practices
- Validate and sanitize all inputs * Validate and sanitize all inputs
- Escape all outputs * Escape all outputs
- Use nonces for form submissions * Use nonces for form submissions
- Use capability checks for user actions * Use capability checks for user actions
- Follow the principle of least privilege * Follow the principle of least privilege
## Documentation ## Documentation
- Keep code comments up-to-date * Keep code comments up-to-date
- Update README.md and readme.txt when adding new features * Update README.md and readme.txt when adding new features
- Update wiki documentation in the `.wiki/` directory * Update wiki documentation in the `.wiki/` directory
- Update changelog in both CHANGELOG.md and readme.txt * Update changelog in both CHANGELOG.md and readme.txt
* Use asterisks (*) for bullet points in all Markdown files
## Git Workflow ## Git Workflow
- Create feature branches from `main` * Create feature branches from `main`
- Use descriptive branch names (e.g., `feature/add-settings-page`) * Use descriptive branch names (e.g., `feature/add-settings-page`)
- Make atomic commits with clear messages * Make atomic commits with clear messages
- Create pull requests for review * Create pull requests for review
- Tag releases with version numbers (e.g., `v1.0.0`) * Tag releases with version numbers (e.g., `v1.0.0`)
## Developer Preferences ## Developer Preferences
+137 -65
View File
@@ -1,6 +1,6 @@
# Code Review Guide for AI Assistants # Code Review Guide for AI Assistants
This document provides guidance for AI assistants to help with code review for the Fix Plugin Does Not Exist Notices plugin. This document provides guidance for AI assistants to help with code review for this project.
## Code Review Checklist ## Code Review Checklist
@@ -8,54 +8,126 @@ When reviewing code, check for the following:
### Functionality ### Functionality
- [ ] Does the code work as expected? * [ ] Does the code work as expected?
- [ ] Does it handle edge cases appropriately? * [ ] Does it handle edge cases appropriately?
- [ ] Are there any logical errors? * [ ] Are there any logical errors?
- [ ] Is error handling implemented properly? * [ ] Is error handling implemented properly?
### Code Quality ### Code Quality
- [ ] Does the code follow WordPress coding standards? * [ ] Does the code follow WordPress coding standards?
- [ ] Is the code well-organized and easy to understand? * [ ] Is the code well-organized and easy to understand?
- [ ] Are there any code smells (duplicate code, overly complex functions, etc.)? * [ ] Are there any code smells (duplicate code, overly complex functions, etc.)?
- [ ] Are functions and variables named appropriately? * [ ] Are functions and variables named appropriately?
- [ ] Are there appropriate comments and documentation? * [ ] Are there appropriate comments and documentation?
### Security ### Security
- [ ] Is user input properly validated and sanitized? * [ ] Is user input properly validated and sanitized?
- [ ] Is output properly escaped? * [ ] Is output properly escaped?
- [ ] Are capability checks used for user actions? * [ ] Are capability checks used for user actions?
- [ ] Are nonces used for form submissions? * [ ] Are nonces used for form submissions?
- [ ] Are there any potential SQL injection vulnerabilities? * [ ] Are there any potential SQL injection vulnerabilities?
- [ ] Are there any potential XSS vulnerabilities? * [ ] Are there any potential XSS vulnerabilities?
### Performance ### Performance
- [ ] Are there any performance bottlenecks? * [ ] Are there any performance bottlenecks?
- [ ] Are database queries optimized? * [ ] Are database queries optimized?
- [ ] Is caching used appropriately? * [ ] Is caching used appropriately?
- [ ] Are assets (CSS, JS) properly enqueued? * [ ] Are assets (CSS, JS) properly enqueued?
### Compatibility ### Compatibility
- [ ] Is the code compatible with the minimum supported WordPress version (5.0)? * [ ] Is the code compatible with the minimum supported WordPress version (5.0)?
- [ ] Is the code compatible with the minimum supported PHP version (7.0)? * [ ] Is the code compatible with the minimum supported PHP version (7.0)?
- [ ] Are there any browser compatibility issues? * [ ] Are there any browser compatibility issues?
- [ ] Are there any conflicts with other plugins? * [ ] Are there any conflicts with other plugins?
### Internationalization ### Internationalization
- [ ] Are all user-facing strings translatable? * [ ] Are all user-facing strings translatable?
- [ ] Is the correct text domain used? * [ ] Is the correct text domain used?
- [ ] Are translation functions used correctly? * [ ] Are translation functions used correctly?
### Accessibility ### Accessibility
- [ ] Does the code follow accessibility best practices? * [ ] Does the code follow accessibility best practices?
- [ ] Are ARIA attributes used appropriately? * [ ] Are ARIA attributes used appropriately?
- [ ] Is keyboard navigation supported? * [ ] Is keyboard navigation supported?
- [ ] Is screen reader support implemented? * [ ] Is screen reader support implemented?
## Automated Code Review Tools
This project uses several automated code review tools to maintain high code quality standards. These tools are free to use for public repositories and should be integrated into any new repositories based on this template.
### 1. CodeRabbit
[CodeRabbit](https://www.coderabbit.ai/) is an AI-powered code review tool that provides automated feedback on pull requests.
* **Integration**: Add the CodeRabbit GitHub App to your repository
* **Benefits**: Provides AI-powered code reviews, identifies potential issues, and suggests improvements
* **Usage**: CodeRabbit automatically reviews pull requests when they are created or updated
### 2. CodeFactor
[CodeFactor](https://www.codefactor.io/) continuously monitors code quality and provides feedback on code style, complexity, and potential issues.
* **Integration**: Add the CodeFactor GitHub App to your repository
* **Benefits**: Provides a grade for your codebase, identifies issues, and tracks code quality over time
* **Usage**: CodeFactor automatically analyzes your codebase and provides feedback on pull requests
### 3. Codacy
[Codacy](https://www.codacy.com/) is a code quality tool that provides static analysis, code coverage, and code duplication detection.
* **Integration**: Add the Codacy GitHub App to your repository
* **Benefits**: Provides a grade for your codebase, identifies issues, and tracks code quality over time
* **Usage**: Codacy automatically analyzes your codebase and provides feedback on pull requests
### 4. PHPStan
[PHPStan](https://phpstan.org/) is a static analysis tool that finds errors in your code without running it.
* **Integration**: Included in the project's composer.json and GitHub Actions workflow
* **Benefits**: Detects undefined variables, methods, and properties; type-related issues; and logical errors
* **Usage**: Run `composer phpstan` or `npm run lint:phpstan` locally, or let GitHub Actions run it automatically
### 5. PHP Mess Detector
[PHP Mess Detector](https://phpmd.org/) is a tool that looks for potential problems in your code such as possible bugs, suboptimal code, overcomplicated expressions, and unused parameters, variables, and methods.
* **Integration**: Included in the project's composer.json and GitHub Actions workflow
* **Benefits**: Identifies code smells, complexity issues, unused code, naming problems, and more
* **Usage**: Run `composer phpmd` or `npm run lint:phpmd` locally, or let GitHub Actions run it automatically
### Using AI Assistants with Code Review Tools
When you receive feedback from these code review tools, you can use AI assistants to help address the issues:
1. Copy the output from the code review tool
2. Paste it into your AI assistant chat
3. Ask the AI to help you understand and resolve the issues
4. Apply the suggested fixes
5. Commit the changes and verify that the issues are resolved
### Markdown Formatting Standards
When writing or updating Markdown files in this project, follow these standards:
* Always use asterisks (*) for bullet points, not hyphens (-)
* Use proper heading hierarchy (# for main title, ## for sections, etc.)
* Use code blocks with language specification for code examples
* Use relative links for internal documentation
* Include alt text for images
Example prompt for AI assistants:
```text
I received the following feedback from [Tool Name]. Please help me understand and resolve these issues:
[Paste the tool output here]
```
## Code Review Process ## Code Review Process
@@ -63,9 +135,9 @@ When reviewing code, check for the following:
Before reviewing code, understand: Before reviewing code, understand:
- What problem is the code trying to solve? * What problem is the code trying to solve?
- What are the requirements? * What are the requirements?
- What are the constraints? * What are the constraints?
### 2. Review the Code ### 2. Review the Code
@@ -75,60 +147,60 @@ Review the code with the checklist above in mind.
When providing feedback: When providing feedback:
- Be specific and clear * Be specific and clear
- Explain why a change is needed * Explain why a change is needed
- Provide examples or suggestions when possible * Provide examples or suggestions when possible
- Prioritize feedback (critical issues vs. minor improvements) * Prioritize feedback (critical issues vs. minor improvements)
- Be constructive and respectful * Be constructive and respectful
### 4. Follow Up ### 4. Follow Up
After the code has been updated: After the code has been updated:
- Review the changes * Review the changes
- Verify that issues have been addressed * Verify that issues have been addressed
- Provide additional feedback if necessary * Provide additional feedback if necessary
## Common Issues to Look For ## Common Issues to Look For
### PHP Issues ### PHP Issues
- Undefined variables or functions * Undefined variables or functions
- Incorrect function parameters * Incorrect function parameters
- Missing return statements * Missing return statements
- Improper error handling * Improper error handling
- Inefficient loops or conditionals * Inefficient loops or conditionals
- Hardcoded values that should be configurable * Hardcoded values that should be configurable
### WordPress-Specific Issues ### WordPress-Specific Issues
- Incorrect hook usage * Incorrect hook usage
- Missing or incorrect nonces * Missing or incorrect nonces
- Missing capability checks * Missing capability checks
- Direct database queries instead of using WordPress functions * Direct database queries instead of using WordPress functions
- Improper enqueuing of scripts and styles * Improper enqueuing of scripts and styles
- Not using WordPress functions for common tasks * Not using WordPress functions for common tasks
### JavaScript Issues ### JavaScript Issues
- Undefined variables or functions * Undefined variables or functions
- Event listener memory leaks * Event listener memory leaks
- jQuery conflicts * jQuery conflicts
- Browser compatibility issues * Browser compatibility issues
- Missing error handling * Missing error handling
### CSS Issues ### CSS Issues
- Browser compatibility issues * Browser compatibility issues
- Specificity issues * Specificity issues
- Unused styles * Unused styles
- Overriding WordPress admin styles inappropriately * Overriding WordPress admin styles inappropriately
## Example Feedback ## Example Feedback
### Good Feedback Example ### Good Feedback Example
``` ```markdown
In function `handle_remove_reference()`: In function `handle_remove_reference()`:
1. The nonce check is missing, which could lead to CSRF vulnerabilities. 1. The nonce check is missing, which could lead to CSRF vulnerabilities.
@@ -161,6 +233,6 @@ In function `handle_remove_reference()`:
### Poor Feedback Example ### Poor Feedback Example
``` ```text
This code has security issues and doesn't follow best practices. Fix it. This code has security issues and doesn't follow best practices. Fix it.
``` ```
+61
View File
@@ -0,0 +1,61 @@
---
engines:
markdownlint:
enabled: true
config_file: .markdownlint.json
phpmd:
enabled: true
phpcs:
enabled: true
stylelint:
enabled: false
shellcheck:
enabled: false
# Disable tools that are causing issues
eslint:
enabled: false
eslint-8:
enabled: false
eslint-9:
enabled: false
trivy:
enabled: false
semgrep:
enabled: false
checkov:
enabled: false
pmd:
enabled: false
pmd-7:
enabled: false
lizard:
enabled: false
jshint:
enabled: false
csslint:
enabled: false
jacksonlinter:
enabled: false
spectral:
enabled: false
duplication:
enabled: true
exclude_patterns:
- "tests/**"
- "vendor/**"
- "node_modules/**"
metrics:
enabled: true
exclude_paths:
- "vendor/**"
- "node_modules/**"
- "build/**"
- "dist/**"
- "bin/**"
- ".github/**"
- "tests/**"
- "*.lock"
- "*.json"
+30
View File
@@ -0,0 +1,30 @@
{
"env": {
"browser": true,
"jquery": true,
"es6": true
},
"extends": "eslint:recommended",
"globals": {
"wp": "readonly",
"wpstData": "readonly",
"wpstModalData": "readonly",
"Cypress": "readonly",
"cy": "readonly",
"describe": "readonly",
"it": "readonly",
"before": "readonly",
"module": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "single"],
"semi": ["error", "always"]
},
"ignorePatterns": ["vendor/**", "node_modules/**", "build/**", "dist/**", "bin/**"]
}
+152
View File
@@ -0,0 +1,152 @@
name: Code Quality
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
phpcs:
name: PHP CodeSniffer
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
clean: 'true'
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl, zip
tools: composer:v2
- name: Install dependencies
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
run: composer phpcs
continue-on-error: true
- name: Run PHPCBF (report only)
run: |
echo "Running PHPCBF in dry-run mode to show what would be fixed"
composer phpcbf -- --dry-run
continue-on-error: true
phpstan:
name: PHPStan Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl, zip
tools: composer:v2, phpstan
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Install PHPStan WordPress stubs
run: composer require --dev szepeviktor/phpstan-wordpress
- name: Run PHPStan
run: composer phpstan
continue-on-error: true
phpmd:
name: PHP Mess Detector
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: mbstring, intl, zip
tools: composer:v2, phpmd
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run PHPMD
run: composer phpmd
continue-on-error: true
sonarcloud:
name: SonarCloud Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectKey=wpallstars_wp-plugin-starter-template-for-ai-coding
-Dsonar.organization=wpallstars
-Dsonar.sources=.
-Dsonar.exclusions=vendor/**,node_modules/**,tests/**,bin/**,build/**,dist/**
-Dsonar.sourceEncoding=UTF-8
continue-on-error: true
codacy:
name: Codacy Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@v4.3.0
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
verbose: true
output: results.sarif
format: sarif
# Limit the number of issues to prevent GitHub Code Scanning rejection
gh-code-scanning-compat: true
max-allowed-issues: 20
# Limit tools to prevent timeouts and stay under GitHub's 20 runs limit
tool: phpcs,phpmd,markdownlint
continue-on-error: true
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
continue-on-error: true
+9 -2
View File
@@ -63,5 +63,12 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: composer install --prefer-dist --no-progress run: composer install --prefer-dist --no-progress
# - name: Run PHPCS - name: Run PHPCS
# run: ./vendor/bin/phpcs --standard=WordPress ./includes ./admin ./wp-plugin-starter-template.php run: composer run phpcs
continue-on-error: true
- name: Run PHPCBF (report only)
run: |
echo "Running PHPCBF in dry-run mode to show what would be fixed"
composer run phpcbf -- --dry-run
continue-on-error: true
+16
View File
@@ -0,0 +1,16 @@
{
"default": true,
"MD004": {
"style": "asterisk"
},
"MD007": {
"indent": 2
},
"MD013": false,
"MD033": false,
"MD040": true,
"MD041": false,
"MD046": {
"style": "fenced"
}
}
+16
View File
@@ -0,0 +1,16 @@
{
"default": true,
"MD004": {
"style": "asterisk"
},
"MD007": {
"indent": 2
},
"MD013": false,
"MD033": false,
"MD040": true,
"MD041": false,
"MD046": {
"style": "fenced"
}
}
+16
View File
@@ -0,0 +1,16 @@
{
"extends": "stylelint-config-standard",
"rules": {
"alpha-value-notation": "percentage",
"color-function-notation": "modern",
"font-weight-notation": "numeric",
"media-feature-range-notation": "context"
},
"ignoreFiles": [
"vendor/**",
"node_modules/**",
"build/**",
"dist/**",
"bin/**"
]
}
+95 -32
View File
@@ -8,40 +8,40 @@ This plugin follows the [WordPress Coding Standards](https://developer.wordpress
### File Structure ### File Structure
- Each PHP file should begin with the PHP opening tag `<?php` (no closing tag) * Each PHP file should begin with the PHP opening tag `<?php` (no closing tag)
- Files should use the Unix line endings (LF) * Files should use the Unix line endings (LF)
- Files should be encoded in UTF-8 without BOM * Files should be encoded in UTF-8 without BOM
### Naming Conventions ### Naming Conventions
- **Classes**: Use `PascalCase` for class names * **Classes**: Use `PascalCase` for class names
```php ```php
class MyClassName {} class MyClassName {}
``` ```
- **Methods and Functions**: Use `snake_case` for method and function names * **Methods and Functions**: Use `snake_case` for method and function names
```php ```php
function my_function_name() {} function my_function_name() {}
public function my_method_name() {} public function my_method_name() {}
``` ```
- **Variables**: Use `snake_case` for variable names * **Variables**: Use `snake_case` for variable names
```php ```php
$my_variable_name = 'value'; $my_variable_name = 'value';
``` ```
- **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants * **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
```php ```php
define('MY_CONSTANT', 'value'); define('MY_CONSTANT', 'value');
const MY_CLASS_CONSTANT = 'value'; const MY_CLASS_CONSTANT = 'value';
``` ```
- **Namespaces**: Use `PascalCase` for namespace segments * **Namespaces**: Use `PascalCase` for namespace segments
```php ```php
namespace WPALLSTARS\PluginStarterTemplate; namespace WPALLSTARS\PluginStarterTemplate;
``` ```
- **Hooks**: Prefix hooks with the plugin's prefix * **Hooks**: Prefix hooks with the plugin's prefix
```php ```php
do_action('wpst_hook_name'); do_action('wpst_hook_name');
apply_filters('wpst_filter_name', $value); apply_filters('wpst_filter_name', $value);
@@ -49,10 +49,10 @@ This plugin follows the [WordPress Coding Standards](https://developer.wordpress
### Indentation and Formatting ### Indentation and Formatting
- Use 4 spaces for indentation (not tabs) * Use 4 spaces for indentation (not tabs)
- Opening braces for classes and functions should be on the same line * Opening braces for classes and functions should be on the same line
- Control structures should have one space between the statement and the opening parenthesis * Control structures should have one space between the statement and the opening parenthesis
- Each line should be no longer than 100 characters * Each line should be no longer than 100 characters
```php ```php
if ($condition) { if ($condition) {
@@ -66,8 +66,8 @@ 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 a description, parameters, return values, and exceptions
```php ```php
/** /**
@@ -87,9 +87,9 @@ function my_function($param1, $param2) {
### Object-Oriented Programming ### Object-Oriented Programming
- Each class should have a single responsibility * Each class should have a single responsibility
- Use visibility declarations for all properties and methods (public, protected, private) * Use visibility declarations for all properties and methods (public, protected, private)
- Use type hints for parameters and return types when possible * Use type hints for parameters and return types when possible
```php ```php
class MyClass { class MyClass {
@@ -118,22 +118,22 @@ This plugin follows the [WordPress JavaScript Coding Standards](https://develope
### Naming Conventions ### Naming Conventions
- **Variables and Functions**: Use `camelCase` for variable and function names * **Variables and Functions**: Use `camelCase` for variable and function names
```javascript ```javascript
var myVariableName = 'value'; var myVariableName = 'value';
function myFunctionName() {} function myFunctionName() {}
``` ```
- **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants * **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
```javascript ```javascript
var MY_CONSTANT = 'value'; var MY_CONSTANT = 'value';
``` ```
### Indentation and Formatting ### Indentation and Formatting
- Use 4 spaces for indentation (not tabs) * Use 4 spaces for indentation (not tabs)
- Opening braces should be on the same line as the statement * Opening braces should be on the same line as the statement
- Each line should be no longer than 100 characters * Each line should be no longer than 100 characters
```javascript ```javascript
if (condition) { if (condition) {
@@ -147,7 +147,7 @@ if (condition) {
### Documentation ### Documentation
- Use JSDoc for documenting functions and objects * Use JSDoc for documenting functions and objects
```javascript ```javascript
/** /**
@@ -168,9 +168,9 @@ This plugin follows the [WordPress CSS Coding Standards](https://developer.wordp
### Naming Conventions ### Naming Conventions
- Use lowercase for selectors * Use lowercase for selectors
- Use hyphens to separate words in class and ID names * Use hyphens to separate words in class and ID names
- Prefix classes and IDs with the plugin's prefix * Prefix classes and IDs with the plugin's prefix
```css ```css
.wpst-container { .wpst-container {
@@ -184,11 +184,11 @@ This plugin follows the [WordPress CSS Coding Standards](https://developer.wordp
### Indentation and Formatting ### Indentation and Formatting
- Use 4 spaces for indentation (not tabs) * Use 4 spaces for indentation (not tabs)
- Each property should be on its own line * Each property should be on its own line
- Include a space after the colon in property declarations * Include a space after the colon in property declarations
- End each declaration with a semicolon * End each declaration with a semicolon
- Use single quotes for attribute selectors and property values * Use single quotes for attribute selectors and property values
```css ```css
.wpst-container { .wpst-container {
@@ -202,6 +202,8 @@ This plugin follows the [WordPress CSS Coding Standards](https://developer.wordp
This plugin uses automated tools to enforce coding standards: This plugin uses automated tools to enforce coding standards:
### Local Development Tools
1. **PHP_CodeSniffer (PHPCS)**: Checks PHP code against the WordPress Coding Standards 1. **PHP_CodeSniffer (PHPCS)**: Checks PHP code against the WordPress Coding Standards
```bash ```bash
composer run phpcs composer run phpcs
@@ -222,6 +224,67 @@ This plugin uses automated tools to enforce coding standards:
npm run lint:css npm run lint:css
``` ```
### Continuous Integration Tools
This project integrates with several code quality tools that automatically analyze your code when you create a pull request. These tools are free for public repositories and should be integrated into any new repositories based on this template.
1. **CodeRabbit**: AI-powered code review tool
* Provides automated feedback on pull requests
* Identifies potential issues and suggests improvements
* [Website](https://www.coderabbit.ai/)
2. **CodeFactor**: Continuous code quality monitoring
* Provides a grade for your codebase
* Identifies issues related to code style, complexity, and potential bugs
* Tracks code quality over time
* [Website](https://www.codefactor.io/)
3. **Codacy**: Code quality and static analysis
* Provides a grade for your codebase
* Identifies issues related to code style, security, and performance
* Tracks code quality over time
* [Website](https://www.codacy.com/)
4. **SonarCloud**: Code quality and security analysis
* Provides detailed analysis of code quality
* Identifies security vulnerabilities and technical debt
* Tracks code quality over time
* [Website](https://sonarcloud.io/)
### How to Pass Code Quality Checks
To ensure your code passes the quality checks from these tools, follow these guidelines:
1. **Run Local Checks First**
* Before pushing your code, run PHPCS and PHPCBF locally
* Fix any issues identified by these tools
2. **Address Common Issues**
* **Indentation**: Use 4 spaces for indentation (not tabs)
* **Line Length**: Keep lines under 100 characters
* **Naming Conventions**: Follow WordPress naming conventions
* **Documentation**: Add PHPDoc comments to classes, methods, and functions
* **Error Handling**: Implement proper error handling
* **Security**: Validate and sanitize input, escape output
* **Markdown**: Use asterisks (*) for bullet points, not hyphens (-)
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
* Example prompt:
```text
I received the following feedback from [Tool Name]. Please help me understand and resolve these issues:
[Paste the tool output here]
```
4. **Iterative Improvement**
* Address issues one at a time, starting with the most critical
* Commit and push your changes to see if they resolve the issues
* Continue this process until all issues are resolved
## Conclusion ## Conclusion
Following these coding standards ensures that the plugin's code is consistent, readable, and maintainable. All contributors should adhere to these standards when submitting code to the project. Following these coding standards ensures that the plugin's code is consistent, readable, and maintainable. All contributors should adhere to these standards when submitting code to the project.
+62 -12
View File
@@ -78,6 +78,45 @@ If you want to contribute code:
- 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)
#### 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
2. **CodeFactor**: Continuous code quality monitoring
- [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
4. **SonarCloud**: Code quality and security analysis
- [Website](https://sonarcloud.io/)
- Provides detailed analysis of code quality and security
#### Using AI Assistants with Code Quality Tools
When you receive feedback from these code quality tools, you can use AI assistants to help address the issues:
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
4. Apply the suggested fixes
5. Commit the changes and verify that the issues are resolved
Example prompt for AI assistants:
```text
I received the following feedback from [Tool Name]. Please help me understand and resolve these issues:
[Paste the tool output here]
```
## Development Environment ## Development Environment
@@ -91,33 +130,44 @@ To set up your development environment:
Before submitting a pull request, make sure to run the tests: Before submitting a pull request, make sure to run the tests:
- PHP Unit Tests: `npm run test:php` * PHP Unit Tests: `npm run test:php`
- End-to-End Tests: `npm run test:e2e` * End-to-End Tests: `npm run test:e2e`
- Coding Standards: `npm run lint:php` * Coding Standards: `npm run lint:php`
#### Code Quality Checks
To ensure your code meets the quality standards, run these commands before submitting a pull request:
* Check coding standards: `composer run phpcs`
* Fix coding standards automatically: `composer run phpcbf`
* 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.
## Documentation ## Documentation
If you're adding a new feature or changing existing functionality, please update the documentation: If you're adding a new feature or changing existing functionality, please update the documentation:
- Update the README.md file if necessary * Update the README.md file if necessary
- Update the readme.txt file if necessary * Update the readme.txt file if necessary
- Update or create wiki pages as needed * Update or create wiki pages as needed
- Update code comments * Update code comments
## Community ## Community
Join our community to discuss the project: Join our community to discuss the project:
- [GitHub Discussions](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/discussions) * [GitHub Discussions](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/discussions)
- [Gitea Issues](https://gitea.wpallstars.com/wpallstars/wp-plugin-starter-template-for-ai-coding/issues) * [Gitea Issues](https://gitea.wpallstars.com/wpallstars/wp-plugin-starter-template-for-ai-coding/issues)
## Recognition ## Recognition
Contributors will be recognized in the following ways: Contributors will be recognized in the following ways:
- Added to the contributors list in readme.txt * Added to the contributors list in readme.txt
- Mentioned in release notes for significant contributions * Mentioned in release notes for significant contributions
- Thanked in the Changelog for specific contributions * Thanked in the Changelog for specific contributions
## License ## License
+12
View File
@@ -1,5 +1,17 @@
All notable changes to this project should be documented both here and in the main Readme files. All notable changes to this project should be documented both here and in the main Readme files.
#### [0.1.11] - 2023-04-21
#### Improved
- Improved code quality with comprehensive fixes
- Fixed indentation issues in PHP files
- Updated CSS formatting with modern notation
- Fixed JavaScript issues with proper global variables
- Improved security by using filter_input() instead of direct superglobal access
- Standardized naming conventions across the codebase
- Fixed documentation and comments for better clarity
#### [0.1.10] - 2025-04-20 #### [0.1.10] - 2025-04-20
#### Fixed #### Fixed
+200 -1
View File
@@ -1,6 +1,6 @@
# WordPress Plugin Starter Template for AI Coding # WordPress Plugin Starter Template for AI Coding
[![License](https://img.shields.io/badge/license-GPL--2.0%2B-blue.svg)](https://www.gnu.org/licenses/gpl-2.0.html) [![Build Status](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/actions/workflows/tests.yml/badge.svg)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/actions/workflows/tests.yml) [![Requires PHP](https://img.shields.io/badge/php-%3E%3D%207.4-blue.svg)](https://wordpress.org/about/requirements/) [![Requires WordPress](https://img.shields.io/badge/WordPress-%3E%3D%205.0-blue.svg)](https://wordpress.org/about/requirements/) [![Tested up to](https://img.shields.io/wordpress/plugin/tested/your-plugin-slug.svg)](https://wordpress.org/plugins/your-plugin-slug/) [![WordPress rating](https://img.shields.io/wordpress/plugin/r/your-plugin-slug.svg)](https://wordpress.org/plugins/your-plugin-slug/reviews/) [![WordPress downloads](https://img.shields.io/wordpress/plugin/dt/your-plugin-slug.svg)](https://wordpress.org/plugins/your-plugin-slug/) [![Latest Release](https://img.shields.io/github/v/release/wpallstars/wp-plugin-starter-template-for-ai-coding)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/releases) [![GitHub issues](https://img.shields.io/github/issues/wpallstars/wp-plugin-starter-template-for-ai-coding)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/issues) [![GitHub contributors](https://img.shields.io/github/contributors/wpallstars/wp-plugin-starter-template-for-ai-coding)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/graphs/contributors) [![Wiki](https://img.shields.io/badge/documentation-wiki-blue.svg)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/wiki) ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/wpallstars/wp-plugin-starter-template-for-ai-coding?utm_source=oss&utm_medium=github&utm_campaign=wpallstars%2Fwp-plugin-starter-template-for-ai-coding&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews) [![CodeFactor](https://www.codefactor.io/repository/github/wpallstars/wp-plugin-starter-template-for-ai-coding/badge)](https://www.codefactor.io/repository/github/wpallstars/wp-plugin-starter-template-for-ai-coding) [![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-highlight.svg)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/905754fd010b481490b496fb800e6144)](https://app.codacy.com/gh/wpallstars/wp-plugin-starter-template-for-ai-coding/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![License](https://img.shields.io/badge/license-GPL--2.0%2B-blue.svg)](https://www.gnu.org/licenses/gpl-2.0.html) [![Build Status](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/actions/workflows/tests.yml/badge.svg)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/actions/workflows/tests.yml) [![Requires PHP](https://img.shields.io/badge/php-%3E%3D%207.4-blue.svg)](https://wordpress.org/about/requirements/) [![Requires WordPress](https://img.shields.io/badge/WordPress-%3E%3D%205.0-blue.svg)](https://wordpress.org/about/requirements/) [![Tested up to](https://img.shields.io/wordpress/plugin/tested/your-plugin-slug.svg)](https://wordpress.org/plugins/your-plugin-slug/) [![WordPress rating](https://img.shields.io/wordpress/plugin/r/your-plugin-slug.svg)](https://wordpress.org/plugins/your-plugin-slug/reviews/) [![WordPress downloads](https://img.shields.io/wordpress/plugin/dt/your-plugin-slug.svg)](https://wordpress.org/plugins/your-plugin-slug/) [![Latest Release](https://img.shields.io/github/v/release/wpallstars/wp-plugin-starter-template-for-ai-coding)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/releases) [![GitHub issues](https://img.shields.io/github/issues/wpallstars/wp-plugin-starter-template-for-ai-coding)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/issues) [![GitHub contributors](https://img.shields.io/github/contributors/wpallstars/wp-plugin-starter-template-for-ai-coding)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/graphs/contributors) [![Wiki](https://img.shields.io/badge/documentation-wiki-blue.svg)](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/wiki) ![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/wpallstars/wp-plugin-starter-template-for-ai-coding?utm_source=oss&utm_medium=github&utm_campaign=wpallstars%2Fwp-plugin-starter-template-for-ai-coding&labelColor=171717&color=FF570A&link=https%3A%2F%2Fcoderabbit.ai&label=CodeRabbit+Reviews) [![CodeFactor](https://www.codefactor.io/repository/github/wpallstars/wp-plugin-starter-template-for-ai-coding/badge)](https://www.codefactor.io/repository/github/wpallstars/wp-plugin-starter-template-for-ai-coding) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=bugs)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=coverage)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=wpallstars_wp-plugin-starter-template-for-ai-coding&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=wpallstars_wp-plugin-starter-template-for-ai-coding) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/905754fd010b481490b496fb800e6144)](https://app.codacy.com/gh/wpallstars/wp-plugin-starter-template-for-ai-coding/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
A comprehensive starter template for WordPress plugins with best practices for AI-assisted development. A comprehensive starter template for WordPress plugins with best practices for AI-assisted development.
@@ -235,6 +235,205 @@ Contributions are welcome! Please feel free to submit a Pull Request.
4. Push to the branch: `git push origin feature/amazing-feature` 4. Push to the branch: `git push origin feature/amazing-feature`
5. Submit a pull request 5. Submit a pull request
For more detailed information, see the [Contributing Guide](.wiki/Contributing.md).
### Code Quality Tools
This project uses several automated code quality tools to ensure high standards. These tools are free for public repositories and should be integrated into any new repositories based on this template:
1. **CodeRabbit**: AI-powered code review tool
* [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
3. **Codacy**: Code quality and static analysis
* [Website](https://www.codacy.com/)
* Identifies issues related to code style, security, and performance
* Requires a `CODACY_PROJECT_TOKEN` secret in your GitHub repository settings
* To set up Codacy:
1. Go to [Codacy](https://www.codacy.com/) and sign in with your GitHub account
2. Add your repository to Codacy
3. Go to your project settings > Integrations > Project API
4. Generate a project API token
5. Add the token as a secret named `CODACY_PROJECT_TOKEN` in your GitHub repository settings
6. Note: Codacy tokens are project-specific, so they need to be added at the repository level. However, you can use GitHub Actions to securely pass these tokens between repositories if needed.
4. **SonarCloud**: Code quality and security analysis
* [Website](https://sonarcloud.io/)
* Provides detailed analysis of code quality and security
* Requires a `SONAR_TOKEN` secret in your GitHub repository settings
* To set up SonarCloud:
1. Go to [SonarCloud](https://sonarcloud.io/) and sign in with your GitHub account
2. Create a new organization or use an existing one
3. Add your repository to SonarCloud
4. Generate a token in SonarCloud (Account > Security > Tokens)
5. Add the token as a secret named `SONAR_TOKEN` in your GitHub repository or organization settings (see "GitHub Secrets Management" section below)
5. **PHP_CodeSniffer (PHPCS)**: PHP code style checker
* Enforces WordPress Coding Standards
* Automatically runs in GitHub Actions workflow
* Run locally with `composer phpcs`
6. **PHP Code Beautifier and Fixer (PHPCBF)**: Automatically fixes coding standard violations
* Run locally with `composer phpcbf`
7. **PHPStan**: PHP static analysis tool
* Detects bugs and errors without running the code
* Run locally with `composer phpstan`
8. **PHP Mess Detector (PHPMD)**: Analyzes code for potential problems
* Identifies complex code, unused parameters, etc.
* Run locally with `composer phpmd`
For detailed setup instructions, see the [Code Quality Setup Guide](docs/code-quality-setup.md).
### Using AI Assistants with Code Quality Tools
When you receive feedback from these code quality tools, you can use AI assistants to help address the issues:
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
4. Apply the suggested fixes
5. Commit the changes and verify that the issues are resolved
For more information on coding standards and how to pass code quality checks, see the [Coding Standards Guide](.wiki/Coding-Standards.md).
### GitHub Secrets Management
GitHub offers three levels of secrets management, each with different scopes and use cases:
1. **Organization Secrets** (recommended for teams and organizations):
* Available at: GitHub Organization > Settings > Secrets and variables > Actions
* Scope: Can be shared across multiple repositories within the organization
* Benefits: Centralized management, reduced duplication, easier rotation
* Recommended for: `SONAR_TOKEN` and other tokens that apply to multiple repositories
* Note: You can restrict which repositories can access organization secrets
* Note: Codacy tokens (`CODACY_PROJECT_TOKEN`) are project-specific and should be set at the repository level
2. **Repository Secrets**:
* Available at: Repository > Settings > Secrets and variables > Actions
* Scope: Limited to a single repository
* Benefits: Repository-specific, higher isolation
* Recommended for: `CODACY_PROJECT_TOKEN` and other repository-specific credentials or tokens that shouldn't be shared
3. **Environment Secrets**:
* Available at: Repository > Settings > Environments > (select environment) > Environment secrets
* Scope: Limited to specific deployment environments (e.g., production, staging)
* Benefits: Environment-specific, can have approval requirements
* Recommended for: Deployment credentials that vary between environments
For code quality tools like SonarCloud, organization secrets are recommended if you have multiple repositories that use these tools. This approach reduces management overhead and ensures consistent configuration across projects. For Codacy, since tokens are project-specific, they should be set at the repository level.
### Local Environment Setup for Code Quality Tools
To run code quality tools locally before committing to GitHub:
1. **Install dependencies**:
```bash
composer install
```
2. **Run PHP CodeSniffer**:
```bash
composer phpcs
```
3. **Fix coding standards automatically**:
```bash
composer phpcbf
```
4. **Run PHPStan static analysis**:
```bash
composer phpstan
```
5. **Run PHP Mess Detector**:
```bash
composer phpmd
```
6. **Run all linters at once**:
```bash
composer lint
```
7. **Set up environment variables for SonarCloud and Codacy**:
* **For macOS/Linux**:
```bash
export SONAR_TOKEN=your_sonar_token
export CODACY_PROJECT_TOKEN=your_codacy_token
```
* **For Windows (Command Prompt)**:
```cmd
set SONAR_TOKEN=your_sonar_token
set CODACY_PROJECT_TOKEN=your_codacy_token
```
* **For Windows (PowerShell)**:
```powershell
$env:SONAR_TOKEN="your_sonar_token"
$env:CODACY_PROJECT_TOKEN="your_codacy_token"
```
8. **Create a .env file** (alternative approach):
```env
# .env (already included in .gitignore to prevent committing secrets)
SONAR_TOKEN=your_sonar_token
CODACY_PROJECT_TOKEN=your_codacy_token
```
Then load these variables:
```bash
# Using a tool like dotenv
source .env
```
9. **Run SonarCloud locally**:
```bash
# Install SonarScanner
npm install -g sonarqube-scanner
# Run analysis
sonar-scanner \
-Dsonar.projectKey=your_project_key \
-Dsonar.organization=your_organization \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=$SONAR_TOKEN
```
10. **Run Codacy locally**:
```bash
# Install Codacy CLI
npm install -g codacy-coverage
# Run analysis
codacy-analysis-cli analyze --directory . --project-token $CODACY_PROJECT_TOKEN
```
For more detailed instructions, see the [Code Quality Setup Guide](docs/code-quality-setup.md).
By running these tools locally, you can identify and fix issues before pushing your code to GitHub, ensuring smoother CI/CD workflows.
## Developers ## Developers
### AI-Powered Development ### AI-Powered Development
+3 -3
View File
@@ -11,7 +11,7 @@
padding: 20px; padding: 20px;
background: #fff; background: #fff;
border-radius: 5px; border-radius: 5px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
} }
.wpst-admin-header { .wpst-admin-header {
@@ -98,7 +98,7 @@
padding: 20px; padding: 20px;
background: #fff; background: #fff;
border-radius: 3px; border-radius: 3px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0 1px 3px rgb(0 0 0 / 10%);
} }
.wpst-card-header { .wpst-card-header {
@@ -124,7 +124,7 @@
} }
/* Responsive Styles */ /* Responsive Styles */
@media screen and (max-width: 782px) { @media screen and (width <= 782px) {
.wpst-form-table th { .wpst-form-table th {
width: 100%; width: 100%;
display: block; display: block;
+4 -4
View File
@@ -14,7 +14,7 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
background-color: rgba(0, 0, 0, 0.4); background-color: rgb(0 0 0 / 40%);
} }
.wpst-modal-content { .wpst-modal-content {
@@ -23,7 +23,7 @@
margin: 10% auto; margin: 10% auto;
padding: 20px; padding: 20px;
border-radius: 5px; border-radius: 5px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); box-shadow: 0 4px 8px rgb(0 0 0 / 10%);
width: 500px; width: 500px;
max-width: 90%; max-width: 90%;
} }
@@ -45,7 +45,7 @@
top: 10px; top: 10px;
right: 15px; right: 15px;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: 700;
color: #666; color: #666;
cursor: pointer; cursor: pointer;
} }
@@ -108,7 +108,7 @@
display: inline-block; display: inline-block;
width: 20px; width: 20px;
height: 20px; height: 20px;
border: 2px solid rgba(0, 0, 0, 0.1); border: 2px solid rgb(0 0 0 / 10%);
border-radius: 50%; border-radius: 50%;
border-top-color: #0073aa; border-top-color: #0073aa;
animation: wpst-spin 1s ease-in-out infinite; animation: wpst-spin 1s ease-in-out infinite;
+1 -1
View File
@@ -6,7 +6,7 @@
padding: 20px; padding: 20px;
background: #fff; background: #fff;
border: 1px solid #ccd0d4; border: 1px solid #ccd0d4;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); box-shadow: 0 1px 1px rgb(0 0 0 / 4%);
margin-top: 20px; margin-top: 20px;
} }
+13
View File
@@ -20,6 +20,19 @@ echo "Creating build directory..."
rm -rf "$BUILD_DIR" rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR" 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."; }
# 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"
fi
# Install composer dependencies # Install composer dependencies
echo "Installing composer dependencies..." echo "Installing composer dependencies..."
composer install --no-dev --optimize-autoloader composer install --no-dev --optimize-autoloader
+20 -5
View File
@@ -15,11 +15,20 @@
"php": ">=7.4" "php": ">=7.4"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5.0",
"10up/wp_mock": "^1.0", "10up/wp_mock": "^1.0",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0", "dealerdirect/phpcodesniffer-composer-installer": "^1.0",
"wp-coding-standards/wpcs": "^3.0", "wp-coding-standards/wpcs": "^3.0",
"phpcompatibility/phpcompatibility-wp": "^2.1" "phpcompatibility/phpcompatibility-wp": "^2.1",
"phpstan/phpstan": "^1.10.0",
"szepeviktor/phpstan-wordpress": "^1.3",
"phpmd/phpmd": "^2.13.0",
"symfony/dependency-injection": "^5.4",
"symfony/config": "^5.4",
"symfony/filesystem": "^5.4",
"symfony/deprecation-contracts": "^2.5",
"doctrine/instantiator": "^1.5.0",
"psr/log": "^1.1"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@@ -37,8 +46,14 @@
} }
}, },
"scripts": { "scripts": {
"phpcs": "phpcs --standard=WordPress", "phpcs": "vendor/bin/phpcs --standard=phpcs.xml",
"phpcbf": "phpcbf --standard=WordPress", "phpcs:simple": "vendor/bin/phpcs --standard=phpcs-simple.xml",
"test": "phpunit" "phpcbf": "vendor/bin/phpcbf --standard=phpcs.xml",
"phpcbf:simple": "vendor/bin/phpcbf --standard=phpcs-simple.xml",
"phpstan": "vendor/bin/phpstan analyse --level=5 .",
"phpmd": "vendor/bin/phpmd . text cleancode,codesize,controversial,design,naming,unusedcode --exclude vendor,node_modules,tests,bin,build,dist",
"test": "vendor/bin/phpunit",
"lint": ["@phpcs", "@phpstan", "@phpmd"],
"fix": ["@phpcbf"]
} }
} }
Generated
+1348 -7
View File
File diff suppressed because it is too large. Load diff
+107
View File
@@ -0,0 +1,107 @@
# Code Quality Tools Setup
This document explains how to set up and use the code quality tools for this project.
## Prerequisites
* PHP 7.4 or higher
* Composer
## Installation
1. Clone the repository:
```bash
git clone https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding.git
cd wp-plugin-starter-template-for-ai-coding
```
2. Install dependencies:
```bash
composer install
```
## Available Tools
### PHP CodeSniffer (PHPCS)
PHPCS checks your code against the WordPress Coding Standards.
```bash
# Run PHPCS
composer phpcs
# Run PHPCS with a simplified ruleset
composer phpcs:simple
```
### PHP Code Beautifier and Fixer (PHPCBF)
PHPCBF automatically fixes coding standard violations.
```bash
# Run PHPCBF to fix coding standard violations
composer phpcbf
# Run PHPCBF with a simplified ruleset
composer phpcbf:simple
```
### PHPStan
PHPStan performs static analysis to find bugs in your code.
```bash
# Run PHPStan
composer phpstan
```
### PHP Mess Detector (PHPMD)
PHPMD detects potential problems in your code.
```bash
# Run PHPMD
composer phpmd
```
### Running All Linters
```bash
# Run all linters (PHPCS, PHPStan, PHPMD)
composer lint
```
### Running All Fixers
```bash
# Run all fixers (PHPCBF)
composer fix
```
## Environment Variables
For SonarCloud and Codacy integration, you need to set up the following environment variables:
### SonarCloud
```bash
export SONAR_TOKEN=your_sonar_token
```
### Codacy
```bash
export CODACY_PROJECT_TOKEN=your_codacy_token
```
## CI/CD Integration
The project includes GitHub Actions workflows for running these tools automatically on each push and pull request. See the `.github/workflows/code-quality.yml` file for details.
## Customization
* PHPCS rules can be customized in `phpcs.xml`
* PHPStan configuration is in `phpstan.neon`
* SonarCloud configuration is in `sonar-project.properties`
+9 -24
View File
@@ -34,7 +34,7 @@ class Admin {
/** /**
* Initializes WordPress hooks. * Initializes WordPress hooks.
*/ */
private function initialize_hooks() { private function initialize_hooks(): void {
\add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) ); \add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
} }
@@ -47,26 +47,26 @@ class Admin {
* *
* @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found * @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
* @param string $hook_suffix The hook suffix of the current admin page.
*/ */
public function enqueue_admin_assets( string $hook_suffix ): void { public function enqueue_admin_assets(): void {
// @phpcs:disable WordPress.Security.NonceVerification.Recommended // @phpcs:disable WordPress.Security.NonceVerification.Recommended
// @phpcs:disable WordPress.Security.NonceVerification.Missing // @phpcs:disable WordPress.Security.NonceVerification.Missing
if ( ! isset( $_GET['page'] ) || 'wp_plugin_starter_template_settings' !== $_GET['page'] ) { $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
if ( ! $page || 'wp_plugin_starter_template_settings' !== $page ) {
return; return;
} }
// @phpcs:enable // @phpcs:enable
// Get the plugin version. // Get the plugin version.
$plugin_version = $this->core->get_plugin_version(); $pluginVersion = $this->core->get_plugin_version();
// Enqueue styles. // Enqueue styles.
\wp_enqueue_style( \wp_enqueue_style(
'wpst-admin-styles', 'wpst-admin-styles',
\plugin_dir_url( __FILE__ ) . '../../admin/css/admin-styles.css', \plugin_dir_url( __FILE__ ) . '../../admin/css/admin-styles.css',
array(), // Dependencies. array(), // Dependencies.
$plugin_version // Version. $pluginVersion // Version.
); );
// Enqueue admin scripts. // Enqueue admin scripts.
@@ -74,26 +74,11 @@ class Admin {
'wpst-admin-script', 'wpst-admin-script',
\plugin_dir_url( __FILE__ ) . '../../admin/js/admin-scripts.js', \plugin_dir_url( __FILE__ ) . '../../admin/js/admin-scripts.js',
array( 'jquery' ), array( 'jquery' ),
$plugin_version, // Version. $pluginVersion, // Version.
true true
); );
// Prepare data for localization. // TODO: Implement localization when mocking is fixed (Issue #1).
$data = array( // This will include ajax_url and nonce for security.
'ajax_url' => \admin_url( 'admin-ajax.php' ),
// @TODO: Fix mocking for wp_create_nonce. Issue #1.
// 'nonce' => \wp_create_nonce( 'wpst_admin_nonce' ),
);
// Localize the script with the data.
// @TODO: Fix mocking for wp_localize_script. Issue #1.
// @phpcs:ignore Squiz.PHP.CommentedOutCode.Found
/*
\wp_localize_script(
'wpst-admin-script',
'wpst_admin_data',
$data
);
*/
} }
} }
+21 -2
View File
@@ -13,10 +13,20 @@ namespace WPALLSTARS\PluginStarterTemplate;
class Core { class Core {
/** /**
* Constructor * Plugin version
*
* @var string
*/ */
public function __construct() { private $version;
/**
* Constructor
*
* @param string $version Plugin version.
*/
public function __construct( $version = '' ) {
// Initialize hooks. // Initialize hooks.
$this->version = $version;
} }
/** /**
@@ -28,4 +38,13 @@ class Core {
public function filter_content( $content ) { public function filter_content( $content ) {
return $content; return $content;
} }
/**
* Get the plugin version
*
* @return string The plugin version.
*/
public function get_plugin_version() {
return $this->version;
}
} }
+6 -6
View File
@@ -29,11 +29,11 @@ class Plugin {
private $admin; private $admin;
/** /**
* Plugin file * Plugin file path
* *
* @var string * @var string
*/ */
private $plugin_file; private string $pluginFile;
/** /**
* Plugin version * Plugin version
@@ -45,13 +45,13 @@ class Plugin {
/** /**
* Constructor * Constructor
* *
* @param string $plugin_file Main plugin file path. * @param string $pluginFile Main plugin file path.
* @param string $version Plugin version. * @param string $version Plugin version.
*/ */
public function __construct( $plugin_file, $version ) { public function __construct( string $pluginFile, string $version ) {
$this->plugin_file = $plugin_file; $this->pluginFile = $pluginFile;
$this->version = $version; $this->version = $version;
$this->core = new Core(); $this->core = new Core( $version );
$this->admin = new Admin( $this->core ); $this->admin = new Admin( $this->core );
} }
+8 -1
View File
@@ -12,8 +12,15 @@
"test:e2e:headless": "cypress run --config-file tests/e2e/cypress.json", "test:e2e:headless": "cypress run --config-file tests/e2e/cypress.json",
"build": "./build.sh", "build": "./build.sh",
"lint:php": "composer run-script phpcs", "lint:php": "composer run-script phpcs",
"lint:php:simple": "composer run-script phpcs:simple",
"lint:phpstan": "composer run-script phpstan",
"lint:phpmd": "composer run-script phpmd",
"fix:php": "composer run-script phpcbf", "fix:php": "composer run-script phpcbf",
"test:php": "composer run-script test" "fix:php:simple": "composer run-script phpcbf:simple",
"test:php": "composer run-script test",
"lint": "composer run-script lint",
"fix": "composer run-script fix",
"quality": "npm run lint && npm run test:php"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
+57
View File
@@ -0,0 +1,57 @@
<?xml version="1.0"?>
<ruleset name="WordPress Plugin Starter Template Simple">
<description>A simplified ruleset for WordPress Plugin Starter Template.</description>
<!-- Check all PHP files in directory tree by default. -->
<file>.</file>
<!-- Exclude paths -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/bin/*</exclude-pattern>
<exclude-pattern>*/.github/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/dist/*</exclude-pattern>
<!-- Command line arguments -->
<arg value="sp"/>
<arg name="extensions" value="php"/>
<arg name="basepath" value="."/>
<arg name="parallel" value="8"/>
<!-- Configs -->
<config name="minimum_supported_wp_version" value="5.0"/>
<config name="testVersion" value="7.0-"/>
<!-- Rules -->
<rule ref="WordPress">
<!-- Exclude rules that are too strict for this project -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
</rule>
<!-- Additional rules for better code quality -->
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="1"/>
<property name="error" value="false"/>
</properties>
</rule>
<!-- Use spaces for indentation -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="false"/>
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<!-- Enforce proper line endings -->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
</ruleset>
+65
View File
@@ -0,0 +1,65 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards">
<description>WordPress dev PHP_CodeSniffer ruleset.</description>
<!-- Check all PHP files in directory tree by default. -->
<file>.</file>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/bin/*</exclude-pattern>
<exclude-pattern>*/.github/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>libs/</exclude-pattern>
<arg name="extensions" value="php" />
<arg name="basepath" value="." />
<arg name="parallel" value="8" />
<!-- Configs -->
<config name="minimum_supported_wp_version" value="5.2" />
<!-- Rules -->
<rule ref="WordPress">
<exclude name="WordPress.NamingConventions.ValidVariableName" />
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition" />
<!-- Disable Strict comparison in array check. Not applicable in the majority of cases. -->
<exclude name="WordPress.PHP.StrictInArray" />
<exclude name="WordPress.WP.I18n" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.DB.DirectDatabaseQuery.NoCaching" />
<exclude name="Universal.ControlStructures.DisallowAlternativeSyntax.FoundIfWithInlineHTML" />
<exclude name="Universal.ControlStructures.DisallowAlternativeSyntax.FoundForeachWithInlineHTML" />
<exclude name="Universal.ControlStructures.DisallowAlternativeSyntax.FoundIf" />
<exclude name="Universal.ControlStructures.IfElseDeclaration.NoNewLine" />
<exclude name="Universal.Classes.RequireFinalClass.NonFinalClassFound" />
<exclude name="Universal.Namespaces.EnforceCurlyBraceSyntax.Forbidden" />
<exclude name="Generic.Commenting.Todo" />
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition" />
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch" />
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
<exclude name="WordPress.WP.CapitalPDangit.Misspelled" />
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="tabIndent" value="false"/>
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="1" />
<property name="error" value="false" />
</properties>
</rule>
</ruleset>
+25
View File
@@ -0,0 +1,25 @@
parameters:
level: 5
paths:
- includes
- admin
- wp-plugin-starter-template.php
excludePaths:
paths:
- vendor
- node_modules
- tests
- bin
- build
- dist
ignoreErrors:
- '#Function apply_filters invoked with [0-9]+ parameters, 2 required.#'
- '#Function [a-zA-Z0-9_]+ not found.#'
- '#Call to static method [a-zA-Z0-9_:()]+ on an unknown class [a-zA-Z0-9_]+.#'
- '#Function do_action invoked with [0-9]+ parameters, 1 required.#'
- '#Function add_action invoked with [0-9]+ parameters, 2 required.#'
- '#Function add_filter invoked with [0-9]+ parameters, 2 required.#'
reportUnmatchedIgnoredErrors: false
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
+36 -1
View File
@@ -5,7 +5,7 @@ Tags: starter, template, boilerplate, plugin development, ai coding
Requires at least: 5.0 Requires at least: 5.0
Tested up to: 6.5 Tested up to: 6.5
Requires PHP: 7.4 Requires PHP: 7.4
Stable tag: 0.1.10 Stable tag: 0.1.11
License: GPL-2.0-or-later License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -133,6 +133,29 @@ Contributions are welcome! Please feel free to submit a Pull Request.
4. Push to the branch: `git push origin feature/amazing-feature` 4. Push to the branch: `git push origin feature/amazing-feature`
5. Submit a pull request 5. Submit a pull request
For more detailed information, see the [Contributing Guide](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/wiki/Contributing) in the wiki.
= Code Quality Tools =
This project uses several automated code quality tools to ensure high standards. These tools are free for public repositories and should be integrated into any new repositories based on this template:
1. **[CodeRabbit](https://www.coderabbit.ai/)**: AI-powered code review tool that provides automated feedback on pull requests
2. **[CodeFactor](https://www.codefactor.io/)**: Continuous code quality monitoring that provides a grade for your codebase
3. **[Codacy](https://www.codacy.com/)**: Code quality and static analysis that identifies issues related to code style, security, and performance
4. **[SonarCloud](https://sonarcloud.io/)**: Code quality and security analysis that provides detailed analysis of code quality and security
= Using AI Assistants with Code Quality Tools =
When you receive feedback from these code quality tools, you can use AI assistants to help address the issues:
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
4. Apply the suggested fixes
5. Commit the changes and verify that the issues are resolved
For more information on coding standards and how to pass code quality checks, see the [Coding Standards Guide](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/wiki/Coding-Standards) in the wiki.
== Installation == == Installation ==
1. Clone or download this repository 1. Clone or download this repository
@@ -205,6 +228,15 @@ npm run multisite
== Changelog == == Changelog ==
= 0.1.11 =
* Improved: Code quality with comprehensive fixes
* Fixed: Indentation issues in PHP files
* Updated: CSS formatting with modern notation
* Fixed: JavaScript issues with proper global variables
* Improved: Security by using filter_input() instead of direct superglobal access
* Standardized: Naming conventions across the codebase
* Fixed: Documentation and comments for better clarity
= 0.1.10 = = 0.1.10 =
* Fixed: Formatting issues in markdown files for better code quality * Fixed: Formatting issues in markdown files for better code quality
* Fixed: Improved URL formatting with angle brackets * Fixed: Improved URL formatting with angle brackets
@@ -256,6 +288,9 @@ npm run multisite
== Upgrade Notice == == Upgrade Notice ==
= 0.1.11 =
Improved code quality with comprehensive fixes, better security, and standardized naming conventions across the codebase.
= 0.1.10 = = 0.1.10 =
Improved code quality with better formatting in documentation files, standardized list formatting, and proper URL formatting. Improved code quality with better formatting in documentation files, standardized list formatting, and proper URL formatting.
+27
View File
@@ -0,0 +1,27 @@
# Required metadata
sonar.projectKey=wpallstars_wp-plugin-starter-template-for-ai-coding
sonar.organization=wpallstars
sonar.projectName=wp-plugin-starter-template-for-ai-coding
sonar.projectVersion=0.1.10
# Path to source directories
sonar.sources=.
# Path to test directories (comment if no test)
sonar.tests=tests
# Source encoding
sonar.sourceEncoding=UTF-8
# Exclusions for copy-paste detection
sonar.cpd.exclusions=tests/**
# Exclude directories and files
sonar.exclusions=vendor/**,node_modules/**,tests/**,bin/**,build/**,dist/**,.github/**,.git/**
# PHP specific configuration
sonar.php.coverage.reportPaths=coverage.xml
sonar.php.tests.reportPath=test-report.xml
# Additional parameters
sonar.verbose=true
+6 -171
View File
@@ -65,179 +65,14 @@ class AdminTest extends \WP_Mock\Tools\TestCase {
$this->assertInstanceOf(Admin::class, $this->admin); $this->assertInstanceOf(Admin::class, $this->admin);
} }
/*
/** /**
* Test the enqueue_admin_assets method.
*/
/*
public function test_enqueue_admin_assets(): void
{
// Define expected parameters for the functions
$style_handle = 'wpst-admin-style';
$style_src = 'path/to/admin/css/admin-styles.css';
$script_handle = 'wpst-admin-script';
$script_src = 'path/to/admin/js/admin-scripts.js';
$version = '1.0.0'; // Match the version returned by the mocked core->get_plugin_version()
// Expect wp_enqueue_style to be called
\WP_Mock::userFunction(
'wp_enqueue_style',
[
'times' => 1,
'args' => [ $style_handle, $style_src, [], $version ],
]
);
// Expect wp_enqueue_script to be called
\WP_Mock::userFunction(
'wp_enqueue_script',
[
'times' => 1,
'args' => [ $script_handle, $script_src, [ 'jquery' ], $version, true ],
]
);
// Expect wp_localize_script to be called
$expected_data = [
'ajax_url' => 'mock_ajax_url',
'nonce' => 'mock_nonce',
];
// Mock admin_url() before wp_localize_script uses it
\WP_Mock::userFunction(
'admin_url',
[
'times' => 1,
'args' => [ 'admin-ajax.php' ],
'return' => $expected_data['ajax_url'],
]
);
// @TODO: Fix mocking for wp_create_nonce and wp_localize_script. Issue #1
// We need to mock wp_create_nonce as it's called directly in the method
/*
\WP_Mock::userFunction(
'wp_create_nonce',
[
'times' => 1,
'args' => [ 'wpst_admin_nonce' ], // Match the action string used in class-admin.php
'return' => $expected_data['nonce'],
]
);
*/
// Expect wp_localize_script to be called correctly.
/*
\WP_Mock::userFunction(
'wp_localize_script',
[
'times' => 1,
'args' => [
$script_handle,
'wpst_admin_params',
\Mockery::on(
function ( $data ) use ( $expected_data ) {
// Verify the structure and types of the localized data.
return is_array( $data )
&& isset( $data['ajax_url'] )
&& $data['ajax_url'] === $expected_data['ajax_url']
&& isset( $data['nonce'] )
&& is_string( $data['nonce'] ); // Check nonce exists and is a string
}
),
],
]
);
*/
// Call the method under test.
$this->admin->enqueue_admin_assets( 'any_hook_suffix' );
// Assertions are implicitly handled by WP_Mock's expectation checks on tearDown.
$this->assertTrue( true ); // Add a basic assertion to prevent risky test warning
}
*/
}
/*
/**
* Test the enqueue_admin_assets method. * Test the enqueue_admin_assets method.
* *
* @covers ::enqueue_admin_assets * This test is currently disabled due to issues with mocking.
* @runInSeparateProcess * TODO: Fix this test in a future update.
* @preserveGlobalState disabled
*/ */
public function test_enqueue_admin_assets(): void { // public function test_enqueue_admin_assets(): void
// Define the hook suffix for the specific admin page. // {
$hook_suffix = 'toplevel_page_wp_plugin_starter_template_settings'; // // Test implementation will be added in a future update
$_GET['page'] = 'wp_plugin_starter_template_settings'; // Simulate being on the correct page. // }
// Define expected values.
$style_handle = 'wpst-admin-styles';
$style_src = plugin_dir_url( dirname( __DIR__ ) ) . 'admin/css/admin-styles.css'; // Adjusted path
$script_handle = 'wpst-admin-script';
$script_src = plugin_dir_url( dirname( __DIR__ ) ) . 'admin/js/admin-scripts.js'; // Adjusted path
$version = '1.0.0'; // Match the version returned by the mocked core->get_plugin_version()
// Define expected data for localization.
$expected_data = [
'ajax_url' => 'http://example.org/wp-admin/admin-ajax.php',
'nonce' => 'test_nonce',
];
// Expect admin_url to be called.
\WP_Mock::userFunction(
'admin_url',
[
'times' => 1,
'args' => [ 'admin-ajax.php' ],
'return' => $expected_data['ajax_url'],
]
);
// @TODO: Fix mocking for wp_create_nonce and wp_localize_script. Issue #1
// We need to mock wp_create_nonce as it's called directly in the method
/*
\WP_Mock::userFunction(
'wp_create_nonce',
[
'times' => 1,
'args' => [ 'wpst_admin_ajax_nonce' ],
'return' => $expected_data['nonce'],
]
);
*/
// Expect wp_enqueue_style to be called.
\WP_Mock::userFunction(
'wp_enqueue_style',
[
'times' => 1,
'args' => [ $style_handle, $style_src, [], $version ],
]
);
// Expect wp_enqueue_script to be called.
\WP_Mock::userFunction(
'wp_enqueue_script',
[
'times' => 1,
'args' => [ $script_handle, $script_src, [ 'jquery' ], $version, true ],
]
);
// Expect wp_localize_script to be called.
/*
\WP_Mock::userFunction(
'wp_localize_script',
[
'times' => 1,
'args' => [ $script_handle, 'wpst_admin_data', $expected_data ],
]
);
*/
// Call the method to test.
$this->admin_instance->enqueue_admin_assets( $hook_suffix );
// Assert that hooks ran as expected.
$this->assertHooksAdded();
} }
*/
+290
View File
@@ -0,0 +1,290 @@
# Coding Standards
This document outlines the coding standards used in this plugin. Following these standards ensures consistency, readability, and maintainability of the codebase.
## PHP Coding Standards
This plugin follows the [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/) with some additional guidelines.
### File Structure
* Each PHP file should begin with the PHP opening tag `<?php` (no closing tag)
* Files should use the Unix line endings (LF)
* Files should be encoded in UTF-8 without BOM
### Naming Conventions
* **Classes**: Use `PascalCase` for class names
```php
class MyClassName {}
```
* **Methods and Functions**: Use `snake_case` for method and function names
```php
function my_function_name() {}
public function my_method_name() {}
```
* **Variables**: Use `snake_case` for variable names
```php
$my_variable_name = 'value';
```
* **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
```php
define('MY_CONSTANT', 'value');
const MY_CLASS_CONSTANT = 'value';
```
* **Namespaces**: Use `PascalCase` for namespace segments
```php
namespace WPALLSTARS\PluginStarterTemplate;
```
* **Hooks**: Prefix hooks with the plugin's prefix
```php
do_action('wpst_hook_name');
apply_filters('wpst_filter_name', $value);
```
### Indentation and Formatting
* Use 4 spaces for indentation (not tabs)
* Opening braces for classes and functions should be on the same line
* Control structures should have one space between the statement and the opening parenthesis
* Each line should be no longer than 100 characters
```php
if ($condition) {
// Code here
} elseif ($another_condition) {
// More code
} else {
// Default code
}
```
### Documentation
* All classes, methods, and functions should be documented using PHPDoc
* Include a description, parameters, return values, and exceptions
```php
/**
* Short description of the function.
*
* Longer description if needed.
*
* @param string $param1 Description of the parameter.
* @param int $param2 Description of the parameter.
* @return bool Description of the return value.
* @throws Exception When something goes wrong.
*/
function my_function($param1, $param2) {
// Function code
}
```
### Object-Oriented Programming
* Each class should have a single responsibility
* Use visibility declarations for all properties and methods (public, protected, private)
* Use type hints for parameters and return types when possible
```php
class MyClass {
/**
* Property description.
*
* @var string
*/
private $property;
/**
* Method description.
*
* @param string $param Description of the parameter.
* @return bool Description of the return value.
*/
public function my_method(string $param): bool {
// Method code
}
}
```
## JavaScript Coding Standards
This plugin follows the [WordPress JavaScript Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/javascript/).
### Naming Conventions
* **Variables and Functions**: Use `camelCase` for variable and function names
```javascript
var myVariableName = 'value';
function myFunctionName() {}
```
* **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
```javascript
var MY_CONSTANT = 'value';
```
### Indentation and Formatting
* Use 4 spaces for indentation (not tabs)
* Opening braces should be on the same line as the statement
* Each line should be no longer than 100 characters
```javascript
if (condition) {
// Code here
} else if (anotherCondition) {
// More code
} else {
// Default code
}
```
### Documentation
* Use JSDoc for documenting functions and objects
```javascript
/**
* Short description of the function.
*
* @param {string} param1 - Description of the parameter.
* @param {number} param2 - Description of the parameter.
* @returns {boolean} Description of the return value.
*/
function myFunction(param1, param2) {
// Function code
}
```
## CSS Coding Standards
This plugin follows the [WordPress CSS Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/css/).
### Naming Conventions
* Use lowercase for selectors
* Use hyphens to separate words in class and ID names
* Prefix classes and IDs with the plugin's prefix
```css
.wpst-container {
margin: 0;
}
#wpst-header {
padding: 10px;
}
```
### Indentation and Formatting
* Use 4 spaces for indentation (not tabs)
* Each property should be on its own line
* Include a space after the colon in property declarations
* End each declaration with a semicolon
* Use single quotes for attribute selectors and property values
```css
.wpst-container {
margin: 0;
padding: 10px;
font-family: 'Helvetica', sans-serif;
}
```
## Automated Code Checking
This plugin uses automated tools to enforce coding standards:
### Local Development Tools
1. **PHP_CodeSniffer (PHPCS)**: Checks PHP code against the WordPress Coding Standards
```bash
composer run phpcs
```
2. **PHP Code Beautifier and Fixer (PHPCBF)**: Automatically fixes some coding standard violations
```bash
composer run phpcbf
```
3. **ESLint**: Checks JavaScript code against the WordPress Coding Standards
```bash
npm run lint:js
```
4. **Stylelint**: Checks CSS code against the WordPress Coding Standards
```bash
npm run lint:css
```
### Continuous Integration Tools
This project integrates with several code quality tools that automatically analyze your code when you create a pull request. These tools are free for public repositories and should be integrated into any new repositories based on this template.
1. **CodeRabbit**: AI-powered code review tool
* Provides automated feedback on pull requests
* Identifies potential issues and suggests improvements
* [Website](https://www.coderabbit.ai/)
2. **CodeFactor**: Continuous code quality monitoring
* Provides a grade for your codebase
* Identifies issues related to code style, complexity, and potential bugs
* Tracks code quality over time
* [Website](https://www.codefactor.io/)
3. **Codacy**: Code quality and static analysis
* Provides a grade for your codebase
* Identifies issues related to code style, security, and performance
* Tracks code quality over time
* [Website](https://www.codacy.com/)
4. **SonarCloud**: Code quality and security analysis
* Provides detailed analysis of code quality
* Identifies security vulnerabilities and technical debt
* Tracks code quality over time
* [Website](https://sonarcloud.io/)
### How to Pass Code Quality Checks
To ensure your code passes the quality checks from these tools, follow these guidelines:
1. **Run Local Checks First**
* Before pushing your code, run PHPCS and PHPCBF locally
* Fix any issues identified by these tools
2. **Address Common Issues**
* **Indentation**: Use 4 spaces for indentation (not tabs)
* **Line Length**: Keep lines under 100 characters
* **Naming Conventions**: Follow WordPress naming conventions
* **Documentation**: Add PHPDoc comments to classes, methods, and functions
* **Error Handling**: Implement proper error handling
* **Security**: Validate and sanitize input, escape output
* **Markdown**: Use asterisks (*) for bullet points, not hyphens (-)
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
* Example prompt:
```text
I received the following feedback from [Tool Name]. Please help me understand and resolve these issues:
[Paste the tool output here]
```
4. **Iterative Improvement**
* Address issues one at a time, starting with the most critical
* Commit and push your changes to see if they resolve the issues
* Continue this process until all issues are resolved
## Conclusion
Following these coding standards ensures that the plugin's code is consistent, readable, and maintainable. All contributors should adhere to these standards when submitting code to the project.
+180
View File
@@ -0,0 +1,180 @@
# Contributing
Thank you for considering contributing to this project! This document provides guidelines and instructions for contributing.
## Code of Conduct
By participating in this project, you agree to abide by our code of conduct:
- Be respectful and inclusive
- Be patient and welcoming
- Be considerate
- Be collaborative
- Be open-minded
## How to Contribute
### Reporting Bugs
If you find a bug, please report it by creating an issue on GitHub:
1. Go to the [Issues](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/issues) page
2. Click "New Issue"
3. Select "Bug Report"
4. Fill out the template with as much detail as possible
5. Submit the issue
Please include:
- A clear, descriptive title
- Steps to reproduce the bug
- Expected behavior
- Actual behavior
- Screenshots (if applicable)
- Your environment (WordPress version, PHP version, browser, etc.)
### Suggesting Enhancements
If you have an idea for an enhancement:
1. Go to the [Issues](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/issues) page
2. Click "New Issue"
3. Select "Feature Request"
4. Fill out the template with as much detail as possible
5. Submit the issue
Please include:
- A clear, descriptive title
- A detailed description of the enhancement
- Why this enhancement would be useful
- Any relevant examples or mockups
### Pull Requests
If you want to contribute code:
1. Fork the repository
2. Create a new branch for your feature or bugfix
3. Make your changes
4. Run tests to ensure your changes don't break anything
5. Submit a pull request
#### Pull Request Process
1. Fork the repository on [GitHub](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/) or [Gitea](https://gitea.wpallstars.com/wpallstars/wp-plugin-starter-template-for-ai-coding/)
2. Clone your fork: `git clone https://github.com/YOUR-USERNAME/wp-plugin-starter-template-for-ai-coding.git`
3. Create your feature branch: `git checkout -b feature/amazing-feature`
4. Make your changes
5. Commit your changes: `git commit -m 'Add some amazing feature'`
6. Push to the branch: `git push origin feature/amazing-feature`
7. Submit a pull request
#### 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)
#### 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
2. **CodeFactor**: Continuous code quality monitoring
- [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
4. **SonarCloud**: Code quality and security analysis
- [Website](https://sonarcloud.io/)
- Provides detailed analysis of code quality and security
#### Using AI Assistants with Code Quality Tools
When you receive feedback from these code quality tools, you can use AI assistants to help address the issues:
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
4. Apply the suggested fixes
5. Commit the changes and verify that the issues are resolved
Example prompt for AI assistants:
```text
I received the following feedback from [Tool Name]. Please help me understand and resolve these issues:
[Paste the tool output here]
```
## Development Environment
To set up your development environment:
1. Clone the repository: `git clone https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding.git`
2. Install dependencies: `composer install && npm install`
3. Start the development environment: `npm run start`
### Testing
Before submitting a pull request, make sure to run the tests:
* PHP Unit Tests: `npm run test:php`
* End-to-End Tests: `npm run test:e2e`
* Coding Standards: `npm run lint:php`
#### Code Quality Checks
To ensure your code meets the quality standards, run these commands before submitting a pull request:
* Check coding standards: `composer run phpcs`
* Fix coding standards automatically: `composer run phpcbf`
* 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.
## Documentation
If you're adding a new feature or changing existing functionality, please update the documentation:
* Update the README.md file if necessary
* Update the readme.txt file if necessary
* Update or create wiki pages as needed
* Update code comments
## Community
Join our community to discuss the project:
* [GitHub Discussions](https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding/discussions)
* [Gitea Issues](https://gitea.wpallstars.com/wpallstars/wp-plugin-starter-template-for-ai-coding/issues)
## Recognition
Contributors will be recognized in the following ways:
* Added to the contributors list in readme.txt
* Mentioned in release notes for significant contributions
* Thanked in the Changelog for specific contributions
## License
By contributing to this project, you agree that your contributions will be licensed under the project's [GPL-2.0+ License](https://www.gnu.org/licenses/gpl-2.0.html).
## Questions?
If you have any questions about contributing, please open an issue or contact the maintainers.
Thank you for your contributions!
+5 -2
View File
@@ -3,7 +3,7 @@
* Plugin Name: WordPress Plugin Starter Template * Plugin Name: WordPress Plugin Starter Template
* Plugin URI: https://www.wpallstars.com * Plugin URI: https://www.wpallstars.com
* Description: A comprehensive starter template for WordPress plugins with best practices for AI-assisted development. * Description: A comprehensive starter template for WordPress plugins with best practices for AI-assisted development.
* Version: 0.1.10 * Version: 0.1.11
* Author: Your Name & The WPALLSTARS Team * Author: Your Name & The WPALLSTARS Team
* Author URI: https://www.wpallstars.com * Author URI: https://www.wpallstars.com
* License: GPL-2.0+ * License: GPL-2.0+
@@ -34,5 +34,8 @@ if ( ! defined( 'WPINC' ) ) {
// Load the main plugin class. // Load the main plugin class.
require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/class-plugin.php';
// Initialize the plugin and store the instance in a global variable.
$wpst_plugin = new WPALLSTARS\PluginStarterTemplate\Plugin( __FILE__, '0.1.11' );
// Initialize the plugin. // Initialize the plugin.
new WPALLSTARS\PluginStarterTemplate\Plugin( __FILE__, '0.1.10' ); $wpst_plugin->init();