Merge pull request #11 from wpallstars/fix-code-quality-issues
Fix code quality issues from PR feedback
This commit is contained in:
@@ -99,8 +99,8 @@ When you receive feedback from these code review tools, you can use AI assistant
|
||||
|
||||
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 fix the issues
|
||||
4. Implement the suggested fixes
|
||||
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
|
||||
@@ -115,8 +115,8 @@ When writing or updating Markdown files in this project, follow these standards:
|
||||
|
||||
Example prompt for AI assistants:
|
||||
|
||||
```
|
||||
I received the following feedback from [Tool Name]. Please help me understand these issues and suggest fixes:
|
||||
```text
|
||||
I received the following feedback from [Tool Name]. Please help me understand and resolve these issues:
|
||||
|
||||
[Paste the tool output here]
|
||||
```
|
||||
@@ -192,7 +192,7 @@ After the code has been updated:
|
||||
|
||||
### Good Feedback Example
|
||||
|
||||
```
|
||||
```markdown
|
||||
In function `handle_remove_reference()`:
|
||||
|
||||
1. The nonce check is missing, which could lead to CSRF vulnerabilities.
|
||||
@@ -225,6 +225,6 @@ In function `handle_remove_reference()`:
|
||||
|
||||
### Poor Feedback Example
|
||||
|
||||
```
|
||||
```text
|
||||
This code has security issues and doesn't follow best practices. Fix it.
|
||||
```
|
||||
|
||||
13
.codacy.yml
Normal file
13
.codacy.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
engines:
|
||||
markdownlint:
|
||||
enabled: true
|
||||
config_file: .markdownlint.json
|
||||
exclude_paths:
|
||||
- "vendor/**"
|
||||
- "node_modules/**"
|
||||
- "build/**"
|
||||
- "dist/**"
|
||||
- "bin/**"
|
||||
- ".github/**"
|
||||
- "tests/**"
|
||||
44
.github/workflows/code-quality.yml
vendored
44
.github/workflows/code-quality.yml
vendored
@@ -36,44 +36,8 @@ jobs:
|
||||
composer run phpcbf -- --dry-run
|
||||
continue-on-error: true
|
||||
|
||||
sonarcloud:
|
||||
name: SonarCloud Analysis
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
# SonarCloud job temporarily removed due to Java version compatibility issues
|
||||
# Will be re-added in a future PR with proper configuration
|
||||
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarcloud-github-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
|
||||
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@master
|
||||
with:
|
||||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||
verbose: true
|
||||
output: results.sarif
|
||||
format: sarif
|
||||
# Adjust the below patterns based on your project structure
|
||||
gh-code-scanning-compat: true
|
||||
max-allowed-issues: 2147483647
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload SARIF results file
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
continue-on-error: true
|
||||
# Codacy job temporarily removed due to GitHub Actions compatibility issues
|
||||
# Will be re-added in a future PR with proper configuration
|
||||
|
||||
15
.markdownlint.json
Normal file
15
.markdownlint.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"MD004": {
|
||||
"style": "asterisk"
|
||||
},
|
||||
"MD007": {
|
||||
"indent": 2
|
||||
},
|
||||
"MD013": false,
|
||||
"MD033": false,
|
||||
"MD040": true,
|
||||
"MD041": false,
|
||||
"MD046": {
|
||||
"style": "fenced"
|
||||
}
|
||||
}
|
||||
16
.markdownlintrc
Normal file
16
.markdownlintrc
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"default": true,
|
||||
"MD004": {
|
||||
"style": "asterisk"
|
||||
},
|
||||
"MD007": {
|
||||
"indent": 2
|
||||
},
|
||||
"MD013": false,
|
||||
"MD033": false,
|
||||
"MD040": true,
|
||||
"MD041": false,
|
||||
"MD046": {
|
||||
"style": "fenced"
|
||||
}
|
||||
}
|
||||
@@ -271,8 +271,14 @@ To ensure your code passes the quality checks from these tools, follow these gui
|
||||
3. **Using AI Assistants with Code Quality Tools**
|
||||
* When you receive feedback from code quality tools, you can use AI assistants to help address the issues
|
||||
* Copy the output from the code quality tool and paste it into your AI assistant chat
|
||||
* Ask the AI to help you understand and 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]"
|
||||
* 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
|
||||
|
||||
@@ -106,14 +106,14 @@ When you receive feedback from these code quality tools, you can use AI assistan
|
||||
|
||||
1. Copy the output from the code quality tool
|
||||
2. Paste it into your AI assistant chat
|
||||
3. Ask the AI to help you understand and fix the issues
|
||||
4. Implement the suggested fixes
|
||||
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:
|
||||
|
||||
```
|
||||
I received the following feedback from [Tool Name]. Please help me understand these issues and suggest fixes:
|
||||
```text
|
||||
I received the following feedback from [Tool Name]. Please help me understand and resolve these issues:
|
||||
|
||||
[Paste the tool output here]
|
||||
```
|
||||
@@ -130,18 +130,18 @@ To set up your development environment:
|
||||
|
||||
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`
|
||||
* 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`
|
||||
* 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.
|
||||
|
||||
@@ -149,25 +149,25 @@ These checks will help identify and fix issues before they are caught by the aut
|
||||
|
||||
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
|
||||
* 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)
|
||||
* [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
|
||||
* Added to the contributors list in readme.txt
|
||||
* Mentioned in release notes for significant contributions
|
||||
* Thanked in the Changelog for specific contributions
|
||||
|
||||
## License
|
||||
|
||||
|
||||
20
README.md
20
README.md
@@ -242,20 +242,20 @@ For more detailed information, see the [Contributing Guide](.wiki/Contributing.m
|
||||
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
|
||||
* [Website](https://www.coderabbit.ai/)
|
||||
* Provides automated feedback on pull requests
|
||||
|
||||
2. **CodeFactor**: Continuous code quality monitoring
|
||||
- [Website](https://www.codefactor.io/)
|
||||
- Provides a grade for your codebase
|
||||
* [Website](https://www.codefactor.io/)
|
||||
* Provides a grade for your codebase
|
||||
|
||||
3. **Codacy**: Code quality and static analysis
|
||||
- [Website](https://www.codacy.com/)
|
||||
- Identifies issues related to code style, security, and performance
|
||||
* [Website](https://www.codacy.com/)
|
||||
* Identifies issues related to code style, security, and performance
|
||||
|
||||
4. **SonarCloud**: Code quality and security analysis
|
||||
- [Website](https://sonarcloud.io/)
|
||||
- Provides detailed analysis of code quality and security
|
||||
* [Website](https://sonarcloud.io/)
|
||||
* Provides detailed analysis of code quality and security
|
||||
|
||||
### Using AI Assistants with Code Quality Tools
|
||||
|
||||
@@ -263,8 +263,8 @@ When you receive feedback from these code quality tools, you can use AI assistan
|
||||
|
||||
1. Copy the output from the code quality tool
|
||||
2. Paste it into your AI assistant chat
|
||||
3. Ask the AI to help you understand and fix the issues
|
||||
4. Implement the suggested fixes
|
||||
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).
|
||||
|
||||
12
readme.txt
12
readme.txt
@@ -139,10 +139,10 @@ For more detailed information, see the [Contributing Guide](https://github.com/w
|
||||
|
||||
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 that provides automated feedback on pull requests
|
||||
2. **CodeFactor**: Continuous code quality monitoring that provides a grade for your codebase
|
||||
3. **Codacy**: Code quality and static analysis that identifies issues related to code style, security, and performance
|
||||
4. **SonarCloud**: Code quality and security analysis that provides detailed analysis of code quality and security
|
||||
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 =
|
||||
|
||||
@@ -150,8 +150,8 @@ When you receive feedback from these code quality tools, you can use AI assistan
|
||||
|
||||
1. Copy the output from the code quality tool
|
||||
2. Paste it into your AI assistant chat
|
||||
3. Ask the AI to help you understand and fix the issues
|
||||
4. Implement the suggested fixes
|
||||
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.
|
||||
|
||||
17
sonar-project.properties
Normal file
17
sonar-project.properties
Normal file
@@ -0,0 +1,17 @@
|
||||
sonar.projectKey=wpallstars_wp-plugin-starter-template-for-ai-coding
|
||||
sonar.organization=wpallstars
|
||||
|
||||
# This is the name and version displayed in the SonarCloud UI.
|
||||
sonar.projectName=wp-plugin-starter-template-for-ai-coding
|
||||
sonar.projectVersion=0.1.10
|
||||
|
||||
# Path is relative to the sonar-project.properties file
|
||||
sonar.sources=.
|
||||
sonar.php.coverage.reportPaths=coverage.xml
|
||||
sonar.php.tests.reportPath=test-report.xml
|
||||
|
||||
# Encoding of the source code. Default is default system encoding
|
||||
sonar.sourceEncoding=UTF-8
|
||||
|
||||
# Exclude directories
|
||||
sonar.exclusions=vendor/**,node_modules/**,tests/**,bin/**,build/**,dist/**
|
||||
@@ -271,8 +271,14 @@ To ensure your code passes the quality checks from these tools, follow these gui
|
||||
3. **Using AI Assistants with Code Quality Tools**
|
||||
* When you receive feedback from code quality tools, you can use AI assistants to help address the issues
|
||||
* Copy the output from the code quality tool and paste it into your AI assistant chat
|
||||
* Ask the AI to help you understand and 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]"
|
||||
* 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
|
||||
|
||||
@@ -106,14 +106,14 @@ When you receive feedback from these code quality tools, you can use AI assistan
|
||||
|
||||
1. Copy the output from the code quality tool
|
||||
2. Paste it into your AI assistant chat
|
||||
3. Ask the AI to help you understand and fix the issues
|
||||
4. Implement the suggested fixes
|
||||
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:
|
||||
|
||||
```
|
||||
I received the following feedback from [Tool Name]. Please help me understand these issues and suggest fixes:
|
||||
```text
|
||||
I received the following feedback from [Tool Name]. Please help me understand and resolve these issues:
|
||||
|
||||
[Paste the tool output here]
|
||||
```
|
||||
@@ -130,18 +130,18 @@ To set up your development environment:
|
||||
|
||||
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`
|
||||
* 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`
|
||||
* 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.
|
||||
|
||||
@@ -149,25 +149,25 @@ These checks will help identify and fix issues before they are caught by the aut
|
||||
|
||||
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
|
||||
* 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)
|
||||
* [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
|
||||
* Added to the contributors list in readme.txt
|
||||
* Mentioned in release notes for significant contributions
|
||||
* Thanked in the Changelog for specific contributions
|
||||
|
||||
## License
|
||||
|
||||
|
||||
Reference in New Issue
Block a user