13
13
14
14
This composer installer plugin allows for easy installation of [ PHP_CodeSniffer] [ codesniffer ] coding standards (rulesets).
15
15
16
- No more symbolic linking of directories, checking out repositories on specific locations and/ or changing
16
+ No more symbolic linking of directories, checking out repositories on specific locations or changing
17
17
the ` phpcs ` configuration.
18
18
19
19
_ Note: This plugin is compatible with both version 2.x and 3.x of_ [ PHP_CodeSniffer] [ codesniffer ]
@@ -30,21 +30,49 @@ That's it.
30
30
31
31
### How it works
32
32
33
- Basically this plugin executes the following steps:
33
+ Basically, this plugin executes the following steps:
34
34
35
35
- This plugin search for ` phpcodesniffer-standard ` packages in all of your currently installed Composer packages.
36
36
- Matching packages and the project itself are scanned for PHP_CodeSniffer rulesets.
37
37
- The plugin will call PHP_CodeSniffer and configure the ` installed_paths ` option.
38
38
39
- ### Calling the plugin directly
39
+ ### Example project
40
40
41
- In some circumstances it is desirable to call this plugin's functionality
41
+ The following is an example Composer project and has included
42
+ multiple ` phpcodesniffer-standard ` packages.
43
+
44
+ ``` json
45
+ {
46
+ "name" : " dealerdirect/example-project" ,
47
+ "description" : " Just an example project" ,
48
+ "type" : " project" ,
49
+ "require" : {},
50
+ "require-dev" : {
51
+ "dealerdirect/phpcodesniffer-composer-installer" : " *" ,
52
+ "object-calisthenics/phpcs-calisthenics-rules" : " *" ,
53
+ "wimg/php-compatibility" : " *" ,
54
+ "wp-coding-standards/wpcs" : " *"
55
+ }
56
+ }
57
+ ```
58
+
59
+ After running ` composer install ` PHP_CodeSniffer just works:
60
+
61
+ ``` bash
62
+ $ ./vendor/bin/phpcs -i
63
+ The installed coding standards are MySource, PEAR, PSR1, PSR2, Squiz, Zend, PHPCompatibility, WordPress,
64
+ WordPress-Core, WordPress-Docs, WordPress-Extra and WordPress-VIP
65
+ ```
66
+
67
+ ### Calling the plugin directly
68
+
69
+ In some circumstances, it is desirable to call this plugin's functionality
42
70
directly. For instance, during development or in [ CI] [ definition-ci ] environments.
43
71
44
72
As the plugin requires Composer to work, direct calls need to be wired through a
45
73
project's ` composer.json ` .
46
74
47
- This is done by adding a call to the ` Plugin::run ` function in the ` script `
75
+ This is done by adding a call to the ` Plugin::run ` function in the ` script `
48
76
section of the ` composer.json ` :
49
77
50
78
``` json
@@ -58,7 +86,7 @@ section of the `composer.json`:
58
86
59
87
```
60
88
61
- The command can then be called using ` composer run-script install-codestandards ` or
89
+ The command can then be called using ` composer run-script install-codestandards ` or
62
90
referenced from other script configurations, as follows:
63
91
64
92
``` json
@@ -75,15 +103,15 @@ referenced from other script configurations, as follows:
75
103
76
104
```
77
105
78
- For more details about Composer scripts, please refer to [ the section on scripts
106
+ For more details about Composer scripts, please refer to [ the section on scripts
79
107
in the Composer manual] [ composer-manual-scripts ] .
80
108
81
109
### Caveats
82
110
83
- When this plugin is installed globally, composer will load the _ global_ plugin rather
84
- than the one from the local repository. Despite [ this behaviour being documented
85
- in the composer manual] [ using-composer-plugins ] , it could potentially cause confusion
86
- as an version of the plugin could be run other than the version specified by the project.
111
+ When this plugin is installed globally, composer will load the _ global_ plugin rather
112
+ than the one from the local repository. Despite [ this behavior being documented
113
+ in the composer manual] [ using-composer-plugins ] , it could potentially confuse
114
+ as an other version of the plugin could be run and not the one specified by the project.
87
115
88
116
## Developing Coding Standards
89
117
@@ -138,7 +166,7 @@ Then please be sure to check out [our vacancies][vacancies].
138
166
139
167
Did not find a matching vacancy? Just [ get in touch] [ get-in-touch ] !
140
168
141
- [ workingatdealerdirect.eu ] [ workingatdealerdirecteu ]
169
+ [ dealerdirect.com ] [ dealerdirectcom ]
142
170
143
171
## License
144
172
@@ -166,14 +194,15 @@ THE SOFTWARE.
166
194
167
195
[ awesome-shield ] : https://img.shields.io/badge/awesome%3F-yes-brightgreen.svg
168
196
[ changelog ] : https://github.com/DealerDirect/phpcodesniffer-composer-installer/releases
169
- [ composer ] : https://getcomposer.org/
170
- [ composer-manual-scripts ] : https://getcomposer.org/doc/articles/scripts.md
171
197
[ codesniffer ] : https://github.com/squizlabs/PHP_CodeSniffer
198
+ [ composer-manual-scripts ] : https://getcomposer.org/doc/articles/scripts.md
199
+ [ composer ] : https://getcomposer.org/
172
200
[ contributing-guidelines ] : CONTRIBUTING.md
173
201
[ contributors ] : https://github.com/dealerdirect/phpcodesniffer-composer-installer/graphs/contributors
202
+ [ dealerdirectcom ] : http://www.dealerdirect.com/en
174
203
[ definition-ci ] : https://en.wikipedia.org/wiki/Continuous_integration
175
204
[ frenck ] : https://github.com/frenck
176
- [ get-in-touch ] : http ://workingatdealerdirect.eu/open-sollicitatie/
205
+ [ get-in-touch ] : https ://www.dealerdirect.com/en/contact
177
206
[ license-shield ] : https://img.shields.io/github/license/dealerdirect/phpcodesniffer-composer-installer.svg
178
207
[ maintenance-shield ] : https://img.shields.io/maintenance/yes/2017.svg
179
208
[ packagist-shield ] : https://img.shields.io/packagist/dt/dealerdirect/phpcodesniffer-composer-installer.svg
@@ -187,8 +216,6 @@ THE SOFTWARE.
187
216
[ travis ] : https://travis-ci.org/DealerDirect/phpcodesniffer-composer-installer
188
217
[ tutorial ] : https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standard-Tutorial
189
218
[ using-composer-plugins ] : https://getcomposer.org/doc/articles/plugins.md#using-plugins
190
- [ vacancies ] : http ://workingatdealerdirect.eu/?post_type=vacancy&s=&department=99
219
+ [ vacancies ] : https ://www.dealerdirect.com/en/vacancies
191
220
[ versioneye-shield ] : https://www.versioneye.com/user/projects/580be0d1d65a7716b613a790/badge.svg
192
221
[ versioneye ] : https://www.versioneye.com/user/projects/580be0d1d65a7716b613a790
193
- [ workingatdealerdirecteu ] : http://www.workingatdealerdirect.eu
194
-
0 commit comments