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
This commit is contained in:
2
.github/workflows/code-quality.yml
vendored
2
.github/workflows/code-quality.yml
vendored
@@ -149,4 +149,4 @@ jobs:
|
|||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v3
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -333,31 +333,37 @@ For code quality tools like SonarCloud, organization secrets are recommended if
|
|||||||
To run code quality tools locally before committing to GitHub:
|
To run code quality tools locally before committing to GitHub:
|
||||||
|
|
||||||
1. **Install dependencies**:
|
1. **Install dependencies**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer install
|
composer install
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Run PHP CodeSniffer**:
|
2. **Run PHP CodeSniffer**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer phpcs
|
composer phpcs
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Fix coding standards automatically**:
|
3. **Fix coding standards automatically**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer phpcbf
|
composer phpcbf
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Run PHPStan static analysis**:
|
4. **Run PHPStan static analysis**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer phpstan
|
composer phpstan
|
||||||
```
|
```
|
||||||
|
|
||||||
5. **Run PHP Mess Detector**:
|
5. **Run PHP Mess Detector**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer phpmd
|
composer phpmd
|
||||||
```
|
```
|
||||||
|
|
||||||
6. **Run all linters at once**:
|
6. **Run all linters at once**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer lint
|
composer lint
|
||||||
```
|
```
|
||||||
@@ -386,19 +392,21 @@ To run code quality tools locally before committing to GitHub:
|
|||||||
|
|
||||||
8. **Create a .env file** (alternative approach):
|
8. **Create a .env file** (alternative approach):
|
||||||
|
|
||||||
```bash
|
```env
|
||||||
# .env (already included in .gitignore to prevent committing secrets)
|
# .env (already included in .gitignore to prevent committing secrets)
|
||||||
SONAR_TOKEN=your_sonar_token
|
SONAR_TOKEN=your_sonar_token
|
||||||
CODACY_PROJECT_TOKEN=your_codacy_token
|
CODACY_PROJECT_TOKEN=your_codacy_token
|
||||||
```
|
```
|
||||||
|
|
||||||
Then load these variables:
|
Then load these variables:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Using a tool like dotenv
|
# Using a tool like dotenv
|
||||||
source .env
|
source .env
|
||||||
```
|
```
|
||||||
|
|
||||||
9. **Run SonarCloud locally**:
|
9. **Run SonarCloud locally**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install SonarScanner
|
# Install SonarScanner
|
||||||
npm install -g sonarqube-scanner
|
npm install -g sonarqube-scanner
|
||||||
@@ -413,6 +421,7 @@ To run code quality tools locally before committing to GitHub:
|
|||||||
```
|
```
|
||||||
|
|
||||||
10. **Run Codacy locally**:
|
10. **Run Codacy locally**:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install Codacy CLI
|
# Install Codacy CLI
|
||||||
npm install -g codacy-coverage
|
npm install -g codacy-coverage
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ This document explains how to set up and use the code quality tools for this pro
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Clone the repository:
|
1. Clone the repository:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding.git
|
git clone https://github.com/wpallstars/wp-plugin-starter-template-for-ai-coding.git
|
||||||
cd wp-plugin-starter-template-for-ai-coding
|
cd wp-plugin-starter-template-for-ai-coding
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Install dependencies:
|
2. Install dependencies:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
composer install
|
composer install
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ parameters:
|
|||||||
- '#Function apply_filters invoked with [0-9]+ parameters, 2 required.#'
|
- '#Function apply_filters invoked with [0-9]+ parameters, 2 required.#'
|
||||||
- '#Function [a-zA-Z0-9_]+ not found.#'
|
- '#Function [a-zA-Z0-9_]+ not found.#'
|
||||||
- '#Call to static method [a-zA-Z0-9_:()]+ on an unknown class [a-zA-Z0-9_]+.#'
|
- '#Call to static method [a-zA-Z0-9_:()]+ on an unknown class [a-zA-Z0-9_]+.#'
|
||||||
|
|
||||||
includes:
|
|
||||||
- vendor/szepeviktor/phpstan-wordpress/extension.neon
|
|
||||||
- '#Function do_action invoked with [0-9]+ parameters, 1 required.#'
|
- '#Function do_action invoked with [0-9]+ parameters, 1 required.#'
|
||||||
- '#Function add_action invoked with [0-9]+ parameters, 2 required.#'
|
- '#Function add_action invoked with [0-9]+ parameters, 2 required.#'
|
||||||
- '#Function add_filter invoked with [0-9]+ parameters, 2 required.#'
|
- '#Function add_filter invoked with [0-9]+ parameters, 2 required.#'
|
||||||
reportUnmatchedIgnoredErrors: false
|
reportUnmatchedIgnoredErrors: false
|
||||||
|
|
||||||
|
includes:
|
||||||
|
- vendor/szepeviktor/phpstan-wordpress/extension.neon
|
||||||
|
|||||||
Reference in New Issue
Block a user