Skip to content

Commit

Permalink
Merge pull request #127 from 10up/feature/phpcs
Browse files Browse the repository at this point in the history
Add composer and PHPCS for local linting
  • Loading branch information
peterwilsoncc authored Sep 20, 2023
2 parents 45d06c3 + 4958d97 commit 3e15a8a
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 52 deletions.
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/node_modules
/tests
/src
/vendor

# Files
.*
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
npm-debug.log
dist/
build/
vendor

# Mac OSX
.DS_Store
Expand Down
23 changes: 15 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,26 @@
"name": "10up/insecure-content-warning",
"description": "Prevent editors from adding insecure content in the editor.",
"type": "wordpress-plugin",
"homepage": "https://github.com/10up/insecure-content-warning",
"license": "GPL-2.0-only",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "10up",
"email": "[email protected]"
}
{
"name": "10up",
"email": "[email protected]",
"homepage": "https://10up.com/",
"role": "Developer"
}
],
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.4"
},
"require-dev": {
"10up/phpcs-composer": "dev-master"
},
"scripts": {
"lint": "./vendor/bin/phpcs . -p -s",
"lint-fix": "./vendor/bin/phpcbf .",
"phpcs:compat": "./vendor/bin/phpcs includes -p --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 7.4- && ./vendor/bin/phpcs insecure-content-warning.php -p --standard=PHPCompatibilityWP --extensions=php --runtime-set testVersion 5.6-"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
Expand Down
85 changes: 41 additions & 44 deletions composer.lock

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

13 changes: 13 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<ruleset name="Project Rules">
<rule ref="10up-Default">
<exclude name="PEAR.NamingConventions.ValidClassName.StartWithCapital" />
<exclude name="PEAR.NamingConventions.ValidClassName.Invalid" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
</rule>

<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
</ruleset>

0 comments on commit 3e15a8a

Please sign in to comment.