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

ERROR: Referenced sniff "PHPCSUtils" does not exist #2380

Closed
1 task
alanef opened this issue Sep 7, 2023 · 7 comments
Closed
1 task

ERROR: Referenced sniff "PHPCSUtils" does not exist #2380

alanef opened this issue Sep 7, 2023 · 7 comments

Comments

@alanef
Copy link

alanef commented Sep 7, 2023

Bug Description

3.0.0 Errors with ERROR: Referenced sniff "PHPCSUtils" does not exist

Minimal Code Snippet

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

Fixed by downgrading to 2.30

Error Code

ERROR: Referenced sniff "PHPCSUtils" does not exist

Custom Ruleset

Environment

PHP 8.0.29 (cli) (built: Jun 9 2023 07:38:15) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.29, Copyright (c) Zend Technologies
with Zend OPcache v8.0.29, Copyright (c), by Zend Technologies
| Answer
| ------------------------ | -------
| PHP version | x.y.z
| PHP_CodeSniffer version | x.y.z
| WordPressCS version | x.y.z
| PHPCSUtils version | x.y.z
| PHPCSExtra version | x.y.z
| WordPressCS install type | e.g. Composer global, Composer project local, other (please expand)
| IDE (if relevant) | Name and version e.g. PhpStorm 2018.2.2

Additional Context (optional)

Tested Against develop Branch?

  • I have verified the issue still exists in the develop branch of WordPressCS.
@wizzyto12
Copy link

Same problem

@GaryJones
Copy link
Member

What commands are you using exactly?

To test, I created a new directory, wordpresscs-test, and added your composer.json contents to it:

Screenshot 2023-09-07 at 19 09 07

I then ran composer install (on my machine, I shortcut that to ci):

Screenshot 2023-09-07 at 19 09 20

This installed fine, and you can see that the PHPCSUtils path is added to the PHPCS config via the last line.

I then checked that PHPCSUtils was one of the installed standards:

Screenshot 2023-09-07 at 19 10 59

I then ran PHPCS, from the version installed via the Composer Install – that is, vendor/bin/phpcs - and not any global version that I may also have installed with a different configuration (which would just be phpcs that would read a different binary in my $PATH) on a test file (screenshot trimmed, but it completed fine):

Screenshot 2023-09-07 at 19 13 36

Where does your testing differ?

@jrfnl
Copy link
Member

jrfnl commented Sep 7, 2023

Closing as resolved by user reading the upgrade guide.

@alanef
Copy link
Author

alanef commented Sep 7, 2023

Maybe the upgrade guide should be more prominent than burried half way down the read me?

:)

@jrfnl
Copy link
Member

jrfnl commented Sep 7, 2023

Maybe the upgrade guide should be more prominent than burried half way down the read me?

I hear what you are saying, but if one follows the install instructions as per the readme, there is no issue. If one is upgrading from an older install, the upgrade guides are mentioned prominently in the intro of the 3.0.0 release and spell out what you need to do.

I've spend a lot of time making sure those docs are available and straight forward to follow guides. I know you've removed your remark about my "dismissive tone" from the above comment, but that doesn't mean your comment was ever justified. If all the information is made available in extensive guides and people don't bother to read, then yes, no matter how annoying for you, this is something you could have solved by reading the docs, but instead you choose to ask unpaid maintainers to help you, effectively wasting our time and then you think it is justified to make a remark about my "tone" ?

@alanef
Copy link
Author

alanef commented Sep 7, 2023

I apologize. Now I know what length you and the team have gone to and I simply missed it. Mika had X-Posted the core announcement to make plugins - but I missed that too ( it coincided with vacation ). You are not to know that as a developer for more than 40 years - one way to wind me up is to call me a user - its a language thing and I shouldn't have risen to it - hence my edit.

@jrfnl
Copy link
Member

jrfnl commented Sep 7, 2023

@alanef Apology accepted. Hope WordPressCS 3.0.0 will serve you well.

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