Skip to content

Commit 03e75dd

Browse files
authored
Merge pull request #488 from Automattic/release/2.1.0
2 parents fc02f49 + 4a8cb7d commit 03e75dd

27 files changed

+345
-292
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
47

58
---
69

@@ -50,3 +53,4 @@ Use `php -v` and `composer show` to get versions.
5053
## Tested Against `master` branch?
5154

5255
- [ ] I have verified the issue still exists in the `master` branch of VIPCS.
56+
- [ ] I have verified the issue still exists in the `develop` branch of VIPCS.

.github/ISSUE_TEMPLATE/enhancement.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
name: Enhancement
33
about: Suggest an improvement for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
47

58
---
69

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Release template
3+
about: Internally used for new releases
4+
title: Release 2.x.y
5+
labels: 'Type: Maintenance'
6+
assignees: GaryJones, rebeccahum
7+
8+
---
9+
10+
⚠️ DO NOT MERGE (YET) ⚠️
11+
12+
Please do add approvals if you agree.
13+
14+
PR for tracking changes for the 2.x.y release. Target release date: DOW DD MMMM.
15+
16+
- [ ] Add changelog for this release.
17+
- [ ] Merge this PR.
18+
- [ ] Add release tag against `master`.
19+
- [ ] Close the current milestone.
20+
- [ ] Open a new milestone for the next release.
21+
- [ ] If any open PRs/issues which were milestoned for this release do not make it into the release, update their milestone.
22+
- [ ] Write a Lobby post.
23+
- [ ] Write an internal P2 post.
24+
- [ ] Open PR to update [Review Bot dependencies](https://github.com/Automattic/vip-go-ci/blob/master/tools-init.sh).

.phpcs.xml.dist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
<!-- Disallow long array syntax -->
3535
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
3636

37+
<!-- Allow short array syntax -->
38+
<rule ref="Generic.Arrays.DisallowShortArraySyntax.Found">
39+
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>
40+
</rule>
41+
3742
<!-- Check code for cross-version PHP compatibility. -->
3843
<config name="testVersion" value="5.6-"/>
3944
<rule ref="PHPCompatibility">

.travis.yml

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,27 @@
1-
dist: xenial
2-
3-
cache:
4-
directories:
5-
- $HOME/.cache/composer/files
6-
7-
language:
8-
- php
9-
10-
before_install:
11-
# Speed up build time by disabling Xdebug.
12-
# https://johnblackbourn.com/reducing-travis-ci-build-times-for-wordpress-projects/
13-
# https://twitter.com/kelunik/status/954242454676475904
14-
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
15-
16-
install:
17-
- composer require squizlabs/php_codesniffer:"$PHPCS_BRANCH" --update-no-dev --no-suggest --no-scripts
18-
- composer install --dev --no-suggest
19-
20-
script:
21-
# Run the unit tests.
22-
- ./bin/unit-tests
23-
24-
# Run ruleset tests.
25-
- ./bin/ruleset-tests
1+
language: php
2+
os: linux
3+
dist: trusty
264

275
env:
286
# `master` is now 3.x.
297
- PHPCS_BRANCH="dev-master"
308
# Lowest supported release in the 3.x series with which VIPCS is compatible.
31-
- PHPCS_BRANCH="3.3.1"
9+
- PHPCS_BRANCH="3.5.5"
10+
11+
cache:
12+
directories:
13+
- $HOME/.cache/composer/files
3214

3315
php:
16+
- 5.4
17+
- 5.5
3418
- 5.6
3519
- 7.0
3620
- 7.1
3721
- 7.2
3822
- 7.3
39-
- "7.4snapshot"
23+
- 7.4
24+
- "nightly"
4025

4126
# Rather than a `matrix` property, we use build stages. This allows early
4227
# build failure for basic linting and sniffing issues.
@@ -49,15 +34,15 @@ stages:
4934

5035
jobs:
5136
allow_failures:
52-
- php: "7.4snapshot"
37+
- php: "nightly"
5338
include:
5439

5540
- stage: lint
56-
php: 7.3
41+
php: 7.4
5742
env: PHPCS_BRANCH="dev-master"
5843
before_install: phpenv config-rm xdebug.ini || echo 'No xdebug config.'
59-
install: false
60-
cache: false
44+
install: skip
45+
cache: skip
6146
script:
6247
# Lint the PHP files against parse errors.
6348
- ./bin/php-lint
@@ -76,12 +61,42 @@ jobs:
7661
- libxml2-utils
7762

7863
- stage: sniff
79-
php: 7.3
64+
php: 7.4
8065
env: PHPCS_BRANCH="dev-master"
8166
before_install: phpenv config-rm xdebug.ini || echo 'No xdebug config.'
82-
install: composer install --dev --no-suggest
67+
install: composer install --no-suggest
8368
script:
8469
# Run PHPCS against VIPCS.
8570
- ./bin/phpcs
8671

8772

73+
before_install:
74+
# Speed up build time by disabling Xdebug.
75+
# https://johnblackbourn.com/reducing-travis-ci-build-times-for-wordpress-projects/
76+
# https://twitter.com/kelunik/status/954242454676475904
77+
- phpenv config-rm xdebug.ini || echo 'No xdebug config.'
78+
79+
# On stable PHPCS versions, allow for PHP deprecation notices.
80+
# Unit tests don't need to fail on those for stable releases where those issues won't get fixed anymore.
81+
- |
82+
if [[ "$TRAVIS_BUILD_STAGE_NAME" != "Sniff" && $PHPCS_BRANCH != "dev-master" ]]; then
83+
echo 'error_reporting = E_ALL & ~E_DEPRECATED' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
84+
fi
85+
86+
install:
87+
- composer require squizlabs/php_codesniffer:"$PHPCS_BRANCH" --no-update --no-suggest --no-scripts
88+
- |
89+
if [[ $TRAVIS_PHP_VERSION == "nightly" ]]; then
90+
# PHPUnit 7.x does not allow for installation on PHP 8, so ignore platform
91+
# requirements to get PHPUnit 7.x to install on nightly.
92+
composer install --ignore-platform-reqs --no-suggest
93+
else
94+
composer install --no-suggest
95+
fi
96+
97+
script:
98+
# Run the unit tests.
99+
- ./bin/unit-tests
100+
101+
# Run ruleset tests.
102+
- ./bin/ruleset-tests

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,37 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.1.0] - 2020-07-07
8+
9+
Bumps requirements to PHPCS 3.5.5+ and WPCS 2.3.0+.
10+
11+
### Added
12+
13+
- `get_page_by_path()` restricted function warning, to suggest `wpcom_vip_get_page_by_path()` function.
14+
- `stats_get_csv()` restricted function error, since this is a Jetpack-only function.
15+
- Expanded list of HTMLExecutingFunctions to include `after`, `appendTo`, `before`, `insertAfter`, `insertBefore`, `prepend`, `prependTo`, `replaceAll` and `replaceWith`.
16+
- Support PHP 5.4+ (down from 5.6+).
17+
- PHP 8 nightly testing.
18+
19+
### Changed
20+
21+
- Expand message for `wp_remote_get()` usage.
22+
- Downgrade `append()` usage violation from Error to Warning for VIP Go, to be consistent with the other HTMLExecutingFunctions.
23+
- Downgrade AdminBarRemoval sniff from Error to Warning for VIP Go.
24+
- Add `get_parent_theme_file_path()` to safelist of path functions for `WordPressVIPMinimum.Files.IncludingFile` sniff.
25+
- Allow short array syntax and fix tests within the VIPCS own coding standards.
26+
- Update issue templates.
27+
28+
### Fixed
29+
30+
- Use new `WordPress.DateTime.RestrictedFunctions` sniff instead of deprecated `WordPress.WP.TimezoneChange`.
31+
- Fixed warnings and information items in Travis.
32+
33+
### Removed
34+
35+
- `get_super_admins()` restricted function rule for VIP Go.
36+
- `WordPressVIPMinimum.VersionControl.MergeConflict` sniff in favour of `Generic.VersionControl.GitMergeConflict`.
37+
738
## [2.0.0] - 2019-07-12
839

940
This release switches from having WPCS `1.*` as a dependency, to WPCS `2.*`. It is not compatible with WPCS `1.*`.
@@ -367,5 +398,6 @@ This release contains breaking changes.
367398
- `wpcom_vip_get_page_by_path` from `WordPressVIPMinimum.VIP.RestrictedFunctions`
368399
- Version check for PHP 7 or less in `WordPressVIPMinimum.Variables.VariableAnalysis` unit test since tests are not failing anymore.
369400

401+
[2.1.0]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.0.0...2.1.0
370402
[2.0.0]: https://github.com/Automattic/VIP-Coding-Standards/compare/1.0.0...2.0.0
371403
[1.0.0]: https://github.com/Automattic/VIP-Coding-Standards/compare/0.4.0...1.0.0

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ Go to https://wpvip.com/documentation/phpcs-review-feedback/ to learn about why
1515

1616
## Minimal requirements
1717

18-
* [PHPCS 3.3.1+](https://github.com/squizlabs/PHP_CodeSniffer/releases)
19-
* [WPCS 2.*](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/releases)
18+
* PHP 5.4+
19+
* [PHPCS 3.5.5+](https://github.com/squizlabs/PHP_CodeSniffer/releases)
20+
* [WPCS 2.3.0+](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/releases)
2021

2122
## Installation
2223

@@ -31,7 +32,7 @@ We recommend the [PHP_CodeSniffer Standards Composer Installer Plugin](https://g
3132

3233
Alternatively, you should register the standard to PHPCS by appending the VIPCS directory to the end of the installed paths. e.g.
3334

34-
`phpcs --config-set installed_paths [/path/to/wpcsstandard],[path/to/vipcsstandard],etc`
35+
`phpcs --config-set installed_paths /path/to/wpcsstandard,path/to/vipcsstandard,etc.`
3536

3637
## Contribution
3738

WordPress-VIP-Go/ruleset-test.inc

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@ function foo_bar_foo() {
218218
}
219219

220220
// WordPressVIPMinimum.UserExperience.AdminBarRemoval
221-
add_filter( 'show_admin_bar', '__return_false' ); // Error.
221+
add_filter( 'show_admin_bar', '__return_false' ); // Warning.
222222
add_filter( 'show_admin_bar', '__return_true' ); // Ok.
223-
show_admin_bar( false ); // Error.
223+
show_admin_bar( false ); // Warning.
224224
show_admin_bar( true ); // Ok.
225-
add_filter( 'show_admin_bar', 'my_own_return_false' ); // Error.
225+
add_filter( 'show_admin_bar', 'my_own_return_false' ); // Warning.
226226
echo '<style type="text/css">
227227
#wpadminbar {
228228
visibility: hidden; /* Error. */
@@ -232,19 +232,19 @@ echo '<style type="text/css">
232232
</style>';
233233
?> <style type="text/css">
234234
#wpadminbar {
235-
visibility: hidden; /* Error. */
236-
display: none; /* Error. */
237-
opacity: 0; /* Error. */
235+
visibility: hidden; /* Warning. */
236+
display: none; /* Warning. */
237+
opacity: 0; /* Warning. */
238238
}
239239
#not-wpadminbar {
240240
visibility: hidden; /* OK. */
241241
display: none; /* OK. */
242242
opacity: 0; /* OK. */
243243
}
244244
.show-admin-bar {
245-
visibility: hidden; /* Error. */
246-
display: none; /* Error. */
247-
opacity: 0; /* Error. */
245+
visibility: hidden; /* Warning. */
246+
display: none; /* Warning. */
247+
opacity: 0; /* Warning. */
248248
}
249249
</style> <?php
250250

@@ -353,7 +353,7 @@ opcache_compile_file( $test_script ); // Error.
353353
opcache_​is_​script_​cached( 'test_script.php' ); // Error.
354354
opcache_​get_​status(); // Error.
355355
opcache_​get_​configuration(); // Error.
356-
get_super_admins(); // Error.
356+
get_super_admins(); // OK.
357357
wpcom_vip_irc(); // Error.
358358
flush_rewrite_rules(); // Error.
359359
$wp_rewrite->flush_rules(); // Error.
@@ -510,7 +510,7 @@ $query_args = array(
510510
// WordPressVIPMinimum.Security.EscapingVoidReturnFunctions.Found
511511
esc_js( _deprecated_argument() ); // Error.
512512
esc_js( _deprecated_constructor() ); // Error.
513-
esc_js( _deprecated_file() ); // Error.
513+
// esc_js( _deprecated_file() ); // Error.
514514
esc_js( _deprecated_function() ); // Error.
515515
esc_js( _deprecated_hook() ); // Error.
516516
esc_js( _doing_it_wrong() ); // Error.
@@ -567,12 +567,8 @@ $_SERVER['HTTP_X_FORWARDED_FOR']; // Error.
567567
$_SERVER["REMOTE_ADDR"]; // Error.
568568
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotValidated,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
569569

570-
// WordPressVIPMinimum.VersionControl.MergeConflict
571-
function is_prime( $n ) {
572-
if ( 2 === $n ) {
573-
}
574-
//phpcs:ignore Generic.PHP.Syntax.PHPSyntax
575-
======= // Error.
576-
if ( $n % 2 === 0 ) {
577-
}
578-
}
570+
// Generic.VersionControl.GitMergeConflict
571+
?>
572+
<<<<<<< HEAD // Error.
573+
574+
>>>>>>> // Error.

WordPress-VIP-Go/ruleset-test.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,6 @@
2525
181 => 1,
2626
187 => 1,
2727
188 => 1,
28-
221 => 1,
29-
223 => 1,
30-
225 => 1,
31-
228 => 1,
32-
229 => 1,
33-
230 => 1,
34-
235 => 1,
35-
236 => 1,
36-
237 => 1,
37-
245 => 1,
38-
246 => 1,
39-
247 => 1,
4028
252 => 1,
4129
255 => 1,
4230
256 => 1,
@@ -56,7 +44,6 @@
5644
353 => 1,
5745
354 => 1,
5846
355 => 1,
59-
356 => 1,
6047
357 => 1,
6148
358 => 1,
6249
359 => 1,
@@ -111,7 +98,7 @@
11198
507 => 1,
11299
511 => 1,
113100
512 => 1,
114-
513 => 1,
101+
// 513 => 1,
115102
514 => 1,
116103
515 => 1,
117104
516 => 1,
@@ -128,7 +115,8 @@
128115
565 => 1,
129116
566 => 1,
130117
567 => 1,
131-
575 => 1,
118+
572 => 1,
119+
574 => 1,
132120
],
133121
'warnings' => [
134122
4 => 1,
@@ -197,6 +185,18 @@
197185
208 => 1,
198186
212 => 1,
199187
217 => 1,
188+
221 => 1,
189+
223 => 1,
190+
225 => 1,
191+
228 => 1,
192+
229 => 1,
193+
230 => 1,
194+
235 => 1,
195+
236 => 1,
196+
237 => 1,
197+
245 => 1,
198+
246 => 1,
199+
247 => 1,
200200
265 => 1,
201201
269 => 1,
202202
273 => 1,

0 commit comments

Comments
 (0)