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 is Throwing Errors #427

Closed
stevenkword opened this issue Sep 12, 2019 · 3 comments

Comments

@stevenkword
Copy link

commented Sep 12, 2019

PHPCS is throwing an error against the latest version of the WP Coding Standards. It was addressed previously through the usage of phpcs:ignore, however I believe the ruleset namespaces have since changed have changed. PR incoming.

@kienstra

This comment has been minimized.

Copy link
Collaborator

commented Sep 12, 2019

Hi @stevenkword, thanks for bringing this up. I'll look at this, and will look at your PR when it's ready.

@kienstra

This comment has been minimized.

Copy link
Collaborator

commented Sep 12, 2019

It looks like I should have included phpcodesniffer-composer-installer in composer.json, like how the AMP plugin does.

At least locally, npm run lint:php is passing with this diff:

diff --git a/composer.json b/composer.json
index 65c4261..fe7f046 100644
--- a/composer.json
+++ b/composer.json
@@ -8,6 +8,7 @@
         "php": "^5.6 || ^7"
     },
     "require-dev": {
+        "dealerdirect/phpcodesniffer-composer-installer": "0.5.0",
         "brain/monkey": "^2",
         "squizlabs/php_codesniffer": "^3.4",
         "wp-coding-standards/wpcs": "2.1.1"
diff --git a/phpcs.xml b/phpcs.xml
index b337e37..1088de7 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -2,7 +2,7 @@
 <ruleset name="WordPress Coding Standards for Plugins">
     <description>Generally-applicable sniffs for WordPress plugins</description>
 
-    <rule ref="WordPress" />
+    <rule ref="WordPress-Core" />
 
     <rule ref="WordPress.Files.FileName.InvalidClassFileName">
         <exclude-pattern>tests/*</exclude-pattern>
block-lab $
@kienstra

This comment has been minimized.

Copy link
Collaborator

commented Sep 19, 2019

Question about phpcs

Hi @stevenkword,
Hope you're doing great.

Were you able to run phpcs without error in this repo?

Doing npm run lint:php should run that command and shouldn't show any error or warning. As long as composer install was run at some point.

Thanks, Steven!

@kienstra kienstra closed this Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.