Skip to content

Commit 9dc3fde

Browse files
authored
Merge branch 'trunk' into 929-wp-uninstall-plugin-constant-check-uninstall-php
2 parents 3844805 + fbb54c5 commit 9dc3fde

8 files changed

Lines changed: 369 additions & 322 deletions

File tree

includes/Checker/Checks/Abstract_File_Check.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,18 @@ private static function get_files( Check_Context $plugin ) {
281281
self::$file_list_cache[ $location ][] = $location;
282282
} else {
283283
$iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $location ) );
284+
285+
$directories_to_ignore = Plugin_Request_Utility::get_directories_to_ignore();
286+
287+
$files_to_ignore = Plugin_Request_Utility::get_files_to_ignore();
288+
284289
foreach ( $iterator as $file ) {
285290
if ( ! $file->isFile() ) {
286291
continue;
287292
}
288293

289294
$file_path = wp_normalize_path( $file->getPathname() );
290295

291-
$directories_to_ignore = Plugin_Request_Utility::get_directories_to_ignore();
292-
293296
// Flag to check if the file should be included or not.
294297
$include_file = true;
295298

@@ -301,8 +304,6 @@ private static function get_files( Check_Context $plugin ) {
301304
}
302305
}
303306

304-
$files_to_ignore = Plugin_Request_Utility::get_files_to_ignore();
305-
306307
foreach ( $files_to_ignore as $ignore_file ) {
307308
if ( str_ends_with( $file_path, "/$ignore_file" ) ) {
308309
$include_file = false;

includes/Traits/License_Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function is_license_valid_identifier( $license ) {
8383
* @return bool true if the license is GPL compatible, otherwise false.
8484
*/
8585
protected function is_license_gpl_compatible( $license ) {
86-
$match = preg_match( '/GPL|GNU|MIT|FreeBSD|New BSD|BSD-3-Clause|BSD 3 Clause|OpenLDAP|Expat|Apache2|MPL20|ISC/im', $license );
86+
$match = preg_match( '/GPL|GNU|MIT|FreeBSD|New BSD|BSD-3-Clause|BSD 3 Clause|OpenLDAP|Expat|Apache2|MPL20|ISC|CC0/im', $license );
8787

8888
return ( false === $match || 0 === $match ) ? false : true;
8989
}

package-lock.json

Lines changed: 352 additions & 299 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"npm": ">=10.2.3"
1111
},
1212
"devDependencies": {
13-
"@wordpress/env": "^10.24.0",
14-
"@wordpress/scripts": "^30.17.0",
13+
"@wordpress/env": "^10.25.0",
14+
"@wordpress/scripts": "^30.18.0",
1515
"gherkin-lint": "^4.2.4",
1616
"patch-package": "^8.0.0"
1717
},

phpcs-rulesets/plugin-review.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,6 @@
163163
<severity>7</severity>
164164
</rule>
165165

166-
<!-- Call-time pass-by-reference has been deprecated since PHP 5.3 and should not be used. -->
167-
<rule ref="Generic.Functions.CallTimePassByReference">
168-
<severity>7</severity>
169-
</rule>
170-
171166
<!-- Check for missing required function parameters. -->
172167
<rule ref="PluginCheck.CodeAnalysis.RequiredFunctionParameters">
173168
<severity>7</severity>

tests/phpunit/testdata/plugins/test-plugin-review-phpcs-errors/load.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535

3636
$encoded_value = json_encode( array( 'key' => 'value' ) );
3737

38-
custom_function(&$myvar);
39-
4038
file_get_contents( $url );
4139
file_put_contents();
4240

tests/phpunit/tests/Checker/Checks/Plugin_Review_PHPCS_Check_Tests.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,20 @@ public function test_run_with_errors() {
4545
// Check for PluginCheck.CodeAnalysis.RequiredFunctionParameters.parse_str_resultMissing error on Line no 34 and column no at 1.
4646
$this->assertSame( 'PluginCheck.CodeAnalysis.RequiredFunctionParameters.parse_str_resultMissing', $errors['load.php'][34][1][0]['code'] );
4747

48-
// Check for Generic.Functions.CallTimePassByReference.NotAllowed error on Line no 38 and column no 16.
49-
$this->assertSame( 'Generic.Functions.CallTimePassByReference.NotAllowed', $errors['load.php'][38][16][0]['code'] );
50-
5148
// Check for Generic.Files.ByteOrderMark.Found error on Line no 1 and column no 1.
5249
$this->assertSame( 'Generic.Files.ByteOrderMark.Found', $errors['file-with-bom.php'][1][1][0]['code'] );
5350

5451
// There should not be WordPress.WP.AlternativeFunctions.json_encode_json_encode error on Line no 36 and column no at 18.
5552
$this->assertCount( 0, wp_list_filter( $errors['load.php'][36][18], array( 'code' => 'WordPress.WP.AlternativeFunctions.json_encode_json_encode' ) ) );
5653

57-
// There should not be WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents error on Line no 40 and column no 1.
58-
$this->assertCount( 0, wp_list_filter( $errors['load.php'][40][1], array( 'code' => 'WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents' ) ) );
54+
// There should not be WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents error on Line no 38 and column no 1.
55+
$this->assertCount( 0, wp_list_filter( $errors['load.php'][38][1], array( 'code' => 'WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents' ) ) );
5956

60-
// There should not be WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents error on Line no 41 and column no 1.
61-
$this->assertCount( 0, wp_list_filter( $errors['load.php'][41][1], array( 'code' => 'WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents' ) ) );
57+
// There should not be WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents error on Line no 39 and column no 1.
58+
$this->assertCount( 0, wp_list_filter( $errors['load.php'][39][1], array( 'code' => 'WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents' ) ) );
6259

63-
// Check for PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound error on Line no 43 and column no at 1.
64-
$this->assertSame( 'PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound', $errors['load.php'][43][1][0]['code'] );
60+
// Check for PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound error on Line no 41 and column no at 1.
61+
$this->assertSame( 'PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound', $errors['load.php'][41][1][0]['code'] );
6562

6663
// Check for WordPress.Security.ValidatedSanitizedInput warnings on Line no 15 and column no at 27.
6764
$this->assertCount( 1, wp_list_filter( $warnings['load.php'][15][27], array( 'code' => 'WordPress.Security.ValidatedSanitizedInput.InputNotValidated' ) ) );

tests/phpunit/tests/Traits/License_Utils_Tests.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ public function data_license_gpl_compatibility() {
112112
array( 'OpenLDAP', true ),
113113
array( 'Expat', true ),
114114
array( 'ISC', true ),
115+
array( 'CC0', true ),
116+
array( 'CC0-1.0', true ),
117+
array( 'CC0 1.0 Universal', true ),
115118

116119
array( 'EPL', false ),
117120
array( 'EUPL', false ),

0 commit comments

Comments
 (0)