Browse Source

ci(Travis): restore order to codesniffing

remove wp-enforcer and fix broken sniffs in ci

closes #66
Josh Habdas 2 years ago
parent
commit
cc674fedf0
9 changed files with 168 additions and 173 deletions
  1. 5
    5
      .travis.yml
  2. 0
    3
      bin/lint-config.sh
  3. 0
    10
      bin/lint-php.sh
  4. 6
    15
      composer.json
  5. 95
    135
      composer.lock
  6. 47
    0
      spec/fixtures/theme-dependencies.json
  7. 4
    4
      src/hyperdrive.php
  8. 5
    0
      tests/bootstrap.php
  9. 6
    1
      tests/class-sampletest.spec.php

+ 5
- 5
.travis.yml View File

@@ -35,7 +35,7 @@ matrix:
35 35
       env: WP_TRAVISCI=phpcs
36 36
 
37 37
 install:
38
-  - composer install --prefer-dist
38
+  - composer install --no-interaction
39 39
 
40 40
 before_script:
41 41
   - export PATH="$HOME/.composer/vendor/bin:$PATH"
@@ -50,14 +50,14 @@ before_script:
50 50
     fi
51 51
   - |
52 52
     if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
53
-      composer lint:config
53
+      composer global require wp-coding-standards/wpcs
54
+      phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
54 55
     fi
55 56
 
56 57
 script:
57 58
   - |
58 59
     if [[ ! -z "$WP_VERSION" ]]; then
59
-      composer test:plugin:unit
60
-      bash <(curl -s https://codecov.io/bash) -cF unittests
60
+      composer test:plugin:unit && bash <(curl -s https://codecov.io/bash) -cF unittests
61 61
     fi
62 62
   - |
63 63
     if [[ ! -z "$WP_VERSION" ]]; then
@@ -66,7 +66,7 @@ script:
66 66
     fi
67 67
   - |
68 68
     if [[ "$WP_TRAVISCI" == "phpcs" ]]; then
69
-      composer lint:plugin
69
+      phpcs --standard=phpcs.ruleset.xml $(find src tests -name '*.php')
70 70
     fi
71 71
 
72 72
 after_success:

+ 0
- 3
bin/lint-config.sh View File

@@ -1,3 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-vendor/bin/phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs/

+ 0
- 10
bin/lint-php.sh View File

@@ -1,10 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-VENDOR_DIR=vendor
4
-SEARCH_DIR=.
5
-
6
-if [[ $1 != "" ]]; then
7
-  SEARCH_DIR=$1
8
-fi
9
-
10
-vendor/bin/phpcs --standard=phpcs.ruleset.xml $(find $SEARCH_DIR -name "*.php" -not -path "./$VENDOR_DIR")

+ 6
- 15
composer.json View File

@@ -10,18 +10,16 @@
10 10
     "homepage": "https://habd.as"
11 11
   }],
12 12
   "scripts": {
13
-    "lint:config": "bin/lint-config.sh",
14
-    "lint:plugin": "bin/lint-php.sh ./src",
13
+    "lint:plugin:config": "phpcs --config-set installed_paths vendor/wp-coding-standards/wpcs",
14
+    "lint:plugin:sniff": "phpcs --standard=phpcs.ruleset.xml $(find src tests -name '*.php')",
15
+    "lint:plugin:fix": "phpcbf --standard=phpcs.ruleset.xml $(find src tests -name '*.php')",
15 16
     "test:plugin:unit": "bin/run-specs.php"
16 17
   },
17 18
   "type": "wordpress-plugin",
18
-  "repositories": [{
19
-    "url": "https://github.com/jhabdas/wp-enforcer.git",
20
-    "type": "git"
21
-  }],
22 19
   "require": {
23 20
     "php": ">=5.6",
24
-    "composer/installers": "^1.3"
21
+    "composer/installers": "^1.3",
22
+    "wp-coding-standards/wpcs": "*"
25 23
   },
26 24
   "autoload": {
27 25
     "files": [
@@ -30,18 +28,11 @@
30 28
   },
31 29
   "require-dev": {
32 30
     "kahlan/kahlan": "^3.1",
33
-    "stevegrunwell/wp-enforcer": "dev-master",
34 31
     "antecedent/patchwork": "^2.0"
35 32
   },
36 33
   "extra": {
37 34
     "branch-alias": {
38 35
       "dev-master": "1.0.x-dev"
39 36
     }
40
-  },
41
-  "post-install-cmd": [
42
-  	"wp-enforcer -c phpcs.ruleset.xml"
43
-  ],
44
-  "post-update-cmd": [
45
-  	"wp-enforcer -c phpcs.ruleset.xml"
46
-  ]
37
+  }
47 38
 }

+ 95
- 135
composer.lock View File

@@ -4,7 +4,7 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "content-hash": "d172c872911ff0d94418182cd9578451",
7
+    "content-hash": "91e3e204abfec900f7de96cfc770d0ef",
8 8
     "packages": [
9 9
         {
10 10
             "name": "composer/installers",
@@ -119,103 +119,6 @@
119 119
                 "zikula"
120 120
             ],
121 121
             "time": "2017-04-24T06:37:16+00:00"
122
-        }
123
-    ],
124
-    "packages-dev": [
125
-        {
126
-            "name": "antecedent/patchwork",
127
-            "version": "2.0.6",
128
-            "source": {
129
-                "type": "git",
130
-                "url": "https://github.com/antecedent/patchwork.git",
131
-                "reference": "248daac9af59644ebf25ad1925f8780a7a5e4882"
132
-            },
133
-            "dist": {
134
-                "type": "zip",
135
-                "url": "https://api.github.com/repos/antecedent/patchwork/zipball/248daac9af59644ebf25ad1925f8780a7a5e4882",
136
-                "reference": "248daac9af59644ebf25ad1925f8780a7a5e4882",
137
-                "shasum": ""
138
-            },
139
-            "require": {
140
-                "php": ">=5.4.0"
141
-            },
142
-            "type": "library",
143
-            "notification-url": "https://packagist.org/downloads/",
144
-            "license": [
145
-                "MIT"
146
-            ],
147
-            "authors": [
148
-                {
149
-                    "name": "Ignas Rudaitis",
150
-                    "email": "ignas.rudaitis@gmail.com"
151
-                }
152
-            ],
153
-            "description": "Method redefinition (monkey-patching) functionality for PHP.",
154
-            "homepage": "http://patchwork2.org/",
155
-            "keywords": [
156
-                "aop",
157
-                "aspect",
158
-                "interception",
159
-                "monkeypatching",
160
-                "redefinition",
161
-                "runkit",
162
-                "testing"
163
-            ],
164
-            "time": "2017-05-23T05:41:30+00:00"
165
-        },
166
-        {
167
-            "name": "kahlan/kahlan",
168
-            "version": "3.1.14",
169
-            "source": {
170
-                "type": "git",
171
-                "url": "https://github.com/kahlan/kahlan.git",
172
-                "reference": "ac57e507607e3379c35d517e22573e61e826e98b"
173
-            },
174
-            "dist": {
175
-                "type": "zip",
176
-                "url": "https://api.github.com/repos/kahlan/kahlan/zipball/ac57e507607e3379c35d517e22573e61e826e98b",
177
-                "reference": "ac57e507607e3379c35d517e22573e61e826e98b",
178
-                "shasum": ""
179
-            },
180
-            "require": {
181
-                "php": ">=5.4"
182
-            },
183
-            "require-dev": {
184
-                "squizlabs/php_codesniffer": "^2.7"
185
-            },
186
-            "bin": [
187
-                "bin/kahlan"
188
-            ],
189
-            "type": "library",
190
-            "autoload": {
191
-                "psr-4": {
192
-                    "Kahlan\\": "src/"
193
-                },
194
-                "files": [
195
-                    "src/functions.php"
196
-                ]
197
-            },
198
-            "notification-url": "https://packagist.org/downloads/",
199
-            "license": [
200
-                "MIT"
201
-            ],
202
-            "authors": [
203
-                {
204
-                    "name": "CrysaLEAD"
205
-                }
206
-            ],
207
-            "description": "The PHP Test Framework for Freedom, Truth and Justice.",
208
-            "keywords": [
209
-                "BDD",
210
-                "Behavior-Driven Development",
211
-                "Monkey Patching",
212
-                "TDD",
213
-                "mock",
214
-                "stub",
215
-                "testing",
216
-                "unit test"
217
-            ],
218
-            "time": "2017-04-12T13:22:10+00:00"
219 122
         },
220 123
         {
221 124
             "name": "squizlabs/php_codesniffer",
@@ -296,85 +199,142 @@
296 199
             "time": "2017-05-22T02:43:20+00:00"
297 200
         },
298 201
         {
299
-            "name": "stevegrunwell/wp-enforcer",
300
-            "version": "dev-master",
202
+            "name": "wp-coding-standards/wpcs",
203
+            "version": "0.11.0",
301 204
             "source": {
302 205
                 "type": "git",
303
-                "url": "https://github.com/jhabdas/wp-enforcer.git",
304
-                "reference": "4b5e7b3d0156b641976fc57a192f9a1c0e7c9bcb"
206
+                "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
207
+                "reference": "407e4b85f547a5251185f89ceae6599917343388"
208
+            },
209
+            "dist": {
210
+                "type": "zip",
211
+                "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/407e4b85f547a5251185f89ceae6599917343388",
212
+                "reference": "407e4b85f547a5251185f89ceae6599917343388",
213
+                "shasum": ""
305 214
             },
306 215
             "require": {
307
-                "wp-coding-standards/wpcs": "^0.11.0"
216
+                "squizlabs/php_codesniffer": "^2.8.1"
308 217
             },
309
-            "bin": [
310
-                "bin/wp-enforcer"
311
-            ],
312 218
             "type": "library",
219
+            "notification-url": "https://packagist.org/downloads/",
313 220
             "license": [
314 221
                 "MIT"
315 222
             ],
316 223
             "authors": [
317 224
                 {
318
-                    "name": "Steve Grunwell",
319
-                    "email": "steve@stevegrunwell.com",
320
-                    "homepage": "https://stevegrunwell.com"
225
+                    "name": "Contributors",
226
+                    "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
321 227
                 }
322 228
             ],
323
-            "description": "Git hooks to encourage well-written WordPress.",
229
+            "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
324 230
             "keywords": [
325
-                "PHP_CodeSniffer",
326
-                "WordPress",
327
-                "coding standards",
328
-                "git hooks"
231
+                "phpcs",
232
+                "standards",
233
+                "wordpress"
329 234
             ],
330
-            "support": {
331
-                "source": "https://github.com/stevegrunwell/wp-enforcer",
332
-                "issues": "https://github.com/stevegrunwell/wp-enforcer/issues"
235
+            "time": "2017-03-20T23:17:58+00:00"
236
+        }
237
+    ],
238
+    "packages-dev": [
239
+        {
240
+            "name": "antecedent/patchwork",
241
+            "version": "2.0.6",
242
+            "source": {
243
+                "type": "git",
244
+                "url": "https://github.com/antecedent/patchwork.git",
245
+                "reference": "248daac9af59644ebf25ad1925f8780a7a5e4882"
333 246
             },
334
-            "time": "2017-05-20 15:51:37"
247
+            "dist": {
248
+                "type": "zip",
249
+                "url": "https://api.github.com/repos/antecedent/patchwork/zipball/248daac9af59644ebf25ad1925f8780a7a5e4882",
250
+                "reference": "248daac9af59644ebf25ad1925f8780a7a5e4882",
251
+                "shasum": ""
252
+            },
253
+            "require": {
254
+                "php": ">=5.4.0"
255
+            },
256
+            "type": "library",
257
+            "notification-url": "https://packagist.org/downloads/",
258
+            "license": [
259
+                "MIT"
260
+            ],
261
+            "authors": [
262
+                {
263
+                    "name": "Ignas Rudaitis",
264
+                    "email": "ignas.rudaitis@gmail.com"
265
+                }
266
+            ],
267
+            "description": "Method redefinition (monkey-patching) functionality for PHP.",
268
+            "homepage": "http://patchwork2.org/",
269
+            "keywords": [
270
+                "aop",
271
+                "aspect",
272
+                "interception",
273
+                "monkeypatching",
274
+                "redefinition",
275
+                "runkit",
276
+                "testing"
277
+            ],
278
+            "time": "2017-05-23T05:41:30+00:00"
335 279
         },
336 280
         {
337
-            "name": "wp-coding-standards/wpcs",
338
-            "version": "0.11.0",
281
+            "name": "kahlan/kahlan",
282
+            "version": "3.1.15",
339 283
             "source": {
340 284
                 "type": "git",
341
-                "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
342
-                "reference": "407e4b85f547a5251185f89ceae6599917343388"
285
+                "url": "https://github.com/kahlan/kahlan.git",
286
+                "reference": "1b9b7e5675275c2d23b35bd2a228d6268bda3bf1"
343 287
             },
344 288
             "dist": {
345 289
                 "type": "zip",
346
-                "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/407e4b85f547a5251185f89ceae6599917343388",
347
-                "reference": "407e4b85f547a5251185f89ceae6599917343388",
290
+                "url": "https://api.github.com/repos/kahlan/kahlan/zipball/1b9b7e5675275c2d23b35bd2a228d6268bda3bf1",
291
+                "reference": "1b9b7e5675275c2d23b35bd2a228d6268bda3bf1",
348 292
                 "shasum": ""
349 293
             },
350 294
             "require": {
351
-                "squizlabs/php_codesniffer": "^2.8.1"
295
+                "php": ">=5.4"
296
+            },
297
+            "require-dev": {
298
+                "squizlabs/php_codesniffer": "^2.7"
352 299
             },
300
+            "bin": [
301
+                "bin/kahlan"
302
+            ],
353 303
             "type": "library",
304
+            "autoload": {
305
+                "psr-4": {
306
+                    "Kahlan\\": "src/"
307
+                },
308
+                "files": [
309
+                    "src/functions.php"
310
+                ]
311
+            },
354 312
             "notification-url": "https://packagist.org/downloads/",
355 313
             "license": [
356 314
                 "MIT"
357 315
             ],
358 316
             "authors": [
359 317
                 {
360
-                    "name": "Contributors",
361
-                    "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
318
+                    "name": "CrysaLEAD"
362 319
                 }
363 320
             ],
364
-            "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
321
+            "description": "The PHP Test Framework for Freedom, Truth and Justice.",
365 322
             "keywords": [
366
-                "phpcs",
367
-                "standards",
368
-                "wordpress"
323
+                "BDD",
324
+                "Behavior-Driven Development",
325
+                "Monkey Patching",
326
+                "TDD",
327
+                "mock",
328
+                "stub",
329
+                "testing",
330
+                "unit test"
369 331
             ],
370
-            "time": "2017-03-20T23:17:58+00:00"
332
+            "time": "2017-05-26T12:05:04+00:00"
371 333
         }
372 334
     ],
373 335
     "aliases": [],
374 336
     "minimum-stability": "stable",
375
-    "stability-flags": {
376
-        "stevegrunwell/wp-enforcer": 20
377
-    },
337
+    "stability-flags": [],
378 338
     "prefer-stable": false,
379 339
     "prefer-lowest": false,
380 340
     "platform": {

+ 47
- 0
spec/fixtures/theme-dependencies.json View File

@@ -0,0 +1,47 @@
1
+{
2
+  "twentySeventeen": [[
3
+    "admin-bar",
4
+    "/wp-includes/js/admin-bar.min.js",
5
+    []
6
+  ], [
7
+    "twentyseventeen-skip-link-focus-fix",
8
+    "http://wordpress.dev/wp-content/themes/twentyseventeen/assets/js/skip-link-focus-fix.js?ver=1.0",
9
+    []
10
+  ], [
11
+    "twentyseventeen-global",
12
+    "http://wordpress.dev/wp-content/themes/twentyseventeen/assets/js/global.js?ver=1.0",
13
+    [[
14
+      "jquery",
15
+      "",
16
+      [[
17
+        "jquery-core",
18
+        "/wp-includes/js/jquery/jquery.js?ver=1.12.4",
19
+        []
20
+      ], [
21
+        "jquery-migrate",
22
+        "/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1",
23
+        []
24
+      ]]
25
+    ]]
26
+  ], [
27
+    "jquery-scrollto",
28
+    "http://wordpress.dev/wp-content/themes/twentyseventeen/assets/js/jquery.scrollTo.js?ver=2.1.2",
29
+    [[
30
+      "jquery",
31
+      "",
32
+      [[
33
+        "jquery-core",
34
+        "/wp-includes/js/jquery/jquery.js?ver=1.12.4",
35
+        []
36
+      ], [
37
+        "jquery-migrate",
38
+        "/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1",
39
+        []
40
+      ]]
41
+    ]]
42
+  ], [
43
+    "wp-embed",
44
+    "/wp-includes/js/wp-embed.min.js",
45
+    []
46
+  ]]
47
+}

+ 4
- 4
src/hyperdrive.php View File

@@ -46,8 +46,8 @@ namespace hyperdrive;
46 46
  * @since 1.0.0
47 47
  */
48 48
 defined( 'ABSPATH' )
49
-    ? add_action( 'wp_head', __NAMESPACE__ . '\engage' )
50
-    : die( 'Now you are going to die! BAM!' );
49
+	? add_action( 'wp_head', __NAMESPACE__ . '\engage' )
50
+	: die( 'Now you are going to die! BAM!' );
51 51
 
52 52
 /**
53 53
  * Calibrates Hyperdrive thrusters.
@@ -262,7 +262,7 @@ function get_dependency_data( $handles ) {
262 262
 			$dependency_data[] = array(
263 263
 				$handle,
264 264
 				$source_url,
265
-				array() // Maintain thrust.
265
+				array(), // Maintain thrust.
266 266
 			);
267 267
 		}
268 268
 		$deps = get_deps_for_handle( $handle );
@@ -270,7 +270,7 @@ function get_dependency_data( $handles ) {
270 270
 			$dependency_data[] = array(
271 271
 				$handle,
272 272
 				'', // Maintain thrust.
273
-				get_dependency_data( $deps )
273
+				get_dependency_data( $deps ),
274 274
 			);
275 275
 		}
276 276
 	}

+ 5
- 0
tests/bootstrap.php View File

@@ -1,4 +1,9 @@
1 1
 <?php
2
+/**
3
+ * PHPUnit bootstrap file.
4
+ *
5
+ * @package Hyperdrive
6
+ */
2 7
 
3 8
 $_tests_dir = getenv( 'WP_TESTS_DIR' );
4 9
 if ( ! $_tests_dir ) {

+ 6
- 1
tests/class-sampletest.spec.php View File

@@ -1,7 +1,12 @@
1 1
 <?php
2
-
3 2
 /**
4 3
  * Sample test case.
4
+ *
5
+ * @package Hyperdrive
6
+ */
7
+
8
+/**
9
+ * Sample test.
5 10
  */
6 11
 class SampleTest extends WP_UnitTestCase {
7 12
 

Loading…
Cancel
Save