Skip to content

Commit

Permalink
Add PHPCS and use the WordPress ruleset (#154)
Browse files Browse the repository at this point in the history
* Add composer file, install phpcs and coding standards.

* Add phpcs.xml file.
  • Loading branch information
ryanwelcher authored Oct 5, 2021
1 parent 9c2d258 commit 8766f7c
Show file tree
Hide file tree
Showing 4 changed files with 218 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ index.js.map
*.log
/yarn.lock
.vscode

/vendor/
11 changes: 11 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "wordpress/gutenberg-examples",
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"squizlabs/php_codesniffer": "^3.6",
"wp-coding-standards/wpcs": "^2.3"
},
"scripts": {
"lint": "./vendor/bin/phpcs --standard=phpcs.xml"
}
}
196 changes: 196 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Gutenberg Examples">
<rule ref="WordPress"/>
<arg name="extensions" value="php"/>
<file>.</file>
<!-- Exclude Vendor directory -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
</ruleset>

0 comments on commit 8766f7c

Please sign in to comment.