Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 #96

Closed
samsonasik opened this issue Feb 21, 2022 · 6 comments · Fixed by #99

Comments

@samsonasik
Copy link

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

@jrfnl
Copy link
Collaborator

jrfnl commented Feb 21, 2022

@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.

@jrfnl
Copy link
Collaborator

jrfnl commented Feb 21, 2022

@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-project is "dist".
  • As per the .gitattributes file, 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:

  1. Add --no-dev to the command.
    This should be the preferred option as you don't need the dev dependencies from this package.
  2. Add --prefer-source or --prefer-install=auto to the command.
    This will get you a complete clone of the project, which includes the tests directory.

I've tested both commands and can confirm that using either option would fix your problem.

Does that help ?

@samsonasik
Copy link
Author

Thank you @jrfnl , it seems with --no-dev seems make it works 👍 , I created PR #99 to update the readme for it.

@TomasVotruba
Copy link

Thank for such a quick fix. This broke on our CI and I had no idea what happened.

Good job 👍

@jrfnl
Copy link
Collaborator

jrfnl commented Feb 22, 2022

@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.

@TomasVotruba
Copy link

TomasVotruba commented Feb 22, 2022

@jrfnl PHARs proven to be very bad for debugging. Composer packages are much easier to work with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants