From a21ea1793b2fe511bb5913e3c5158128866bf7c0 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Wed, 2 Aug 2023 12:21:57 +0530 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Felix Arntz --- .../Checker/Checks/Plugin_Readme_Check.php | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Readme_Check.php index 68d388b42..8ce44fb8b 100644 --- a/includes/Checker/Checks/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Readme_Check.php @@ -95,14 +95,10 @@ private function check_default_text( Check_Result $result, array $files ) { if ( $file ) { $result->add_message( false, - sprintf( - /* translators: %s: readme file */ - __( 'The %s appears to contain default text.', 'plugin-check' ), - str_replace( $result->plugin()->path( '/' ), '', $file ) - ), + __( 'The readme appears to contain default text.', 'plugin-check' ), array( 'code' => 'default_readme_text', - 'file' => $file, + 'file' => str_replace( $result->plugin()->path(), '', $file ), ) ); } @@ -129,14 +125,10 @@ private function check_license( Check_Result $result, array $files ) { if ( ! preg_match( '/^([a-z0-9\-\+\.]+)(\sor\s([a-z0-9\-\+\.]+))*$/i', $matches[2] ) ) { $result->add_message( false, - sprintf( - /* translators: %s: readme file */ - __( 'Your plugin has an invalid license declared. Please update your %s with a valid SPDX license identifier.', 'plugin-check' ), - str_replace( $result->plugin()->path( '/' ), '', $file ) - ), + __( 'Your plugin has an invalid license declared. Please update your readme with a valid SPDX license identifier.', 'plugin-check' ), array( 'code' => 'invalid_license', - 'file' => $file, + 'file' => str_replace( $result->plugin()->path(), '', $file ), ) ); } @@ -166,7 +158,7 @@ private function check_stable_tag( Check_Result $result, array $files ) { __( "It's recommended not to use 'Stable Tag: trunk'.", 'plugin-check' ), array( 'code' => 'trunk_stable_tag', - 'file' => $file, + 'file' => str_replace( $result->plugin()->path(), '', $file ), ) ); } @@ -180,14 +172,10 @@ private function check_stable_tag( Check_Result $result, array $files ) { ) { $result->add_message( false, - sprintf( - /* translators: %s: readme file */ - __( 'The Stable Tag in your %s file does not match the version in your main plugin file.', 'plugin-check' ), - str_replace( $result->plugin()->path( '/' ), '', $file ) - ), + __( 'The Stable Tag in your readme file does not match the version in your main plugin file.', 'plugin-check' ), array( 'code' => 'stable_tag_mismatch', - 'file' => $file, + 'file' => str_replace( $result->plugin()->path(), '', $file ), ) ); }