version 1.3.2 create-project command cause error Could not scan for classes inside "./tests/" which does not appear to be a file nor a folder
samsonasik opened this issue ยท 6 comments
with latest version 1.3.2, it cause error:
composer create-project php-parallel-lint/php-parallel-lint php-parallel-lint --ansi
Creating a "php-parallel-lint/php-parallel-lint" project at "./php-parallel-lint"
Installing php-parallel-lint/php-parallel-lint (v1.3.2)
- Installing php-parallel-lint/php-parallel-lint (v1.3.2): Extracting archive
Created project in /Users/samsonasik/www/rector-src/php-parallel-lint
Loading composer repositories with package information
Updating dependencies
Lock file operations: 4 installs, 0 updates, 0 removals
- Locking nette/tester (v2.4.1)
- Locking php-parallel-lint/php-console-color (v1.0.1)
- Locking php-parallel-lint/php-console-highlighter (v1.0.0)
- Locking squizlabs/php_codesniffer (3.6.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
- Installing nette/tester (v2.4.1): Extracting archive
- Installing php-parallel-lint/php-console-color (v1.0.1): Extracting archive
- Installing php-parallel-lint/php-console-highlighter (v1.0.0): Extracting archive
- Installing squizlabs/php_codesniffer (3.6.2): Extracting archive
Generating autoload files
[RuntimeException]
Could not scan for classes inside "./tests/" which does not appear to be a file nor a folder
create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [<package>] [<directory>] [<version>]1.3.1 seems working ok, ref https://github.com/rectorphp/rector-src/runs/5275779357?check_suite_focus=true#step:13:39
@samsonasik Thanks for reporting this. I'll have a look, but this may be more of a Composer issue....
Just out of interest: why are you using create-project to set up PHP Parallel Lint in the workflow ?
When I look at this, my first instinct would be to change that to using the Phar file via tools: parallel-lint in the setup-php step.
Other viable alternatives would be to use composer global install... or even downloading the Phar file directly.
@samsonasik Okay, I've had a look and I can reproduce the behaviour.
Analysis:
- As per the Composer documentation, the default Composer uses to "clone" a project when using
create-projectis "dist". - As per the
.gitattributesfile, the tests for this project are not included in the distribution archives, which is how you end up with the "missing/tests/directory" failure.
Note: the create-project command is more for bootstrapping a new project than for using an existing project, so it's not really the best command to use for what you're doing.
Having said that, if you want to keep using create-project instead of the alternatives I've mentioned above in my previous comment, there are (at least) two ways to prevent the issue and still get a running copy of PHP Parallel Lint:
- Add
--no-devto the command.
This should be the preferred option as you don't need thedevdependencies from this package. - Add
--prefer-sourceor--prefer-install=autoto the command.
This will get you a complete clone of the project, which includes thetestsdirectory.
I've tested both commands and can confirm that using either option would fix your problem.
Does that help ?
Thank for such a quick fix. This broke on our CI and I had no idea what happened.
Good job ๐
@TomasVotruba You're welcome and for the future, you may still want to consider switching to using the PHAR file via tools in setup-php.
@jrfnl PHARs proven to be very bad for debugging. Composer packages are much easier to work with.