Skip to content

Commit 5395619

Browse files
committed
~ Added PHPCS and GitHub Action to accommodate it
1 parent f403635 commit 5395619

File tree

5 files changed

+354
-0
lines changed

5 files changed

+354
-0
lines changed

.github/workflows/php-lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: PHP Lint
2+
3+
on: [push]
4+
5+
jobs:
6+
PHPCS:
7+
name: PHPCS
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Install dependencies
12+
run: composer install --dev --prefer-dist --no-progress --no-suggest
13+
- name: PHPCS check
14+
uses: chekalsky/phpcs-action@v1
15+
with:
16+
phpcs_bin_path: './vendor/bin/phpcs'

.gitignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# macOS Junk Files
2+
.DS_Store
3+
4+
# Composer
5+
/vendor
6+
7+
# NPM/Yarn
8+
/node_modules
9+
10+
# IDE
11+
.idea
12+
13+
# Transpiled/Built/Minified Files
14+
*.js.map
15+
*.min.js
16+
*.css.map
17+
*.min.css
18+
/dist
19+
/js/built
20+
21+
# Cypress
22+
cypress/screenshots
23+
cypress/videos
24+
25+
# Private Files (Personal or sensitive info to not version control)
26+
.env
27+
.envrc
28+
*.log
29+
_output
30+
results.xml

composer.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"require-dev": {
3+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
4+
"wp-coding-standards/wpcs": "^2.3",
5+
"phpcompatibility/php-compatibility": "*"
6+
},
7+
"scripts": {
8+
"lint": "phpcs",
9+
"lint:fix": "phpcbf"
10+
}
11+
}

composer.lock

Lines changed: 263 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpcs.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Gravity Wiz Coding Standards">
3+
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
4+
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
5+
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/blob/develop/WordPress-Core/ruleset.xml -->
6+
7+
<arg name="extensions" value="php,css"/>
8+
9+
<file>.</file>
10+
11+
<!-- Exclude Composer vendor directory. -->
12+
<exclude-pattern>*/vendor/*</exclude-pattern>
13+
14+
<!-- Exclude NPM modules -->
15+
<exclude-pattern>*/node_modules/*</exclude-pattern>
16+
17+
<!-- Handled by ESLint -->
18+
<exclude-pattern>*.js</exclude-pattern>
19+
20+
<!-- Run against the PHPCompatibility ruleset -->
21+
<rule ref="PHPCompatibility"/>
22+
<config name="testVersion" value="5.6-"/>
23+
24+
<!-- Turns on the WordPress Standard -->
25+
<rule ref="WordPress-Core">
26+
<exclude name="WordPress.PHP.YodaConditions.NotYoda" />
27+
<exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase" />
28+
<exclude name="WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase" />
29+
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
30+
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
31+
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
32+
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
33+
</rule>
34+
</ruleset>

0 commit comments

Comments
 (0)