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

Help: Getting PHPCS Response ERROR: Referenced sniff "PHPCSUtils" does not exist #3110

Closed
CrowdForge opened this issue Sep 10, 2020 · 8 comments

Comments

@CrowdForge
Copy link

I've installed codesniffer with homebrew on a mac using the guide here: https://luminfire.com/2017/03/01/wordpress-php-codesniffer-favorite-editor/

But I'm getting the following error in dev tools on atom:

PHPCS Response ERROR: Referenced sniff "PHPCSUtils" does not exist

I don't recognize PHPCSUtils from any of the process or configuration. Any thoughts / ideas?

@jrfnl
Copy link
Contributor

jrfnl commented Sep 10, 2020

@CrowdForge Based on that tutorial, you would be using a git clone and based on the error, you seem to be using the develop version of the WordPress Coding Standards. Either switch to master or, better yet, use Composer to install WordPressCS to make sure you use a stable version.

See the installation instructions for WordPressCS; https://github.com/WordPress/WordPress-Coding-Standards

Regarding PHPCSUtils: that is a new dependency which WordPressCS 3.0.0 (currently in development) will use, It is basically a layer between PHP_CodeSniffer and an external standard to help with some of the more complex logic used in sniffs and with PHPCS cross-version compatibility.

@kishanjasani
Copy link

Thanks, @jrfnl . Switching to the master branch is works for me. 👍

@Micu22
Copy link

Micu22 commented Nov 22, 2020

I am getting the same error on version 3.5.8, any idea why?

@jrfnl
Copy link
Contributor

jrfnl commented Nov 22, 2020

@Micu22 See the above - you are using a non-released, development version of an external standard. Switch to using a tagged release and all will be fine.

@Micu22
Copy link

Micu22 commented Nov 23, 2020

I can confirm that is the solution, I just thought that 3.5.8 has it already stable.
Especially after listing the version in cl

PHP_CodeSniffer version 3.5.8 (stable) by Squiz (http://www.squiz.net)

@jrfnl
Copy link
Contributor

jrfnl commented Nov 23, 2020

3.5.8 is the version of PHPCS you are using, which is unrelated to the version of the external standard you are using (or the version of their dependencies).

@jagirbahesh
Copy link

@CrowdForge Based on that tutorial, you would be using a git clone and based on the error, you seem to be using the develop version of the WordPress Coding Standards. Either switch to master or, better yet, use Composer to install WordPressCS to make sure you use a stable version.

See the installation instructions for WordPressCS; https://github.com/WordPress/WordPress-Coding-Standards

Regarding PHPCSUtils: that is a new dependency which WordPressCS 3.0.0 (currently in development) will use, It is basically a layer between PHP_CodeSniffer and an external standard to help with some of the more complex logic used in sniffs and with PHPCS cross-version compatibility.

Thanks It is working 👌🏻

@brothman01
Copy link

brothman01 commented May 24, 2023

I had this issue and switching WordPress coding standards to the master branch worked for me 👍

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

No branches or pull requests

7 participants