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

phpcs: Referenced sniff "Universal" rules does not exist #1923

Closed
jarkin13 opened this issue Jul 8, 2020 · 5 comments
Closed

phpcs: Referenced sniff "Universal" rules does not exist #1923

jarkin13 opened this issue Jul 8, 2020 · 5 comments
Milestone

Comments

@jarkin13
Copy link

jarkin13 commented Jul 8, 2020

Bug Description

The updated WordPress-Core has two new rules:

<rule ref="Universal.WhiteSpace.DisallowInlineTabs"/>
<rule ref="Universal.Operators.DisallowShortTernary"/>

When removed or revert back to a version that does not have Universal rules, it works fine. However, upgrading to the most recent code causes this error

Minimal Code Snippet

In vscode here an error I receive:
Screen Shot 2020-07-07 at 9 29 12 PM

// phpcs.xml

<?xml version="1.0"?>
<ruleset name="WordPress Theme Coding Standards">
	<description>Wordpress</description>

	<rule ref="WordPress" />
</ruleset>
// vscode settings

{
...
"phpcs.executablePath": "/usr/local/bin/phpcs",
"phpcs.standard": "WordPress",
..
}

For bugs with fixers: How was the code fixed? How did you expect the code to be fixed?

Removing Universal rules
Reverting back to an older version of WordPress-Coding-Standards

Environment

Question Answer
PHP version 7.3.11
PHP_CodeSniffer version 3.5.5
WPCS version most recent
WPCS install type Composer global
VSCode 1.46.1
PHP CodeSniffer for Visual Studio Code v1.0.5
@dingo-d
Copy link
Member

dingo-d commented Jul 8, 2020

It refers to https://github.com/PHPCSStandards/PHPCSExtra/ ruleset. Looks like you are using globally installed WPCS, do you have https://github.com/Dealerdirect/phpcodesniffer-composer-installer installed? The development branch requires utils and extra packages, so it should sort it out. Try to update your globally installed WPCS, and install the dealerdirect package.

And be careful what branch you are using. The development branch is currently going through a big cleanup, thanks to the amazing work by @jrfnl 🙂

@jrfnl
Copy link
Member

jrfnl commented Jul 8, 2020

@jarkin13 I concur, as @dingo-d says, please use a stable version of WPCS. That is, either use the master branch if you use a git clone or use Composer with a version restraint - ^2.3 for the latest.

develop is used for active development and the installation instructions have not been updated yet for it, though the short form of them would be: install via Composer using either composer install for a local project or composer global install for a global installation, and all should be fine ;-)
Mind: you would have to run composer update frequently while work is progressing on WPCS 3.0.0. Oh and no need to require the DealerDirect plugin anymore, that will be installed automatically).

@jrfnl jrfnl added this to the 3.0.0 milestone Jul 8, 2020
@jrfnl
Copy link
Member

jrfnl commented Jul 8, 2020

For more info about what to expect in WPCS 3.0.0: see #1877

@jarkin13
Copy link
Author

jarkin13 commented Jul 8, 2020

Thanks at @dingo-d and @jrfnl! Makes a lot of sense

@jrfnl
Copy link
Member

jrfnl commented Jul 8, 2020

@jarkin13 Does this mean this issue can be closed ?

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

3 participants