Merge pull request #10 from wpallstars/markdown-bullet-point-standardization
Markdown bullet point standardization
This commit is contained in:
116
.ai-assistant.md
116
.ai-assistant.md
@@ -6,50 +6,51 @@ 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.
|
||||
|
||||
- **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 Scope**: All code changes, documentation, and functionality discussions should be limited to THIS repository only
|
||||
* **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 Scope**: All code changes, documentation, and functionality discussions should be limited to THIS repository only
|
||||
|
||||
## Project Overview
|
||||
|
||||
- **Plugin Name**: WordPress Plugin Starter Template
|
||||
- **Plugin Slug**: wp-plugin-starter-template
|
||||
- **Text Domain**: wp-plugin-starter-template
|
||||
- **Namespace**: WPALLSTARS\PluginStarterTemplate
|
||||
- **Version**: 0.1.1
|
||||
- **Requires WordPress**: 5.0+
|
||||
- **Requires PHP**: 7.0+
|
||||
- **License**: GPL-2.0+
|
||||
* **Plugin Name**: WordPress Plugin Starter Template
|
||||
* **Plugin Slug**: wp-plugin-starter-template
|
||||
* **Text Domain**: wp-plugin-starter-template
|
||||
* **Namespace**: WPALLSTARS\PluginStarterTemplate
|
||||
* **Version**: 0.1.10
|
||||
* **Requires WordPress**: 5.0+
|
||||
* **Requires PHP**: 7.0+
|
||||
* **License**: GPL-2.0+
|
||||
|
||||
## Repository Structure
|
||||
|
||||
- **wp-plugin-starter-template.php**: Main plugin file with plugin headers
|
||||
- **includes/**: Core plugin functionality
|
||||
- **plugin.php**: Main plugin class that initializes everything
|
||||
- **core.php**: Core functionality class
|
||||
- **updater.php**: Update mechanism for multiple sources
|
||||
- **admin/**: Admin-specific functionality
|
||||
- **lib/**: Admin classes
|
||||
- **css/**: Admin stylesheets
|
||||
- **js/**: Admin JavaScript files
|
||||
- **languages/**: Translation files
|
||||
- **.github/workflows/**: GitHub Actions workflows
|
||||
- **.ai-workflows/**: Documentation for AI assistants
|
||||
- **.wiki/**: Wiki documentation templates
|
||||
* **wp-plugin-starter-template.php**: Main plugin file with plugin headers
|
||||
* **includes/**: Core plugin functionality
|
||||
* **plugin.php**: Main plugin class that initializes everything
|
||||
* **core.php**: Core functionality class
|
||||
* **updater.php**: Update mechanism for multiple sources
|
||||
* **admin/**: Admin-specific functionality
|
||||
* **lib/**: Admin classes
|
||||
* **css/**: Admin stylesheets
|
||||
* **js/**: Admin JavaScript files
|
||||
* **languages/**: Translation files
|
||||
* **.github/workflows/**: GitHub Actions workflows
|
||||
* **.ai-workflows/**: Documentation for AI assistants
|
||||
* **.wiki/**: Wiki documentation templates
|
||||
|
||||
## Coding Standards
|
||||
|
||||
This project follows the [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/wordpress-coding-standards/):
|
||||
|
||||
- Use 4 spaces for indentation, not tabs (this is a project-specific override of WordPress standards)
|
||||
- Follow WordPress naming conventions:
|
||||
- Class names: `Class_Name`
|
||||
- Function names: `function_name`
|
||||
- Variable names: `$variable_name`
|
||||
- Use proper DocBlocks for all classes, methods, and functions
|
||||
- Ensure all user-facing strings are translatable
|
||||
- Validate and sanitize all inputs
|
||||
- Escape all outputs
|
||||
* Use 4 spaces for indentation, not tabs (this is a project-specific override of WordPress standards)
|
||||
* Follow WordPress naming conventions:
|
||||
* Class names: `Class_Name`
|
||||
* Function names: `function_name`
|
||||
* Variable names: `$variable_name`
|
||||
* Use proper DocBlocks for all classes, methods, and functions
|
||||
* Ensure all user-facing strings are translatable
|
||||
* Validate and sanitize all inputs
|
||||
* Escape all outputs
|
||||
* Use asterisks (*) for bullet points in all Markdown files, not hyphens (-)
|
||||
|
||||
### Code Quality Tools
|
||||
|
||||
@@ -76,10 +77,10 @@ This project uses several automated code quality tools to ensure high standards:
|
||||
```
|
||||
|
||||
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
|
||||
* **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.
|
||||
|
||||
@@ -103,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.
|
||||
|
||||
7. **Consistent Markdown Formatting**: Always use asterisks (*) for bullet points in Markdown files, not hyphens (-).
|
||||
|
||||
## Internationalization (i18n)
|
||||
|
||||
All user-facing strings should be translatable:
|
||||
|
||||
- Use `__()` for simple strings
|
||||
- Use `_e()` for echoed strings
|
||||
- Use `esc_html__()` for escaped strings
|
||||
- Use `esc_html_e()` for escaped and echoed strings
|
||||
- Always use the plugin's text domain: `wp-plugin-starter-template`
|
||||
* Use `__()` for simple strings
|
||||
* Use `_e()` for echoed strings
|
||||
* Use `esc_html__()` for escaped strings
|
||||
* Use `esc_html_e()` for escaped and echoed strings
|
||||
* Always use the plugin's text domain: `wp-plugin-starter-template`
|
||||
|
||||
Example:
|
||||
```php
|
||||
@@ -120,26 +123,27 @@ echo esc_html__('This is a translatable string', 'wp-plugin-starter-template');
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
- Validate and sanitize all inputs
|
||||
- Escape all outputs
|
||||
- Use nonces for form submissions
|
||||
- Use capability checks for user actions
|
||||
- Follow the principle of least privilege
|
||||
* Validate and sanitize all inputs
|
||||
* Escape all outputs
|
||||
* Use nonces for form submissions
|
||||
* Use capability checks for user actions
|
||||
* Follow the principle of least privilege
|
||||
|
||||
## Documentation
|
||||
|
||||
- Keep code comments up-to-date
|
||||
- Update README.md and readme.txt when adding new features
|
||||
- Update wiki documentation in the `.wiki/` directory
|
||||
- Update changelog in both CHANGELOG.md and readme.txt
|
||||
* Keep code comments up-to-date
|
||||
* Update README.md and readme.txt when adding new features
|
||||
* Update wiki documentation in the `.wiki/` directory
|
||||
* Update changelog in both CHANGELOG.md and readme.txt
|
||||
* Use asterisks (*) for bullet points in all Markdown files
|
||||
|
||||
## Git Workflow
|
||||
|
||||
- Create feature branches from `main`
|
||||
- Use descriptive branch names (e.g., `feature/add-settings-page`)
|
||||
- Make atomic commits with clear messages
|
||||
- Create pull requests for review
|
||||
- Tag releases with version numbers (e.g., `v1.0.0`)
|
||||
* Create feature branches from `main`
|
||||
* Use descriptive branch names (e.g., `feature/add-settings-page`)
|
||||
* Make atomic commits with clear messages
|
||||
* Create pull requests for review
|
||||
* Tag releases with version numbers (e.g., `v1.0.0`)
|
||||
|
||||
## Developer Preferences
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Code Review Guide for AI Assistants
|
||||
|
||||
This document provides guidance for AI assistants to help with code review for th plugin.
|
||||
This document provides guidance for AI assistants to help with code review for this project.
|
||||
|
||||
## Code Review Checklist
|
||||
|
||||
@@ -8,54 +8,54 @@ When reviewing code, check for the following:
|
||||
|
||||
### Functionality
|
||||
|
||||
- [ ] Does the code work as expected?
|
||||
- [ ] Does it handle edge cases appropriately?
|
||||
- [ ] Are there any logical errors?
|
||||
- [ ] Is error handling implemented properly?
|
||||
* [ ] Does the code work as expected?
|
||||
* [ ] Does it handle edge cases appropriately?
|
||||
* [ ] Are there any logical errors?
|
||||
* [ ] Is error handling implemented properly?
|
||||
|
||||
### Code Quality
|
||||
|
||||
- [ ] Does the code follow WordPress coding standards?
|
||||
- [ ] Is the code well-organized and easy to understand?
|
||||
- [ ] Are there any code smells (duplicate code, overly complex functions, etc.)?
|
||||
- [ ] Are functions and variables named appropriately?
|
||||
- [ ] Are there appropriate comments and documentation?
|
||||
* [ ] Does the code follow WordPress coding standards?
|
||||
* [ ] Is the code well-organized and easy to understand?
|
||||
* [ ] Are there any code smells (duplicate code, overly complex functions, etc.)?
|
||||
* [ ] Are functions and variables named appropriately?
|
||||
* [ ] Are there appropriate comments and documentation?
|
||||
|
||||
### Security
|
||||
|
||||
- [ ] Is user input properly validated and sanitized?
|
||||
- [ ] Is output properly escaped?
|
||||
- [ ] Are capability checks used for user actions?
|
||||
- [ ] Are nonces used for form submissions?
|
||||
- [ ] Are there any potential SQL injection vulnerabilities?
|
||||
- [ ] Are there any potential XSS vulnerabilities?
|
||||
* [ ] Is user input properly validated and sanitized?
|
||||
* [ ] Is output properly escaped?
|
||||
* [ ] Are capability checks used for user actions?
|
||||
* [ ] Are nonces used for form submissions?
|
||||
* [ ] Are there any potential SQL injection vulnerabilities?
|
||||
* [ ] Are there any potential XSS vulnerabilities?
|
||||
|
||||
### Performance
|
||||
|
||||
- [ ] Are there any performance bottlenecks?
|
||||
- [ ] Are database queries optimized?
|
||||
- [ ] Is caching used appropriately?
|
||||
- [ ] Are assets (CSS, JS) properly enqueued?
|
||||
* [ ] Are there any performance bottlenecks?
|
||||
* [ ] Are database queries optimized?
|
||||
* [ ] Is caching used appropriately?
|
||||
* [ ] Are assets (CSS, JS) properly enqueued?
|
||||
|
||||
### Compatibility
|
||||
|
||||
- [ ] Is the code compatible with the minimum supported WordPress version (5.0)?
|
||||
- [ ] Is the code compatible with the minimum supported PHP version (7.0)?
|
||||
- [ ] Are there any browser compatibility issues?
|
||||
- [ ] Are there any conflicts with other plugins?
|
||||
* [ ] Is the code compatible with the minimum supported WordPress version (5.0)?
|
||||
* [ ] Is the code compatible with the minimum supported PHP version (7.0)?
|
||||
* [ ] Are there any browser compatibility issues?
|
||||
* [ ] Are there any conflicts with other plugins?
|
||||
|
||||
### Internationalization
|
||||
|
||||
- [ ] Are all user-facing strings translatable?
|
||||
- [ ] Is the correct text domain used?
|
||||
- [ ] Are translation functions used correctly?
|
||||
* [ ] Are all user-facing strings translatable?
|
||||
* [ ] Is the correct text domain used?
|
||||
* [ ] Are translation functions used correctly?
|
||||
|
||||
### Accessibility
|
||||
|
||||
- [ ] Does the code follow accessibility best practices?
|
||||
- [ ] Are ARIA attributes used appropriately?
|
||||
- [ ] Is keyboard navigation supported?
|
||||
- [ ] Is screen reader support implemented?
|
||||
* [ ] Does the code follow accessibility best practices?
|
||||
* [ ] Are ARIA attributes used appropriately?
|
||||
* [ ] Is keyboard navigation supported?
|
||||
* [ ] Is screen reader support implemented?
|
||||
|
||||
## Automated Code Review Tools
|
||||
|
||||
@@ -65,33 +65,33 @@ This project uses several automated code review tools to maintain high code qual
|
||||
|
||||
[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
|
||||
* **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
|
||||
* **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
|
||||
* **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. SonarCloud
|
||||
|
||||
[SonarCloud](https://sonarcloud.io/) is a cloud-based code quality and security service that performs static code analysis to detect bugs, vulnerabilities, and code smells.
|
||||
|
||||
- **Integration**: Add the SonarCloud GitHub App to your repository
|
||||
- **Benefits**: Provides detailed analysis of code quality, security vulnerabilities, and technical debt
|
||||
- **Usage**: SonarCloud automatically analyzes your codebase and provides feedback on pull requests
|
||||
* **Integration**: Add the SonarCloud GitHub App to your repository
|
||||
* **Benefits**: Provides detailed analysis of code quality, security vulnerabilities, and technical debt
|
||||
* **Usage**: SonarCloud automatically analyzes your codebase and provides feedback on pull requests
|
||||
|
||||
### Using AI Assistants with Code Review Tools
|
||||
|
||||
@@ -103,6 +103,16 @@ When you receive feedback from these code review tools, you can use AI assistant
|
||||
4. Implement 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:
|
||||
|
||||
```
|
||||
@@ -117,9 +127,9 @@ I received the following feedback from [Tool Name]. Please help me understand th
|
||||
|
||||
Before reviewing code, understand:
|
||||
|
||||
- What problem is the code trying to solve?
|
||||
- What are the requirements?
|
||||
- What are the constraints?
|
||||
* What problem is the code trying to solve?
|
||||
* What are the requirements?
|
||||
* What are the constraints?
|
||||
|
||||
### 2. Review the Code
|
||||
|
||||
@@ -129,54 +139,54 @@ Review the code with the checklist above in mind.
|
||||
|
||||
When providing feedback:
|
||||
|
||||
- Be specific and clear
|
||||
- Explain why a change is needed
|
||||
- Provide examples or suggestions when possible
|
||||
- Prioritize feedback (critical issues vs. minor improvements)
|
||||
- Be constructive and respectful
|
||||
* Be specific and clear
|
||||
* Explain why a change is needed
|
||||
* Provide examples or suggestions when possible
|
||||
* Prioritize feedback (critical issues vs. minor improvements)
|
||||
* Be constructive and respectful
|
||||
|
||||
### 4. Follow Up
|
||||
|
||||
After the code has been updated:
|
||||
|
||||
- Review the changes
|
||||
- Verify that issues have been addressed
|
||||
- Provide additional feedback if necessary
|
||||
* Review the changes
|
||||
* Verify that issues have been addressed
|
||||
* Provide additional feedback if necessary
|
||||
|
||||
## Common Issues to Look For
|
||||
|
||||
### PHP Issues
|
||||
|
||||
- Undefined variables or functions
|
||||
- Incorrect function parameters
|
||||
- Missing return statements
|
||||
- Improper error handling
|
||||
- Inefficient loops or conditionals
|
||||
- Hardcoded values that should be configurable
|
||||
* Undefined variables or functions
|
||||
* Incorrect function parameters
|
||||
* Missing return statements
|
||||
* Improper error handling
|
||||
* Inefficient loops or conditionals
|
||||
* Hardcoded values that should be configurable
|
||||
|
||||
### WordPress-Specific Issues
|
||||
|
||||
- Incorrect hook usage
|
||||
- Missing or incorrect nonces
|
||||
- Missing capability checks
|
||||
- Direct database queries instead of using WordPress functions
|
||||
- Improper enqueuing of scripts and styles
|
||||
- Not using WordPress functions for common tasks
|
||||
* Incorrect hook usage
|
||||
* Missing or incorrect nonces
|
||||
* Missing capability checks
|
||||
* Direct database queries instead of using WordPress functions
|
||||
* Improper enqueuing of scripts and styles
|
||||
* Not using WordPress functions for common tasks
|
||||
|
||||
### JavaScript Issues
|
||||
|
||||
- Undefined variables or functions
|
||||
- Event listener memory leaks
|
||||
- jQuery conflicts
|
||||
- Browser compatibility issues
|
||||
- Missing error handling
|
||||
* Undefined variables or functions
|
||||
* Event listener memory leaks
|
||||
* jQuery conflicts
|
||||
* Browser compatibility issues
|
||||
* Missing error handling
|
||||
|
||||
### CSS Issues
|
||||
|
||||
- Browser compatibility issues
|
||||
- Specificity issues
|
||||
- Unused styles
|
||||
- Overriding WordPress admin styles inappropriately
|
||||
* Browser compatibility issues
|
||||
* Specificity issues
|
||||
* Unused styles
|
||||
* Overriding WordPress admin styles inappropriately
|
||||
|
||||
## Example Feedback
|
||||
|
||||
|
||||
@@ -8,40 +8,40 @@ This plugin follows the [WordPress Coding Standards](https://developer.wordpress
|
||||
|
||||
### 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
|
||||
* 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
|
||||
* **Classes**: Use `PascalCase` for class names
|
||||
```php
|
||||
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
|
||||
function my_function_name() {}
|
||||
public function my_method_name() {}
|
||||
```
|
||||
|
||||
- **Variables**: Use `snake_case` for variable names
|
||||
* **Variables**: Use `snake_case` for variable names
|
||||
```php
|
||||
$my_variable_name = 'value';
|
||||
```
|
||||
|
||||
- **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
|
||||
* **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
|
||||
```php
|
||||
define('MY_CONSTANT', 'value');
|
||||
const MY_CLASS_CONSTANT = 'value';
|
||||
```
|
||||
|
||||
- **Namespaces**: Use `PascalCase` for namespace segments
|
||||
* **Namespaces**: Use `PascalCase` for namespace segments
|
||||
```php
|
||||
namespace WPALLSTARS\PluginStarterTemplate;
|
||||
```
|
||||
|
||||
- **Hooks**: Prefix hooks with the plugin's prefix
|
||||
* **Hooks**: Prefix hooks with the plugin's prefix
|
||||
```php
|
||||
do_action('wpst_hook_name');
|
||||
apply_filters('wpst_filter_name', $value);
|
||||
@@ -49,10 +49,10 @@ This plugin follows the [WordPress Coding Standards](https://developer.wordpress
|
||||
|
||||
### 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
|
||||
* 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) {
|
||||
@@ -66,8 +66,8 @@ if ($condition) {
|
||||
|
||||
### Documentation
|
||||
|
||||
- All classes, methods, and functions should be documented using PHPDoc
|
||||
- Include a description, parameters, return values, and exceptions
|
||||
* All classes, methods, and functions should be documented using PHPDoc
|
||||
* Include a description, parameters, return values, and exceptions
|
||||
|
||||
```php
|
||||
/**
|
||||
@@ -87,9 +87,9 @@ function my_function($param1, $param2) {
|
||||
|
||||
### 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
|
||||
* 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 {
|
||||
@@ -118,22 +118,22 @@ This plugin follows the [WordPress JavaScript Coding Standards](https://develope
|
||||
|
||||
### Naming Conventions
|
||||
|
||||
- **Variables and Functions**: Use `camelCase` for variable and function names
|
||||
* **Variables and Functions**: Use `camelCase` for variable and function names
|
||||
```javascript
|
||||
var myVariableName = 'value';
|
||||
function myFunctionName() {}
|
||||
```
|
||||
|
||||
- **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
|
||||
* **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
|
||||
* 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) {
|
||||
@@ -147,7 +147,7 @@ if (condition) {
|
||||
|
||||
### Documentation
|
||||
|
||||
- Use JSDoc for documenting functions and objects
|
||||
* Use JSDoc for documenting functions and objects
|
||||
|
||||
```javascript
|
||||
/**
|
||||
@@ -168,9 +168,9 @@ This plugin follows the [WordPress CSS Coding Standards](https://developer.wordp
|
||||
|
||||
### 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
|
||||
* 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 {
|
||||
@@ -184,11 +184,11 @@ This plugin follows the [WordPress CSS Coding Standards](https://developer.wordp
|
||||
|
||||
### 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
|
||||
* 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 {
|
||||
@@ -229,54 +229,55 @@ This plugin uses automated tools to enforce coding standards:
|
||||
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/)
|
||||
* 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/)
|
||||
* 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/)
|
||||
* 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/)
|
||||
* 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
|
||||
* 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
|
||||
* **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 fix the issues
|
||||
- Example prompt: "I received the following feedback from [Tool Name]. Please help me understand these issues and suggest fixes: [Paste the tool output here]"
|
||||
* 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 fix the issues
|
||||
* Example prompt: "I received the following feedback from [Tool Name]. Please help me understand these issues and suggest fixes: [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
|
||||
* 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
|
||||
|
||||
|
||||
@@ -8,40 +8,40 @@ This plugin follows the [WordPress Coding Standards](https://developer.wordpress
|
||||
|
||||
### 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
|
||||
* 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
|
||||
* **Classes**: Use `PascalCase` for class names
|
||||
```php
|
||||
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
|
||||
function my_function_name() {}
|
||||
public function my_method_name() {}
|
||||
```
|
||||
|
||||
- **Variables**: Use `snake_case` for variable names
|
||||
* **Variables**: Use `snake_case` for variable names
|
||||
```php
|
||||
$my_variable_name = 'value';
|
||||
```
|
||||
|
||||
- **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
|
||||
* **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
|
||||
```php
|
||||
define('MY_CONSTANT', 'value');
|
||||
const MY_CLASS_CONSTANT = 'value';
|
||||
```
|
||||
|
||||
- **Namespaces**: Use `PascalCase` for namespace segments
|
||||
* **Namespaces**: Use `PascalCase` for namespace segments
|
||||
```php
|
||||
namespace WPALLSTARS\PluginStarterTemplate;
|
||||
```
|
||||
|
||||
- **Hooks**: Prefix hooks with the plugin's prefix
|
||||
* **Hooks**: Prefix hooks with the plugin's prefix
|
||||
```php
|
||||
do_action('wpst_hook_name');
|
||||
apply_filters('wpst_filter_name', $value);
|
||||
@@ -49,10 +49,10 @@ This plugin follows the [WordPress Coding Standards](https://developer.wordpress
|
||||
|
||||
### 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
|
||||
* 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) {
|
||||
@@ -66,8 +66,8 @@ if ($condition) {
|
||||
|
||||
### Documentation
|
||||
|
||||
- All classes, methods, and functions should be documented using PHPDoc
|
||||
- Include a description, parameters, return values, and exceptions
|
||||
* All classes, methods, and functions should be documented using PHPDoc
|
||||
* Include a description, parameters, return values, and exceptions
|
||||
|
||||
```php
|
||||
/**
|
||||
@@ -87,9 +87,9 @@ function my_function($param1, $param2) {
|
||||
|
||||
### 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
|
||||
* 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 {
|
||||
@@ -118,22 +118,22 @@ This plugin follows the [WordPress JavaScript Coding Standards](https://develope
|
||||
|
||||
### Naming Conventions
|
||||
|
||||
- **Variables and Functions**: Use `camelCase` for variable and function names
|
||||
* **Variables and Functions**: Use `camelCase` for variable and function names
|
||||
```javascript
|
||||
var myVariableName = 'value';
|
||||
function myFunctionName() {}
|
||||
```
|
||||
|
||||
- **Constants**: Use `UPPERCASE_WITH_UNDERSCORES` for constants
|
||||
* **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
|
||||
* 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) {
|
||||
@@ -147,7 +147,7 @@ if (condition) {
|
||||
|
||||
### Documentation
|
||||
|
||||
- Use JSDoc for documenting functions and objects
|
||||
* Use JSDoc for documenting functions and objects
|
||||
|
||||
```javascript
|
||||
/**
|
||||
@@ -168,9 +168,9 @@ This plugin follows the [WordPress CSS Coding Standards](https://developer.wordp
|
||||
|
||||
### 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
|
||||
* 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 {
|
||||
@@ -184,11 +184,11 @@ This plugin follows the [WordPress CSS Coding Standards](https://developer.wordp
|
||||
|
||||
### 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
|
||||
* 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 {
|
||||
@@ -229,54 +229,55 @@ This plugin uses automated tools to enforce coding standards:
|
||||
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/)
|
||||
* 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/)
|
||||
* 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/)
|
||||
* 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/)
|
||||
* 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
|
||||
* 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
|
||||
* **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 fix the issues
|
||||
- Example prompt: "I received the following feedback from [Tool Name]. Please help me understand these issues and suggest fixes: [Paste the tool output here]"
|
||||
* 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 fix the issues
|
||||
* Example prompt: "I received the following feedback from [Tool Name]. Please help me understand these issues and suggest fixes: [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
|
||||
* 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user