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:
2025-04-21 14:57:19 +01:00
parent ad30d716db
commit 398d24ed90
4 changed files with 16 additions and 5 deletions

View File

@@ -149,4 +149,4 @@ jobs:
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
continue-on-error: true
continue-on-error: true

View File

@@ -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:
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
```
@@ -386,19 +392,21 @@ To run code quality tools locally before committing to GitHub:
8. **Create a .env file** (alternative approach):
```bash
```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
@@ -413,6 +421,7 @@ To run code quality tools locally before committing to GitHub:
```
10. **Run Codacy locally**:
```bash
# Install Codacy CLI
npm install -g codacy-coverage

View File

@@ -10,12 +10,14 @@ This document explains how to set up and use the code quality tools for this pro
## 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
```

View File

@@ -16,10 +16,10 @@ parameters:
- '#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_]+.#'
includes:
- vendor/szepeviktor/phpstan-wordpress/extension.neon
- '#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