From 6c86365bad0330999e91362f6c72ff3d15b2184e Mon Sep 17 00:00:00 2001 From: Anton Vlasenko <43744263+anton-vlasenko@users.noreply.github.com> Date: Tue, 19 Mar 2024 00:31:19 +0100 Subject: [PATCH] Refine and clean up the include/exclude patterns in phpcs.xml.dist: (#59712) 1. removed unnecessary dots at the start of include/exclude patterns; 2. added leading slashes to patterns to ensure they match the intended paths without accidentally including unintended ones; 3. escaped dots as `\.` to match literal dots in file paths, enhancing the precision of the patterns, as advised by PHP_CodeSniffer's [documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders); 4. added `$` to the end of patterns targeting `.php` files to ensure they match only at the end of file paths. Co-authored-by: anton-vlasenko Co-authored-by: ironprogrammer Co-authored-by: scruffian Co-authored-by: azaozz --- phpcs.xml.dist | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 63fa5373c1c138..746b4c3860fabe 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -31,9 +31,9 @@ - lib/compat/* - packages/block-library/src/* - build/block-library/* + /lib/compat/* + /packages/block-library/src/* + /build/block-library/* @@ -50,28 +50,28 @@ ./post-content.php - ./packages/block-serialization-spec-parser/parser.php - node_modules/* - build/* + /packages/block-serialization-spec-parser/parser\.php$ + /node_modules/* + /build/* - ./vendor/* - ./test/php/gutenberg-coding-standards/* + /vendor/* + /test/php/gutenberg-coding-standards/* - ./lib/compat/wordpress-*/html-api/*.php + /lib/compat/wordpress-*/html-api/*\.php$ /phpunit/* - packages/block-library/src/navigation/index.php + /packages/block-library/src/navigation/index\.php$ - ./test/gutenberg-test-themes/* + /test/gutenberg-test-themes/* @@ -85,9 +85,9 @@ - ./phpunit/* - ./packages/* - ./bin/generate-gutenberg-php + /phpunit/* + /packages/* + /bin/generate-gutenberg-php\.php$ @@ -100,7 +100,7 @@ - ./packages/block-library/src/*/*.php + /packages/block-library/src/*/*\.php$ @@ -154,15 +154,15 @@ - ./packages/block-library/src/*/*.php + /packages/block-library/src/.+/*\.php$ - ./packages/block-library/src/form-input/index.php - ./packages/block-library/src/form-submission-notification/index.php - ./packages/block-library/src/form/index.php + /packages/block-library/src/form-input/index\.php$ + /packages/block-library/src/form-submission-notification/index\.php$ + /packages/block-library/src/form/index\.php$