Fix Markdown formatting issues in code-quality-checks.md
- Added blank lines around fenced code blocks - Changed list markers from dashes to asterisks for consistency - Added language specification to code blocks - Fixed Markdown linting issues
This commit is contained in:
@@ -7,33 +7,43 @@ This document outlines the process for ensuring code quality before pushing chan
|
|||||||
Before pushing your changes to the repository, run through the following checks:
|
Before pushing your changes to the repository, run through the following checks:
|
||||||
|
|
||||||
1. **Run Unit Tests**
|
1. **Run Unit Tests**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer test
|
composer test
|
||||||
```
|
```
|
||||||
|
|
||||||
Ensure all tests pass. If any tests fail, fix the issues before proceeding.
|
Ensure all tests pass. If any tests fail, fix the issues before proceeding.
|
||||||
|
|
||||||
2. **Run PHP CodeSniffer**
|
2. **Run PHP CodeSniffer**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer phpcs
|
composer phpcs
|
||||||
```
|
```
|
||||||
|
|
||||||
This will check your code against WordPress coding standards. Fix any issues before proceeding.
|
This will check your code against WordPress coding standards. Fix any issues before proceeding.
|
||||||
|
|
||||||
3. **Run PHP Code Beautifier and Fixer**
|
3. **Run PHP Code Beautifier and Fixer**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer phpcbf
|
composer phpcbf
|
||||||
```
|
```
|
||||||
|
|
||||||
This will automatically fix many coding standard issues.
|
This will automatically fix many coding standard issues.
|
||||||
|
|
||||||
4. **Run PHPStan**
|
4. **Run PHPStan**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer phpstan
|
composer phpstan
|
||||||
```
|
```
|
||||||
|
|
||||||
This will perform static analysis on your code to find potential bugs and issues.
|
This will perform static analysis on your code to find potential bugs and issues.
|
||||||
|
|
||||||
5. **Run PHP Mess Detector**
|
5. **Run PHP Mess Detector**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer phpmd
|
composer phpmd
|
||||||
```
|
```
|
||||||
|
|
||||||
This will check for potential problems like unused variables, empty catch blocks, etc.
|
This will check for potential problems like unused variables, empty catch blocks, etc.
|
||||||
|
|
||||||
## Common Issues and How to Fix Them
|
## Common Issues and How to Fix Them
|
||||||
@@ -103,9 +113,9 @@ function_name( $param1, $param2 );
|
|||||||
|
|
||||||
Follow WordPress naming conventions:
|
Follow WordPress naming conventions:
|
||||||
|
|
||||||
- Functions and variables: snake_case
|
* Functions and variables: snake_case
|
||||||
- Classes: CamelCase
|
* Classes: CamelCase
|
||||||
- Constants: UPPERCASE_WITH_UNDERSCORES
|
* Constants: UPPERCASE_WITH_UNDERSCORES
|
||||||
|
|
||||||
## Automated Checks in CI/CD
|
## Automated Checks in CI/CD
|
||||||
|
|
||||||
@@ -128,7 +138,8 @@ You can use AI assistants to help improve code quality:
|
|||||||
4. Run the checks again to verify the issues are resolved
|
4. Run the checks again to verify the issues are resolved
|
||||||
|
|
||||||
Example prompt:
|
Example prompt:
|
||||||
```
|
|
||||||
|
```text
|
||||||
I ran PHPCS and got the following errors. Can you help me fix them?
|
I ran PHPCS and got the following errors. Can you help me fix them?
|
||||||
|
|
||||||
[Paste error output here]
|
[Paste error output here]
|
||||||
|
|||||||
Reference in New Issue
Block a user