wp-launchpad / launchpad

Launchpad is a framework for WordPress plugin that allows you to create a modern PHP plugin in no time.
https://wp-launchpad.gitbook.io/launchpad/
GNU General Public License v2.0
22 stars 0 forks source link

When building a new plugin with LaunchPad, PHPCS rules & CI must be validated by the automatically generated code #30

Open MathieuLamiot opened 4 months ago

MathieuLamiot commented 4 months ago

Context I am working on a new plugin from scratch, using WP-Launchpad: https://github.com/wordpressfan/wordpress-debug-hooks/pull/1 Doing so, a CI is automatically added to GitHub. However, the generated code does not pass the CI.

For instance, the linter complains:

Also, the tests GH actions fail:

  Problem 1
    - nelexa/zip[4.0.0, ..., 4.0.2] require php ^7.4 || ^8.0 -> your php version (7.3.33) does not satisfy that requirement.
    - wp-launchpad/build v0.0.8 requires nelexa/zip ^4.0 -> satisfiable by nelexa/zip[4.0.0, 4.0.1, 4.0.2].
    - Root composer.json requires wp-launchpad/build ^0.0.8 -> satisfiable by wp-launchpad/build[v0.0.8].
Run composer run-tests
> "vendor/bin/phpunit" --testsuite unit --colors=always --configuration tests/Unit/phpunit.xml.dist
PHPUnit 9.6.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.33
Configuration: tests/Unit/phpunit.xml.dist

No tests executed!
> "vendor/bin/phpunit" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --exclude-group AdminOnly
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Warning: PHP Warning:  fopen(/home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/vendor-prefixed/wp-launchpad/core/inc/boot.php): failed to open stream: No such file or directory in /home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/vendor/antecedent/patchwork/src/CodeManipulation/Stream.php on line [15](https://github.com/wordpressfan/wordpress-debug-hooks/actions/runs/9891170201/job/27321024460#step:12:16)1
Warning: PHP Warning:  require(/home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/vendor-prefixed/wp-launchpad/core/inc/boot.php): failed to open stream: "Patchwork\CodeManipulation\Stream::stream_open" call failed in /home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/debug-hooks.php on line [17](https://github.com/wordpressfan/wordpress-debug-hooks/actions/runs/9891170201/job/27321024460#step:12:18)
Error: PHP Fatal error:  require(): Failed opening required '/home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/vendor-prefixed/wp-launchpad/core/inc/boot.php' (include_path='.:/usr/share/php') in /home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/debug-hooks.php on line 17
;\Patchwork\CodeManipulation\Stream::reinstateWrapper();
Warning: fopen(/home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/vendor-prefixed/wp-launchpad/core/inc/boot.php): failed to open stream: No such file or directory in /home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/vendor/antecedent/patchwork/src/CodeManipulation/Stream.php on line 151

Warning: require(/home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/vendor-prefixed/wp-launchpad/core/inc/boot.php): failed to open stream: "Patchwork\CodeManipulation\Stream::stream_open" call failed in /home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/debug-hooks.php on line 17

Fatal error: require(): Failed opening required '/home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/vendor-prefixed/wp-launchpad/core/inc/boot.php' (include_path='.:/usr/share/php') in /home/runner/work/wordpress-debug-hooks/wordpress-debug-hooks/debug-hooks.php on line 17
Script "vendor/bin/phpunit" --testsuite integration --colors=always --configuration tests/Integration/phpunit.xml.dist --exclude-group AdminOnly handling the test-integration event returned with error code 255
Script @test-integration was called via run-tests
Error: Process completed with exit code [25](https://github.com/wordpressfan/wordpress-debug-hooks/actions/runs/9891170201/job/27321024460#step:12:26)5.

Locally, with PHPCS: When manually running phpcs, many errors are comming from vendor-prefixed. I added

<exclude-pattern>/vendor-prefixed/*</exclude-pattern>

in phpcs.xml to avoid this. Could this be made automatically?

Expected behavior After initializing a plugin from scratch with composer:

CrochetFeve0251 commented 4 months ago

I think these two issues are related: https://github.com/wp-launchpad/launchpad/issues/15