Skip to content

Change deprecated PHPStan ignore parameter #783

Change deprecated PHPStan ignore parameter

Change deprecated PHPStan ignore parameter #783

name: Coding Standards
on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]
paths:
# Any change to a PHP, JavaScript, CSS/SCSS or Markdown file should run checks.
- '**.js'
- '**.php'
- '**.*css'
- '**.md'
# These files configure NPM. Changes could affect the outcome.
- 'package*.json'
# These files configure Composer. Changes could affect the outcome.
- 'composer.*'
# This file configures ESLint. Changes could affect the outcome.
- '.eslintrc.json'
# This file configures Stylelint. Changes could affect the outcome.
- '.stylelintrc.json'
# This file configures Markdownlint. Changes could affect the outcome.
- '.markdownlint.json'
# This file configures PHPCS. Changes could affect the outcome.
- 'phpcs.xml.dist'
# Changes to workflow files should always verify all workflows are successful.
- '.github/workflows/*.yml'
# Allows you to run this workflow manually from the Actions tab.
workflow_dispatch:
jobs:
# Runs PHP compatibility check.
#
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
# - Logs debug information about the runner container.
# - Installs Composer dependencies (use cache if possible).
# - Logs PHP_CodeSniffer debug information.
# - Runs the PHP compatibility tests.
php-compatibility:
name: PHP compatibility
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/[email protected]
with:
php-version: '7.4' # Results are the same across all versions, check only in the last stable version.
coverage: none
env:
fail-fast: false
- name: Log debug information
run: |
php --version
composer --version
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
- name: Log PHPCS debug information
run: composer phpcs-i
- name: Run PHP compatibility tests
run: composer compat:php
# Runs PHP coding standards checks.
#
# Violations are reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Sets up PHP.
# - Logs debug information.
# - Installs Composer dependencies (use cache if possible).
# - Make Composer packages available globally.
# - Logs PHP_CodeSniffer debug information.
# - Runs PHPCS on the full codebase.
php-cs:
name: PHP coding standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/[email protected]
with:
php-version: '7.4' # Results are the same across all versions, check only in the last stable version.
coverage: none
tools: cs2pr
env:
fail-fast: false
- name: Log debug information
run: |
php --version
composer --version
- name: Check syntax error in sources
run: find -L . -path ./vendor -prune -o -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Install Composer dependencies
uses: ramsey/composer-install@v3
- name: Make Composer packages available globally
run: echo "${PWD}/vendor/bin" >> $GITHUB_PATH
- name: Log PHPCS debug information
run: composer phpcs-i
- name: Run the PHP code sniffer
continue-on-error: true
run: phpcs --report-full --report-checkstyle=./phpcs-report.xml
- name: Show PHPCS results in PR
run: cs2pr ./phpcs-report.xml
# Runs the JavaScript coding standards checks.
#
# JS violations are not currently reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Installs NodeJS 16 with caching for NPM.
# - Logs updated debug information.
# - Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Run the WordPress ESLint checks.
js-cs:
name: JavaScript coding standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
cache: npm
- name: Log debug information
run: |
npm --version
node --version
- name: Install Dependencies
run: npm ci
- name: Run JavaScript Lint
run: npm run lint:js
# Runs the CSS/SCSS coding standards checks.
#
# CSS violations are not currently reported inline with annotations.
#
# Performs the following steps:
# - Checks out the repository.
# - Installs NodeJS 16 with caching for NPM.
# - Logs updated debug information.
# - Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Run the WordPress Stylelint checks.
css-cs:
name: CSS/SCSS coding standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
cache: npm
- name: Log debug information
run: |
npm --version
node --version
- name: Install Dependencies
run: npm ci
- name: Run CSS/SCSS Lint
run: npm run lint:css
# Runs the Markdown coding standards checks.
#
# Performs the following steps:
# - Checks out the repository.
# - Installs NodeJS 16 with caching for NPM.
# - Logs updated debug information.
# - Installs NPM dependencies using install-changed to hash the `package.json` file.
# - Run the WordPress Markdownlint checks.
md-cs:
name: Markdown coding standards
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 16
cache: npm
- name: Log debug information
run: |
npm --version
node --version
- name: Install Dependencies
run: npm ci
- name: Run Markdown Lint
run: npm run lint:md:docs