Skip to content

Commit bbde692

Browse files
authored
Merge pull request #94 from rask/feature/cs-as-dependency
Add WP Coding Standards as a dependency
2 parents 735408c + 39c3424 commit bbde692

5 files changed

Lines changed: 211 additions & 19 deletions

File tree

.travis.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,8 @@ before_install:
1414
# Update Composer
1515
- composer self-update
1616

17-
# Install phpcs with wp-coding-standards
18-
- composer create-project wp-coding-standards/wpcs:0.12.0 --no-dev $HOME/wpcs
19-
2017
script:
21-
# Check project with phps
22-
- ~/wpcs/vendor/bin/phpcs --extensions=php --standard=./phpcs.xml -n -p .
23-
24-
# Check that composer is valid and installs correctly
2518
- composer install -o --prefer-dist --no-interaction
19+
20+
# Check project with phps
21+
- ./vendor/bin/phpcs -n -p .

CONTRIBUTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ This project comes with a phpcs configuration (`phpcs.xml`) you can use to check
1414
Run phpcs in the project root directory:
1515

1616
```
17-
phpcs --extensions=php --standard=./phpcs.xml -n -p .
17+
./vendor/bin/phpcs ./
1818
```
1919

20-
Before you can run phpcs, you need to install PHP Codesniffer and WordPress coding standards like so:
20+
You need to install the plugin's development dependencies before you can run the PHPCS checks. A regular
2121

2222
```
23-
composer create-project wp-coding-standards/wpcs:dev-master --no-dev $HOME/wpcs
23+
composer install
2424
```
2525

26-
Or read the official installation instructions here:
26+
should install all the required packages.
27+
28+
You can read the official WPCS installation instructions here:
2729

2830
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards

composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@
1212
],
1313
"require": {
1414
"php": ">=5.3.0"
15+
},
16+
"require-dev": {
17+
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
18+
"wp-coding-standards/wpcs": "0.12.0"
1519
}
1620
}

composer.lock

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

phpcs.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
<ruleset name="anttiviljami-wordpress">
33
<description>For nicer WordPress and PHP development</description>
44

5-
<!-- Don't check composer dependencies -->
6-
<exclude-pattern>/vendor/</exclude-pattern>
7-
8-
<!-- Exclude language files -->
9-
<exclude-pattern>/lang/</exclude-pattern>
5+
<!-- Files and directories to parse -->
6+
<file>./classes/</file>
7+
<file>./inc/</file>
8+
<file>./wp-libre-form.php</file>
9+
10+
<!-- Excluded directories and files -->
11+
<exclude-pattern>*/vendor/*</exclude-pattern>
12+
<exclude-pattern>*/lang/*</exclude-pattern>
13+
<exclude-pattern>*/assets/*</exclude-pattern>
1014

1115
<!-- Disallow tabs altogether -->
1216
<rule ref="Generic.WhiteSpace.DisallowTabIndent.TabsUsed"/>

0 commit comments

Comments
 (0)