diff --git a/checks/readme.php b/checks/readme.php index f9b7a8383..696155183 100644 --- a/checks/readme.php +++ b/checks/readme.php @@ -1,6 +1,7 @@ readme->warnings ) ) { + $warnings = $this->readme->warnings ?? []; + $warning_keys = array_keys( $this->readme->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 = 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 ) ) ) ); }