Skip to content

Commit

Permalink
Merge branch 'trunk' into add/cli-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Oct 30, 2023
2 parents 041b3ab + f526b60 commit 894457f
Show file tree
Hide file tree
Showing 124 changed files with 22,371 additions and 2,829 deletions.
31 changes: 31 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/.git export-ignore
/.github export-ignore
/.wordpress-org export-ignore
/node_modules export-ignore

/docs export-ignore
/tests export-ignore
/build-cs export-ignore

/*.DS_store export-ignore
/.DS_store? export-ignore

/.editorconfig export-ignore
/.eslintrc.js export-ignore
/.nvmrc export-ignore
/.wp-env.json export-ignore
/composer.json export-ignore
/composer.lock export-ignore
/package.json export-ignore
/package-lock.json export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore

/CODE_OF_CONDUCT.md export-ignore
/CONTRIBUTING.md export-ignore
/SECURITY.md export-ignore
/README.md export-ignore

/.gitattributes export-ignore
/.gitignore export-ignore
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy

# Run deploy only on published releases.
on:
release:
types: [published]

jobs:

deploy:
name: Deploy to WordPress.org
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: WordPress Plugin Deploy
id: deploy
uses: 10up/action-wordpress-plugin-deploy@stable
with:
generate-zip: true
env:
#SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
#SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}

- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.deploy.outputs.zip-path }}
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
5 changes: 0 additions & 5 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
fail-fast: true
matrix:
php:
- '5.6'
- '7.0'
- '7.1'
- '7.2'
Expand All @@ -59,10 +58,6 @@ jobs:
- '8.2'
wordpress: [ 'latest' ]
include:
- php: '8.0'
wordpress: '6.0'
- php: '8.0'
wordpress: '6.1'
- php: '8.2'
wordpress: 'trunk'
experimental: true
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Spell Check

on: [pull_request]

jobs:
spell-checker:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Search for misspellings
uses: crate-ci/typos@master
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
16
Binary file added .wordpress-org/banner-1544x500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .wordpress-org/banner-772x250.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions .wordpress-org/banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions .wordpress-org/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Thank you for your interest in contributing to the Plugin Check plugin!

In general, all code must follow the [WordPress Coding Standards and best practices](https://developer.wordpress.org/coding-standards/). All code in the Plugin Check plugin must follow these requirements:

- **WordPress**: The plugin's minimum WordPress version requirement is 6.0.
- **PHP**: Always match the latest WordPress version. The minimum required version right now is 5.6.
- **WordPress**: The plugin's minimum WordPress version requirement is 6.3.
- **PHP**: Always match the latest WordPress version. The minimum required version right now is 7.0.

## Guidelines

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ After having the plugin activated, you can analyze any other plugin installed on
* To check a plugin using WP-CLI, please use the `wp plugin check` command. For example, to check the "Hello Dolly" plugin: `wp plugin check hello.php`
* Note that by default when using WP-CLI, only static checks can be executed. In order to also include runtime checks, a workaround is currently necessary using the `--require` argument of WP-CLI, to manually load the `cli.php` file within the plugin checker directory before WordPress is loaded. For example: `wp plugin check hello.php --require=./wp-content/plugins/plugin-check/cli.php`

<img alt="WordPress plugin checker UI in WP Admin" src="https://github.com/WordPress/plugin-check/assets/3531426/19d0c1ce-8c37-4efd-b8c6-d252e6ce29c9">
<em>Screenshot of the plugin checker's UI in WP Admin</em>

## Contributing

To set up the repository locally, you will need to clone this GitHub repository (or a fork of it) and then install the relevant dependencies:

```
git clone https://github.com/10up/plugin-check.git wp-content/plugins/plugin-check
git clone https://github.com/WordPress/plugin-check.git wp-content/plugins/plugin-check
cd wp-content/plugins/plugin-check
composer install
npm install
Expand All @@ -61,6 +64,10 @@ npm run wp-env stop

For further information on contributing, please see the [contributing guide](/CONTRIBUTING.md).

### Technical documentation

To learn more about the functionality and technical details of the WordPress plugin checker, please refer to the [technical documentation](./docs/README.md).

## License

The WordPress plugin checker is free software, and is released under the terms of the GNU General Public License version 2 or (at your option) any later version. See [LICENSE](/LICENSE) for complete license.
49 changes: 48 additions & 1 deletion assets/js/plugin-check-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
const pluginsList = document.getElementById(
'plugin-check__plugins-dropdown'
);
const categoriesList = document.querySelectorAll(
'input[name=categories]'
);
const templates = {};

// Return early if the elements cannot be found on the page.
if ( ! checkItButton || ! pluginsList || ! resultsContainer || ! spinner ) {
if (
! checkItButton ||
! pluginsList ||
! resultsContainer ||
! spinner ||
! categoriesList.length
) {
console.error( 'Missing form elements on page' );
return;
}
Expand All @@ -26,6 +35,29 @@
canRunChecks();
pluginsList.addEventListener( 'change', canRunChecks );

function saveUserSettings() {
const selectedCategories = [];

// Assuming you have a list of category checkboxes, find the selected ones.
categoriesList.forEach( function ( checkbox ) {
if ( checkbox.checked ) {
selectedCategories.push( checkbox.value );
}
} );

// Join the selected category slugs with '__' and save it as a user setting.
const settingValue = selectedCategories.join( '__' );
window.setUserSetting(
'plugin_check_category_preferences',
settingValue
);
}

// Attach the saveUserSettings function when a category checkbox is clicked.
categoriesList.forEach( function ( checkbox ) {
checkbox.addEventListener( 'change', saveUserSettings );
} );

// When the Check it button is clicked.
checkItButton.addEventListener( 'click', ( e ) => {
e.preventDefault();
Expand All @@ -34,6 +66,9 @@
checkItButton.disabled = true;
pluginsList.disabled = true;
spinner.classList.add( 'is-active' );
for ( let i = 0; i < categoriesList.length; i++ ) {
categoriesList[ i ].disabled = true;
}

getChecksToRun()
.then( setUpEnvironment )
Expand Down Expand Up @@ -70,6 +105,9 @@
spinner.classList.remove( 'is-active' );
checkItButton.disabled = false;
pluginsList.disabled = false;
for ( let i = 0; i < categoriesList.length; i++ ) {
categoriesList[ i ].disabled = false;
}
}

/**
Expand Down Expand Up @@ -156,6 +194,15 @@
pluginCheckData.append( 'plugin', pluginsList.value );
pluginCheckData.append( 'action', pluginCheck.actionGetChecksToRun );

for ( let i = 0; i < categoriesList.length; i++ ) {
if ( categoriesList[ i ].checked ) {
pluginCheckData.append(
'categories[]',
categoriesList[ i ].value
);
}
}

return fetch( ajaxurl, {
method: 'POST',
credentials: 'same-origin',
Expand Down
2 changes: 1 addition & 1 deletion behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ default:
contexts:
- WordPress\Plugin_Check\Behat_Utils\FeatureContext
paths:
- tests/behat/features
- tests/behat/features
2 changes: 1 addition & 1 deletion build-cs/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"phpstan/extension-installer": "^1.2",
"slevomat/coding-standard": "^8.9",
"szepeviktor/phpstan-wordpress": "^1.1",
"wp-coding-standards/wpcs": "dev-develop#fca9d9e"
"wp-coding-standards/wpcs": "^3.0.0"
},
"config": {
"allow-plugins": {
Expand Down
Loading

0 comments on commit 894457f

Please sign in to comment.