From 7b75fd44f9d4030f6a60d642df63e1a6e468062d Mon Sep 17 00:00:00 2001 From: Brandon Kraft Date: Mon, 14 Oct 2024 14:29:48 -0500 Subject: [PATCH 1/2] Restricted Headers: remove ones that are allowed, but leave the mech for checking in place for future use --- .../Checks/Plugin_Repo/Plugin_Header_Fields_Check.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php index 1eaaa13b3..978698184 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php @@ -69,13 +69,7 @@ public function run( Check_Result $result ) { 'RequiresPlugins' => 'Requires Plugins', ); - $restricted_labels = array( - 'BitbucketPluginURI' => 'Bitbucket Plugin URI', - 'GistPluginURI' => 'Gist Plugin URI', - 'GiteaPluginURI' => 'Gitea Plugin URI', - 'GitHubPluginURI' => 'GitHub Plugin URI', - 'GitLabPluginURI' => 'GitLab Plugin URI', - ); + $restricted_labels = array(); // Reserved for future use. $plugin_header = $this->get_plugin_data( $plugin_main_file, array_merge( $labels, $restricted_labels ) ); From 23ee5f57d4a2159d53f0bcd6d1f80917bbd7d59f Mon Sep 17 00:00:00 2001 From: Brandon Kraft Date: Mon, 14 Oct 2024 14:39:57 -0500 Subject: [PATCH 2/2] Update for tests --- .../Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php | 4 +++- .../tests/Checker/Checks/Plugin_Header_Fields_Check_Tests.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php index 978698184..5f5be7c29 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Header_Fields_Check.php @@ -69,7 +69,9 @@ public function run( Check_Result $result ) { 'RequiresPlugins' => 'Requires Plugins', ); - $restricted_labels = array(); // Reserved for future use. + $restricted_labels = array( + 'RestrictedLabel' => 'Restricted Label', + ); // Reserved for future use. $plugin_header = $this->get_plugin_data( $plugin_main_file, array_merge( $labels, $restricted_labels ) ); diff --git a/tests/phpunit/tests/Checker/Checks/Plugin_Header_Fields_Check_Tests.php b/tests/phpunit/tests/Checker/Checks/Plugin_Header_Fields_Check_Tests.php index a89f4fb81..5b14cda8f 100644 --- a/tests/phpunit/tests/Checker/Checks/Plugin_Header_Fields_Check_Tests.php +++ b/tests/phpunit/tests/Checker/Checks/Plugin_Header_Fields_Check_Tests.php @@ -24,7 +24,7 @@ public function test_run_with_errors() { $this->assertNotEmpty( $errors ); $this->assertNotEmpty( $warnings ); - $this->assertCount( 1, wp_list_filter( $errors['load.php'][0][0], array( 'code' => 'plugin_header_restricted_fields' ) ) ); + $this->assertCount( 0, wp_list_filter( $errors['load.php'][0][0], array( 'code' => 'plugin_header_restricted_fields' ) ) ); $this->assertCount( 1, wp_list_filter( $errors['load.php'][0][0], array( 'code' => 'plugin_header_invalid_requires_wp' ) ) ); $this->assertCount( 1, wp_list_filter( $errors['load.php'][0][0], array( 'code' => 'plugin_header_invalid_requires_php' ) ) ); $this->assertCount( 1, wp_list_filter( $warnings['load.php'][0][0], array( 'code' => 'plugin_header_invalid_plugin_uri_domain' ) ) );