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

PHPCSutils_ Refernce_Error #2379

Closed
zakitekhqs opened this issue Sep 7, 2023 · 7 comments
Closed

PHPCSutils_ Refernce_Error #2379

zakitekhqs opened this issue Sep 7, 2023 · 7 comments

Comments

@zakitekhqs
Copy link

Issue:
I have moved to Linux(Ubuntu Debian). Installed the 'phpcs' using composer and it worked but when installed 'wpcs' using composer did not work. So I cloned it from Git.

Now I have set paths and standards are installed but when I use phpcs --standard=WordPress 'path to file', it gives below error.

ERROR: Referenced sniff "Universal.NamingConventions.NoReservedKeywordParameterNames" does not exist.

Actions:

  • I have installed PHPCSutils and PHPCSExtra but still see the issue.
  • Reinstalled composer , phpcs but same error/
@jrfnl
Copy link
Member

jrfnl commented Sep 7, 2023

As of WordPressCS 3.0.0, Composer is the only supported manner of installation for that reason. Please install using Composer as per the installation instructions in the README.

@jrfnl jrfnl closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2023
@alanef
Copy link

alanef commented Sep 7, 2023

Installed with Composer

ERROR: Referenced sniff "PHPCSUtils" does not exist

{ "config": { "platform": { "php": "7.4.33" }, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true } }, "require-dev": { "wp-coding-standards/wpcs": "^3.0" } }

but installing 2.30 the same way works

@dingo-d
Copy link
Member

dingo-d commented Sep 7, 2023

Are you using phpcs from the global installation or from your vendor folder?

I installed the above code to my computer, and when running vendor/bin/phpcs -i I can see the following:

The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend, Modernize, NormalizedArrays, Universal, PHPCSUtils, WordPress, WordPress-Core, WordPress-Docs and WordPress-Extra

@alanef
Copy link

alanef commented Sep 7, 2023

I'm running from vendor

Like you I'm seeing PHPCSUtils, when I do a -i yet it fails

reverting versions in the exact same env works

how can I help debug further?

@alanef
Copy link

alanef commented Sep 7, 2023

OK

Resolved

To upgrade from 2.3.0 to 3.0.0 you need to extend your installed_paths

to include phpcsstandards/phpcsextra and phpcsutils

e.g.

<config name="installed_paths" value="./../../wp-coding-standards/wpcs,./../../phpcsstandards/phpcsutils,./../../phpcsstandards/phpcsextra"/>

@jrfnl
Copy link
Member

jrfnl commented Sep 7, 2023

@alanef No, you should removed that <config.. completely as is spelled out in the Upgrade Guide as it overwrites what the Composer plugin sets (which will always be correct, while what you are doing needs manual maintenance and keeping up with dev changes in this repo).

@alanef
Copy link

alanef commented Sep 7, 2023

Thanks for pointing out the upgrade docs

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

No branches or pull requests

4 participants