From fc6dd665d35e6a7340b0c756b9e71da2d6611a6f Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Tue, 24 Dec 2024 12:20:12 +0545 Subject: [PATCH 1/2] Update severity for i18n codes --- .../Checker/Checks/General/I18n_Usage_Check.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/includes/Checker/Checks/General/I18n_Usage_Check.php b/includes/Checker/Checks/General/I18n_Usage_Check.php index 3678c3758..79e69db0b 100644 --- a/includes/Checker/Checks/General/I18n_Usage_Check.php +++ b/includes/Checker/Checks/General/I18n_Usage_Check.php @@ -128,6 +128,21 @@ protected function add_result_message_for_file( Check_Result $result, $error, $m break; } + // Update severity. + switch ( $code ) { + case 'WordPress.WP.I18n.InterpolatedVariableDomain': + case 'WordPress.WP.I18n.MissingArgText': + case 'WordPress.WP.I18n.NoEmptyStrings': + case 'WordPress.WP.I18n.NonSingularStringLiteralContext': + case 'WordPress.WP.I18n.NonSingularStringLiteralDomain': + case 'WordPress.WP.I18n.TooManyFunctionArgs': + $severity = 7; + break; + + default: + break; + } + parent::add_result_message_for_file( $result, $error, $message, $code, $file, $line, $column, $docs, $severity ); } } From c1f622ba9d79ac2ed8792d151248e33c72bf3079 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Tue, 24 Dec 2024 14:16:15 +0545 Subject: [PATCH 2/2] Add feature test for updated i18n severity --- tests/behat/features/plugin-check.feature | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/behat/features/plugin-check.feature b/tests/behat/features/plugin-check.feature index 18f74797e..a90fec119 100644 --- a/tests/behat/features/plugin-check.feature +++ b/tests/behat/features/plugin-check.feature @@ -750,3 +750,53 @@ Feature: Test that the WP-CLI command works. """ application_detected """ + + Scenario: Check for i18n severity + Given a WP install with the Plugin Check plugin + And a wp-content/plugins/foo-sample/foo-sample.php file: + """ +