Skip to content

Commit

Permalink
Merge branch 'legacy-plugin' into fix/improve-host-compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
bordoni authored Nov 24, 2023
2 parents f450396 + b63967c commit 5d0917c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
23 changes: 21 additions & 2 deletions checks/readme.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace WordPressdotorg\Plugin_Check\Checks;
use WordPressdotorg\Plugin_Check\{Error, Guideline_Violation, Message, Notice, Warning};
use WordPressdotorg\Plugin_Directory\Readme\Parser;

class Readme extends Check_Base {
/**
Expand Down Expand Up @@ -76,13 +77,31 @@ function check_for_default_text() {
}

function check_for_warnings() {
if ( ! empty( $this->readme->warnings ) ) {
$warnings = $this->readme->warnings ?? [];
$warning_keys = array_keys( $warnings );
$ignored_warnings = [
'contributor_ignored'
];

/**
* Filter the list of ignored readme parser warnings.
*
* @since 0.2.2
*
* @param array $ignored_warnings Array of ignored warning keys.
* @param Parser $readme The readme object.
*/
$ignored_warnings = (array) apply_filters( 'plugin_check_readme_warnings_ignored', $ignored_warnings, $this->readme );

$warning_keys = array_diff( $warning_keys, $ignored_warnings );

if ( ! empty( $warning_keys ) ) {
return new Warning(
'readme_parser_warnings',
sprintf(
/* translators: %1$s: list of warnings */
__( 'The following readme parser warnings were detected: %1$s', 'plugin-check' ),
esc_html( implode( ', ', array_keys( $this->readme->warnings ) ) )
esc_html( implode( ', ', $warning_keys ) )
)
);
}
Expand Down
4 changes: 3 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ This plugin checker is not perfect, and never will be. It is only a tool to help

= [0.2.2] 2023-11-XX =


* Enhancement - Include support for Windows Servers.
* Enhancement - Avoid using PHP CLI directly, which enables plugin developers to use PCP in a variety of new environments.
* Fix - Remove extra period on the end of the sentence for Phar warning. Props @bordoni, @pixolin. [#275](https://github.com/10up/plugin-check/pull/265)
* Fix - Prevent problems with Readme parser warning related to `contributor_ignored` for when running the check outside of WP.org. Props @bordoni, @dev4press. [#276](https://github.com/10up/plugin-check/pull/276)
* Fix - Remove extra period on the end of the sentence for Phar warning. Props @bordoni, @pixolin. [#275](https://github.com/10up/plugin-check/pull/275)

= [0.2.1] 2023-09-22 =

Expand Down

0 comments on commit 5d0917c

Please sign in to comment.