WordPress / block-development-examples

Practical examples for building WordPress blocks and extending the Editor.
https://wordpress.github.io/block-development-examples/
GNU General Public License v2.0
212 stars 32 forks source link

composer run lint is failing #64

Closed juanmaguitar closed 1 year ago

juanmaguitar commented 1 year ago

composer run lint is returning some errors and provoking the main workflow to fail

I'm removing "*.php": [ "composer run lint"], from lint-staged until this issue is solved

⬢  block-development-examples  trunk ⦾ composer run lint
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer/vendor/symfony/console/Command/DumpCompletionCommand.php:48
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer/vendor/symfony/console/Command/DumpCompletionCommand.php:56
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:875
Deprecation Notice: Using ${var} in strings is deprecated, use {$var} instead in phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:880
> ./vendor/bin/phpcs --standard=phpcs.xml
sh: ./vendor/bin/phpcs: No such file or directory
Script ./vendor/bin/phpcs --standard=phpcs.xml handling the lint event returned with error code 127
ryanwelcher commented 1 year ago

@juanmaguitar can we just remove the linting step from this branch/workflow? Any code that gets to this point will already have been linted. Perhaps I can adjust the action to ignore this branch.

ryanwelcher commented 1 year ago

https://github.com/WordPress/block-development-examples/pull/70

ryanwelcher commented 1 year ago

@juanmaguitar this should be fixed now. I am basically bypassing the linting steps on the deploy branch merge.

juanmaguitar commented 1 year ago

@ryanwelcher this is still not working properly composer run lint fails both locally and in the GitHub Action. I have removed "*.php": [ "composer run lint"] again from lint-staged until this issue is solved.

Note: I wouldn't consider this a high priority for now, but something to try to get fixed before the end of the year.

ryanwelcher commented 1 year ago

@juanmaguitar if there are failures locally then my guess is that it's due to actual linting issues.

I just ran composer run lint on trunk locally and got the following error:

FILE: ...enberg-examples-2023/plugins/block-dynamic-rendering-64756b/src/render.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
 11 | ERROR | All output should be run through an escaping function (see the
    |       | Security sections in the WordPress Developer Handbooks), found
    |       | 'get_block_wrapper_attributes'.
----------------------------------------------------------------------

This is correct and expected. My guess is that it was introduced with this commit. Specifically with the remove of the // phpcs:ignore comment.

juanmaguitar commented 1 year ago

Solved as per https://github.com/WordPress/block-development-examples/pull/73