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

Missing PHPCS dependency #68

Closed
brayniverse opened this issue Mar 17, 2022 · 7 comments · Fixed by #136
Closed

Missing PHPCS dependency #68

brayniverse opened this issue Mar 17, 2022 · 7 comments · Fixed by #136
Assignees
Labels
Bug Something isn't working
Milestone

Comments

@brayniverse
Copy link
Contributor

Bug Report

Q A
Version(s) 3.11.0

Probably affects other versions but I'm fairly sure that's the version I installed.

Summary

PHPCS comes installed via laminas/laminas-coding-standard but that is removed after the installer script is run. As a result the composer check and composer cs-check commands are broken.

Current behavior

When you run composer check you get the following error message:

> phpcs
'phpcs' is not recognized as an internal or external command,
operable program or batch file.
Script phpcs handling the cs-check event returned with error code 1
Script @cs-check was called via check

If you manually install squizlabs/php_codesniffer it will find PHPCS but then you get the following error:

> phpcs
ERROR: Referenced sniff "LaminasCodingStandard" does not exist

Run "phpcs --help" for usage information

Script phpcs handling the cs-check event returned with error code 3

How to reproduce

Install a fresh instance of mezzio/mezzio-skeleton either using composer create-project mezzio/mezzio-skeleton or by manually cloning the repository and running composer install or composer update.

Once installed run the composer check or composer cs-check commands.

Expected behavior

I would expect to see the output from PHPCS.

@brayniverse brayniverse added the Bug Something isn't working label Mar 17, 2022
@brayniverse
Copy link
Contributor Author

I'm happy to submit a pull request to resolve this issue. But first I'd need someone in charge to tell me what you'd like me to do first.

I was thinking of adding squizlabs/php_codesniffer as a dev dependency and creating src/MezzioInstaller/Resources/phpcs.xml.dist with config similar to the current phpcs.xml.dist but with the PSR12 standard instead of LaminasCodingStandard, then making sure it replaces the original phpcs.xml.dist after install.

Please let me know if there is anything I can do to help.

@arueckauer
Copy link
Contributor

Interesting observation. I usually do add laminas-coding-standard manually but also remove the script section from composer.json as I do not rely on these.

Adding laminas-coding-standard to a newly created project is trivial. The question I have, is, is it really desired to ship laminas-coding-standard with the skeleton? What if someone prefers friendsofphp/php-cs-fixer or doctrine/coding-standard?

It would be possible to add a choice during installation. Personally I'd rather not and let the user decide what coding standard, static code analysis tool etc. he/she would like to install. I would vote for removing the cs-related scripts from composer.json.

@brayniverse
Copy link
Contributor Author

I would be happy with removing PHP CS entirely and installing it myself with each project. But having it there pre-installed and pre-configured would definitely be convenient for me and possibly newcomers to the framework who might not yet have experience with automated coding standards.

So long as it's either removed completely to avoid confusion or working on a fresh install I'm happy.

@brayniverse
Copy link
Contributor Author

Hi @froschdesign @Ocramius.

Sorry to bother you both but you interacted with me on a PR I submitted recently so I assume you're both working on this repository at the moment.

I would like to help resolve this issue. Is there anything I can do to help? As I said in an earlier comment, I'm happy to put together a pull request if you can give me directions on what you'd like to be done.

@Ocramius
Copy link
Member

Send a patch: easier to review a diff.

@brayniverse
Copy link
Contributor Author

Working on it.

@oleg-moseyko
Copy link

$ composer check

phpcs
sh: phpcs: command not found
Script phpcs handling the cs-check event returned with error code 127
Script @cs-check was called via check

@Xerkus Xerkus self-assigned this Jan 8, 2024
@Xerkus Xerkus added this to the 3.15.0 milestone Jan 8, 2024
@Xerkus Xerkus linked a pull request Jan 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants