diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml
new file mode 100644
index 00000000..580c33a9
--- /dev/null
+++ b/.github/workflows/cs.yml
@@ -0,0 +1,59 @@
+name: CS
+
+on:
+ # Run on all pushes (except to main) and on all pull requests.
+ push:
+ branches-ignore:
+ - 'master'
+ pull_request:
+ # Allow manually triggering the workflow.
+ workflow_dispatch:
+
+# Cancels all previous workflow runs for the same branch that have not yet completed.
+concurrency:
+ # The concurrency group contains the workflow name and the branch name.
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ checkcs:
+ name: 'Check code style'
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Run custom composer script
+ run: ./run-composer.sh
+
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: '7.4'
+ coverage: none
+ tools: cs2pr
+
+ # Validate the composer.json file.
+ # @link https://getcomposer.org/doc/03-cli.md#validate
+ - name: Validate Composer installation
+ run: composer validate --no-check-all
+
+ # Install dependencies and handle caching in one go.
+ # @link https://github.com/marketplace/actions/install-composer-dependencies
+ - name: Install Composer dependencies
+ uses: ramsey/composer-install@v2
+ with:
+ # Bust the cache at least once a month - output format: YYYY-MM-DD.
+ custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")
+
+ # Check the codestyle of the files.
+ # The results of the CS check will be shown inline in the PR via the CS2PR tool.
+ # @link https://github.com/staabm/annotate-pull-request-from-checkstyle/
+ - name: Check PHP code style
+ id: phpcs
+ run: composer check-cs -- --report-full --report-checkstyle=./phpcs-report.xml --ignore=vendor
+
+ - name: Show PHPCS results in PR
+ if: ${{ always() && steps.phpcs.outcome == 'failure' }}
+ run: cs2pr ./phpcs-report.xml
\ No newline at end of file
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 00000000..ac3aec41
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,59 @@
+name: Lint
+
+on:
+ # Run on pushes to select branches and on all pull requests.
+ push:
+ branches:
+ - master
+ - develop
+ - trunk
+ - 'feature/**'
+ - 'release/**'
+ - 'hotfix/[0-9]+.[0-9]+*'
+ pull_request:
+ # Allow manually triggering the workflow.
+ workflow_dispatch:
+
+# Cancels all previous workflow runs for the same branch that have not yet completed.
+concurrency:
+ # The concurrency group contains the workflow name and the branch name.
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ # Lint against the highest/lowest supported versions of each PHP major.
+ # And also do a run against "nightly" (the current dev version of PHP).
+ php_version: ['7.4', '8.0', '8.1', '8.2']
+
+ name: "Lint: PHP ${{ matrix.php_version }}"
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: Run custom composer script
+ run: ./run-composer.sh
+
+ - name: Install PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php_version }}
+ ini-values: zend.assertions=1, error_reporting=-1, display_errors=On
+ coverage: none
+ tools: cs2pr
+
+ # Install dependencies and handle caching in one go.
+ # @link https://github.com/marketplace/actions/install-composer-dependencies
+ - name: Install Composer dependencies
+ uses: ramsey/composer-install@v2
+ with:
+ # Bust the cache at least once a month - output format: YYYY-MM-DD.
+ custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")
+
+ - name: Lint against parse errors
+ run: composer lint -- --checkstyle | cs2pr
\ No newline at end of file
diff --git a/composer.json b/composer.json
index d65a523d..b7f82e35 100644
--- a/composer.json
+++ b/composer.json
@@ -1,9 +1,17 @@
{
"name": "equalizedigital/accesibility-checker",
+ "description": "Audit and check your website for accessibility before you hit publish. In-post accessibility scanner and guidance.",
+ "keywords": [
+ "accessibility",
+ "accessible",
+ "wcag"
+ ],
+ "homepage": "https://equalizedigital.com/accessibility-checker/",
+ "license": "GPL-3.0-or-later",
"authors": [
{
- "name": "Steve Jones",
- "email": "dev@equalizedigital.com"
+ "name": "Equalize Digital",
+ "homepage": "https://equalizedigital.com"
}
],
"config": {
@@ -24,11 +32,33 @@
"require-dev": {
"automattic/vipwpcs": "^3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2",
- "equalizedigital/accessibility-checker-wp-env": "dev-main#2d6218b193e089baeb1848f8b9935c22343cbaa0",
- "phpcompatibility/php-compatibility": "*"
+ "phpcompatibility/php-compatibility": "*",
+ "yoast/wp-test-utils": "^1.1.1",
+ "php-parallel-lint/php-parallel-lint": "^1.3",
+ "equalizedigital/accessibility-checker-wp-env": "1.0.0"
},
"require": {
"cbschuld/browser.php": "^1.9",
- "davechild/textstatistics": "1.0.2"
+ "davechild/textstatistics": "1.0.2",
+ "php": ">=7.4",
+ "composer/installers": "^1.12.0"
+ },
+ "scripts": {
+ "lint": [
+ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude node_modules --exclude .git"
+ ],
+ "config-yoastcs": [
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin::run",
+ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --config-set default_standard Yoast"
+ ],
+ "check-cs": [
+ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 7.4-"
+ ],
+ "fix-cs": [
+ "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf"
+ ],
+ "test": [
+ "@php ./vendor/phpunit/phpunit/phpunit"
+ ]
}
}
diff --git a/package.json b/package.json
index 1386c5e3..5d5c7e4c 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
"hard-reset": "./hard-reset.sh",
"wp:clean": "npx wp-env clean all",
"wp:sql": "npx wp-env run cli wp db cli",
- "start": "npx wp-env start",
+ "start": "./run-composer.sh && npx wp-env start",
"stop": "npx wp-env stop",
"build": "npx webpack",
"dev": "npx webpack --watch --mode development",
diff --git a/phpcs.xml b/phpcs.xml
index 03138f2a..cece5245 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -9,6 +9,9 @@
./dist/
./vendor/
./node_modules/
+ ./.wp-env/
+ ./simple_html_dom.php
+ ./update-composer-config.php
diff --git a/run-composer.sh b/run-composer.sh
new file mode 100755
index 00000000..439efaa5
--- /dev/null
+++ b/run-composer.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+php update-composer-config.php
+
+composer update
\ No newline at end of file
diff --git a/update-composer-config.php b/update-composer-config.php
new file mode 100644
index 00000000..ddafbd83
--- /dev/null
+++ b/update-composer-config.php
@@ -0,0 +1,24 @@
+