Skip to content

Commit

Permalink
Merge pull request #6 from openmindculture/wp-code-sniffer
Browse files Browse the repository at this point in the history
add WordPress code sniffer
  • Loading branch information
openmindculture authored Nov 17, 2022
2 parents 78cb3ea + 954a166 commit b340f67
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
themes/
node_modules

vendor
data
wordpress
.wp-cli
!.wp-cli/cache
wp_data
.idea
.svn
incompatibility-status/tags

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ In JetBrains IDEA (PhpStorm, WebStorm, etc.) enable WordPress support and set `w

Some SonarLint warnings (and PHP PSR conventions) should be ignored, like avoiding underscores in function names. As we operate in a global namespace shared with other plugins, it is considered best practice to use a unique prefix for identifiers used for `function`, `class`, and `define`.

A local code sniffer validation can be set up using the provided `composer.json` configuration. Note that this currently does not work with PHP 8, so you need to use a PHP 7.4 runtime (`/usr/bin/php74`). You may need to adjust the IDE settings to WordPress coding standards and code sniffer configurations according to the provided tutorial.

- https://packagist.org/packages/wp-coding-standards/wpcs
- https://www.jetbrains.com/help/idea/using-php-code-sniffer.html#installing-configuring-code-sniffer
- https://www.linuxbabe.com/ubuntu/php-multiple-versions-ubuntu

### SVN Release Tags

We use `git` branches and tags for feature development, and `svn` to release to the WordPress plugin directory. So all development is done in `incompatibility-status/trunk`!
Expand Down
32 changes: 32 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "pantheon-systems/example-wordpress-composer",
"description": "",
"type": "project",
"keywords": [],
"repositories": [
{
"type": "composer",
"url": "https://wpackagist.org"
}
],
"require": {
"php": "^7.4"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.7.1",
"wp-coding-standards/wpcs": "^2.3.0"
},
"config": {
"vendor-dir": "vendor",
"preferred-install": "dist",
"optimize-autoloader": true,
"sort-packages": true,
"platform": {
"php": "7.4"
}
},
"extra": {
"wordpress-install-dir": "wp_data",
"lint": "find src -name '*.php' -exec php -l {} \\;"
}
}
131 changes: 131 additions & 0 deletions composer.lock

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

0 comments on commit b340f67

Please sign in to comment.