Skip to content

Commit

Permalink
Merge pull request #566 from WordPress/486-check-calling-remote-files…
Browse files Browse the repository at this point in the history
…-js-css-images-etc-offloading-external

Add new `Offloading_Files_Check` check
  • Loading branch information
ernilambar authored Sep 23, 2024
2 parents aaad52b + 629ba2c commit f43dd53
Show file tree
Hide file tree
Showing 26 changed files with 3,277 additions and 144 deletions.
2 changes: 2 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ build-phpunit
docs
node_modules
patches
# Distributed via vendor/plugin-check/phpcs-sniffs instead
/phpcs-sniffs/
tests

*.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install PHP dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a
with:
composer-options: '--prefer-dist --no-progress --no-interaction --no-dev'
composer-options: '--prefer-dist --no-dev'

- name: WordPress Plugin Deploy
id: deploy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Install PHP dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a
with:
composer-options: '--prefer-dist --no-progress --no-interaction'
composer-options: '--prefer-dist'

- name: PHP Lint
run: composer lint
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,51 @@ jobs:
file: build/logs/*.xml
flags: unit
token: ${{ secrets.CODECOV_TOKEN }}

phpcs-sniffs:
name: PHP (Sniffs) ${{ matrix.php }} ${{ matrix.coverage && ' (with coverage)' || '' }}
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
php:
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
wordpress: [ 'latest' ]
include:
- php: '8.3'
coverage: true
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Install PHP dependencies
uses: ramsey/composer-install@57532f8be5bda426838819c5ee9afb8af389d51a
with:
working-directory: "phpcs-sniffs"

- name: Run tests
working-directory: "phpcs-sniffs"
run: |
if [[ ${{ matrix.coverage == true }} == true ]]; then
composer run-tests -- --coverage-clover ../build/logs/phpcs-coverage.xml
else
composer run-tests
fi
- name: Upload code coverage report
if: ${{ matrix.coverage }}
uses: codecov/codecov-action@893cfea3da0870ceb77096be8b5fe014720f3c32
with:
file: build/logs/*.xml
flags: phpcs-sniffs
token: ${{ secrets.CODECOV_TOKEN }}
80 changes: 45 additions & 35 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "wordpress/plugin-check",
"description": "Plugin Check is a WordPress.org tool which provides checks to help plugins meet the directory requirements and follow various best practices.",
"type": "wordpress-plugin",
"license": "GPL-2.0-or-later",
"type": "wordpress-plugin",
"require": {
"php": ">=7.2.24",
"ext-json": "*",
"afragen/wordpress-plugin-readme-parser": "dev-master#67fba498d0b112acf84386b95e4905c539a33f0b",
"automattic/vipwpcs": "^3.0.0",
"composer/installers": "^2.2",
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"wp-coding-standards/wpcs": "^3.1.0",
"automattic/vipwpcs": "^3.0.0",
"afragen/wordpress-plugin-readme-parser": "dev-master#67fba498d0b112acf84386b95e4905c539a33f0b",
"ext-json": "*"
"plugin-check/phpcs-sniffs": "@dev",
"wp-coding-standards/wpcs": "^3.1.0"
},
"require-dev": {
"phpcompatibility/php-compatibility": "^9.3",
Expand All @@ -21,49 +22,58 @@
"szepeviktor/phpstan-wordpress": "^1.1",
"wp-cli/extension-command": "^2.1",
"wp-cli/wp-cli": "^2.8",
"wp-cli/wp-cli-tests": "^v4.2.9"
"wp-cli/wp-cli-tests": "^4.2.9"
},
"repositories": [
{
"type": "path",
"url": "./phpcs-sniffs",
"options": {
"symlink": false
}
}
],
"autoload": {
"psr-4": {
"WordPress\\Plugin_Check\\": "includes/"
}
},
"autoload-dev": {
"psr-4": {
"WordPress\\Plugin_Check\\Behat_Utils\\": "tests/behat/includes",
"WordPress\\Plugin_Check\\Test_Data\\": "tests/phpunit/testdata/Checks",
"WordPress\\Plugin_Check\\Test_Utils\\": "tests/phpunit/utils"
}
},
"config": {
"allow-plugins": {
"composer/installers": true,
"cweagans/composer-patches": false,
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
},
"platform": {
"php": "7.2.24"
}
},
"scripts": {
"behat": "BEHAT_FEATURES_FOLDER=tests/behat/features run-behat-tests",
"behat-rerun": "BEHAT_FEATURES_FOLDER=tests/behat/features rerun-behat-tests",
"prepare-behat-tests": "install-package-tests",
"format": "phpcbf --standard=phpcs.xml.dist",
"lint": "phpcs --standard=phpcs.xml.dist",
"phpmd": "phpmd . text phpmd.xml",
"phpstan": "phpstan analyse --memory-limit=2048M",
"prepare-behat-tests": "install-package-tests",
"test": "phpunit"
},
"scripts-descriptions": {
"lint": "Detect coding standards issues",
"behat": "Run functional tests",
"behat-rerun": "Re-run failed functional tests",
"format": "Detect and automatically fix most coding standards issues",
"test": "Run unit tests",
"lint": "Detect coding standards issues",
"phpmd": "Run PHP mess detector",
"phpstan": "Run static analysis",
"behat": "Run functional tests",
"behat-rerun": "Re-run failed functional tests",
"prepare-behat-tests": "Prepare functional tests"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/installers": true,
"phpstan/extension-installer": true,
"cweagans/composer-patches": false
},
"platform": {
"php": "7.2.24"
}
},
"autoload": {
"psr-4": {
"WordPress\\Plugin_Check\\": "includes/"
}
},
"autoload-dev": {
"psr-4": {
"WordPress\\Plugin_Check\\Test_Data\\": "tests/phpunit/testdata/Checks",
"WordPress\\Plugin_Check\\Test_Utils\\": "tests/phpunit/utils",
"WordPress\\Plugin_Check\\Behat_Utils\\": "tests/behat/includes"
}
"prepare-behat-tests": "Prepare functional tests",
"test": "Run unit tests"
}
}
Loading

0 comments on commit f43dd53

Please sign in to comment.