Skip to content

Commit 6cd0a6a

Browse files
authored
Merge pull request #699 from Automattic/develop
Release 2.3.3
2 parents efacebe + 8808483 commit 6cd0a6a

File tree

12 files changed

+33
-24
lines changed

12 files changed

+33
-24
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ composer.lock
44
phpcs.xml
55
.phpcs.xml
66
phpunit.xml
7+
phpcs.cache

.phpcs.xml.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<arg name="extensions" value="php"/>
1414
<arg name="parallel" value="50"/>
1515

16+
<!-- Cache the results between runs. -->
17+
<arg name="cache" value="./phpcs.cache"/>
18+
1619
<rule ref="WordPress-Extra">
1720
<exclude name="WordPress.Files.FileName"/>
1821
<exclude name="WordPress.NamingConventions.ValidVariableName"/>

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ 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.3.3] - 2021-09-29
8+
9+
Props: gudmdharalds, jrfnl, BrookeDot, rebeccahum
10+
11+
## Changed
12+
- [#690](https://github.com/Automattic/VIP-Coding-Standards/pull/690): Ruleset: do not flag undefined variables in file scope or unused variables before require statement.
13+
- [#691](https://github.com/Automattic/VIP-Coding-Standards/pull/691): Composer: use VariableAnalysis 2.11.1.
14+
- [#694](https://github.com/Automattic/VIP-Coding-Standards/pull/694): PHPCS: enable caching for quicker scanning.
15+
- [#697](https://github.com/Automattic/VIP-Coding-Standards/pull/697): ProperEscapingFunction: upgrade htmlAttrNotByEscHTML to default severity level.
16+
17+
## Removed
18+
- [#692](https://github.com/Automattic/VIP-Coding-Standards/pull/692): RestrictedFunctions: remove dbDelta group.
19+
720
## [2.3.2] - 2021-04-28
821

922
Props: jrfnl
@@ -557,6 +570,7 @@ Initial release.
557570
Props: david-binda, pkevan.
558571

559572

573+
[2.3.3]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.3.2...2.3.3
560574
[2.3.2]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.3.1...2.3.2
561575
[2.3.1]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.3.0...2.3.1
562576
[2.3.0]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.2.0...2.3.0

WordPress-VIP-Go/ruleset-test.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ filter_var_array( $array, FILTER_SANITIZE_STRING ); // Ok.
111111
filter_input_array( $array,FILTER_SANITIZE_STRING ); // Ok.
112112
filter_input( INPUT_GET, 'foo', FILTER_DEFAULT ); // Warning.
113113

114-
// WordPressVIPMinimum.Functions.RestrictedFunctions.dbDelta_dbdelta
115-
dbDelta( $query, true ); // Warning.
114+
115+
116116

117117
// WordPressVIPMinimum.Functions.RestrictedFunctions.wp_mail_wp_mail
118118
wp_mail(); // Warning.

WordPress-VIP-Go/ruleset-test.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@
147147
108 => 1,
148148
109 => 1,
149149
112 => 1,
150-
115 => 1,
151150
118 => 1,
152151
119 => 1,
153152
123 => 1,

WordPress-VIP-Go/ruleset.xml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,6 @@
132132
<rule ref="WordPressVIPMinimum.Security.PHPFilterFunctions">
133133
<severity>10</severity>
134134
</rule>
135-
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.dbDelta_dbdelta">
136-
<type>warning</type>
137-
<severity>7</severity>
138-
</rule>
139135
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.wp_mail_wp_mail">
140136
<severity>7</severity>
141137
</rule>
@@ -233,10 +229,6 @@
233229
<rule ref="Generic.PHP.NoSilencedErrors">
234230
<severity>1</severity>
235231
</rule>
236-
<rule ref="WordPressVIPMinimum.Security.ProperEscapingFunction.htmlAttrNotByEscHTML">
237-
<!-- This is still safe, just sub-optimal-->
238-
<severity>3</severity>
239-
</rule>
240232
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.is_multi_author_is_multi_author">
241233
<severity>1</severity>
242234
</rule>
@@ -251,6 +243,15 @@
251243
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable">
252244
<severity>0</severity>
253245
</rule>
246+
247+
<!-- Do not report on undefined variables before require nor in file scope. -->
248+
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis">
249+
<properties>
250+
<property name="allowUnusedVariablesBeforeRequire" value="true"/>
251+
<property name="allowUndefinedVariablesInFileScope" value="true"/>
252+
</properties>
253+
</rule>
254+
254255
<rule ref="WordPress.DB.SlowDBQuery.slow_db_query_meta_key">
255256
<!-- We are silencing this one because VIP Go has a combined index on meta_key, meta_value-->
256257
<severity>0</severity>

WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,6 @@ public function getGroups() {
7474
'attachment_url_to_postid',
7575
],
7676
],
77-
'dbDelta' => [
78-
'type' => 'error',
79-
'message' => 'All database modifications have to approved by the WordPress.com VIP team.',
80-
'functions' => [
81-
'dbDelta',
82-
],
83-
],
8477
// @link https://docs.wpvip.com/technical-references/code-review/vip-notices/#h-switch_to_blog
8578
'switch_to_blog' => [
8679
'type' => 'warning',

WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ flush_rules(); // Ok - not in global class.
4949
$wp_write->flush_rules(); // Ok - not in global class $wp_rewrite.
5050
$wp_rewrite->flush_rules(); // Error.
5151

52-
db_delta(); // Ok - similarly-named function to dbDelta().
53-
dbDelta(); // Error.
52+
53+
5454

5555
switch_blog(); // Ok - similarly-named function to switch_to_blog().
5656
switch_to_blog( $blogid ); // Warning.

WordPressVIPMinimum/Tests/Functions/RestrictedFunctionsUnitTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public function getErrorList() {
3737
43 => 1,
3838
46 => 1,
3939
50 => 1,
40-
53 => 1,
4140
59 => 1,
4241
62 => 1,
4342
75 => 1,

WordPressVIPMinimum/ruleset-test.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ wpcom_vip_irc(); // Error.
320320
flush_rewrite_rules(); // Error.
321321
$wp_rewrite->flush_rules(); // Error.
322322
attachment_url_to_postid( $url ); // Error.
323-
dbDelta(); // Error.
323+
324324
switch_to_blog( $blogid ); // Warning.
325325
get_page_by_title( $page_title ); // Error.
326326
url_to_postid( $url ); // Error.

0 commit comments

Comments
 (0)