-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-enable PHP Code Quality Checks in Github Actions #724
Comments
How to begin @coderabbitai? |
Tip For best results, initiate chat on the files or code changes. @ThomasAFink Based on the analysis of the repository, I'll help you get started with re-enabling PHP code quality checks. Here's a step-by-step plan:
Here's how to implement this: # .github/workflows/code-quality.yaml
name: code quality
on:
workflow_call:
jobs:
php-quality:
runs-on: ubuntu-latest
container:
image: "registry.gitlab.com/eappointment/php-base:${{ matrix.php_version }}-dev"
steps:
- name: Checkout GitHub Action
uses: actions/checkout@main
- name: Install Composer Dependencies
run: |
cd "${{ matrix.module }}"
composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run PHP_CodeSniffer
run: |
cd "${{ matrix.module }}"
./vendor/bin/phpcs --standard=PSR12 src/
- name: Run PHP Mess Detector
run: |
cd "${{ matrix.module }}"
./vendor/bin/phpmd src/ text phpmd.rules.xml
strategy:
fail-fast: false
matrix:
include:
- module: zmsadmin
php_version: "8.0"
- module: zmscalldisplay
php_version: "8.0"
- module: zmsdldb
php_version: "8.0"
- module: zmsentities
php_version: "8.0"
- module: zmsmessaging
php_version: "8.0"
- module: zmsslim
php_version: "8.0"
- module: zmsstatistic
php_version: "8.0"
- module: zmsticketprinter
php_version: "8.0"
name: Combined Workflow
on: [push]
jobs:
call-code-quality:
uses: ./.github/workflows/code-quality.yaml
call-unit-tests:
needs: call-code-quality
uses: ./.github/workflows/unit-tests.yaml
call-build-images:
needs: call-unit-tests
uses: ./.github/workflows/build-images.yaml
a. Add these dependencies to each module's {
"require-dev": {
"squizlabs/php_codesniffer": "^3.7",
"phpmd/phpmd": "^2.13"
}
} b. Run composer update in each module to install the tools: ddev ssh
cd <module-name>
composer update c. Test locally using: ddev ssh
cd <module-name>
vendor/bin/phpcs --standard=PSR12 src/
vendor/bin/phpmd src/ text phpmd.rules.xml
## Code Quality Checks
Run PHP CodeSniffer (PSR-12):
```bash
ddev ssh
cd <module-name>
vendor/bin/phpcs --standard=PSR12 src/ Run PHP Mess Detector: ddev ssh
cd <module-name>
vendor/bin/phpmd src/ text phpmd.rules.xml Would you like me to help you with implementing any specific part of this plan? We can:
Let me know which part you'd like to tackle first! 🔗 Analysis chainLet me help you get started with re-enabling PHP code quality checks in GitHub Actions. First, I'll examine the current workflow files and PHP modules to understand the existing setup. Let me analyze the workflow files and PHP module structure to provide you with a step-by-step plan for implementing the code quality checks. 🏁 Scripts executedThe following scripts were executed for the analysis: Script:
Length of output: 12617 |
We should run code quality checks and unit tests in parallel. If either workflow fails don't allow the images to be built. @coderabbitai |
Tip For best results, initiate chat on the files or code changes. @ThomasAFink I'll help you modify the workflow to run code quality checks and unit tests in parallel. Here's the updated workflow configuration: # .github/workflows/combined-workflow.yaml
name: Combined Workflow
on: [push]
jobs:
call-code-quality:
uses: ./.github/workflows/code-quality.yaml
call-unit-tests:
uses: ./.github/workflows/unit-tests.yaml
call-build-images:
needs: [call-code-quality, call-unit-tests]
uses: ./.github/workflows/build-images.yaml The key changes are:
This configuration will:
Would you like me to help you with implementing any other changes to the workflow? (`・ω・´)ゞ ✏️ Learnings added
|
Task Description
Currently, the code quality checks with phpcs and phpmd are deactivated in the GitHub Actions. These checks should be reactivated to ensure compliance with coding standards and to identify potential code issues.
The checks should be executed before the unit tests for each PHP module.
Background Information / Details for Implementation
PHP_CodeSniffer (phpcs):
PHP Mess Detector (phpmd):
phpmd.rules.xml
.GitHub Actions Workflows Directory
Acceptance Criteria
zmsadmin
zmscalldisplay
zmscitizenapi
zmsdldb
zmsentities
zmsmessaging
zmsslim
zmsstatistic
zmsticketprinter
next
).README.md
should include instructions on how to execute them withddev ssh
.Ask @coderabbitai on how to get started.
The text was updated successfully, but these errors were encountered: