Skip to content

Commit

Permalink
Merge pull request #752 from WordPress/update-contributors-check
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Nov 5, 2024
2 parents 954fd30 + 37f7981 commit bdd11e0
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ private function check_for_warnings( Check_Result $result, string $readme_file,
* @param string $readme_file Readme file.
*/
private function check_for_contributors( Check_Result $result, string $readme_file ) {
$regex = '/Contributors\s?:(.*?)\R/';
$regex = '/Contributors\s?:(?:\*\*|\s)?(.*?)\R/';

$matches = array();

Expand Down
39 changes: 39 additions & 0 deletions tests/behat/features/plugin-check.feature
Original file line number Diff line number Diff line change
Expand Up @@ -680,3 +680,42 @@ Feature: Test that the WP-CLI command works.
"""
mismatched_plugin_name
"""

Scenario: Check Contributors value in readme in markdown format
Given a WP install with the Plugin Check plugin
And a wp-content/plugins/foo-sample/foo-sample.php file:
"""
<?php
/**
* Plugin Name: Foo Sample
* Plugin URI: https://foo-sample.com
* Description: Custom plugin.
* Version: 0.1.0
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
"""
And a wp-content/plugins/foo-sample/README.md file:
"""
# Foo Sample #
**Contributors:** johndoe
**Requires at least:** 6.0
**Tested up to:** 6.6
**Requires PHP:** 7.2
**Stable tag:** 0.1.0
**License:** GPL-2.0+
**License URI:** http://www.gnu.org/licenses/gpl-2.0.txt
This is a short description of the plugin.
"""

When I run the WP-CLI command `plugin check foo-sample`
Then STDOUT should not contain:
"""
readme_invalid_contributors
"""

0 comments on commit bdd11e0

Please sign in to comment.