Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.3.3 #699

Merged
merged 18 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
330dd4c
Update ruleset.xml to configure VariableAnalysis
gudmdharalds Jun 16, 2021
1d378b2
Fix XML linting issue
gudmdharalds Jun 16, 2021
777ca46
Bump VA to 2.11.1
rebeccahum Jun 22, 2021
f6a4a16
Merge pull request #690 from Automattic/update/variableanalysis-confi…
rebeccahum Jun 22, 2021
00838ae
Remove dbDelta Warning
BrookeDot Jun 24, 2021
75ece92
Account for dbDelta removal in rulesets and tests
rebeccahum Jun 28, 2021
e1eb7c9
Merge pull request #692 from Automattic/remove/dbDelta
rebeccahum Jun 28, 2021
c3a80f0
Downgrade WordPressVIPMinimum.Security.ProperEscapingFunction.htmlAtt…
rebeccahum Jun 30, 2021
3aab322
Merge pull request #693 from Automattic/downgrade_htmlAttrNotByEscHTML
rebeccahum Jun 30, 2021
843af79
Merge pull request #691 from Automattic/update_va_2.11.1
rebeccahum Jul 19, 2021
c64d6a7
PHPCS: enable caching
jrfnl Aug 4, 2021
475870e
Merge pull request #694 from Automattic/JRF/phpcs-enable-caching
rebeccahum Aug 4, 2021
e09c47a
Revert "Downgrade htmlAttrNotByEscHTML to a warning"
rebeccahum Sep 27, 2021
87fd946
ProperEscapingFunction: Upgrade htmlAttrNotByEscHTML to default sever…
rebeccahum Sep 27, 2021
82c3b37
Merge pull request #696 from Automattic/revert-693-downgrade_htmlAttr…
rebeccahum Sep 28, 2021
dad2e32
Merge pull request #697 from Automattic/rebecca/htmlAttrNotByEscHTML_…
rebeccahum Sep 28, 2021
e5d1c81
Add changelog for 2.3.3 release
rebeccahum Sep 28, 2021
8808483
Merge pull request #698 from Automattic/2.3.3-changelog
rebeccahum Sep 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ composer.lock
phpcs.xml
.phpcs.xml
phpunit.xml
phpcs.cache
3 changes: 3 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<arg name="extensions" value="php"/>
<arg name="parallel" value="50"/>

<!-- Cache the results between runs. -->
<arg name="cache" value="./phpcs.cache"/>

<rule ref="WordPress-Extra">
<exclude name="WordPress.Files.FileName"/>
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.

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).

## [2.3.3] - 2021-09-29

Props: gudmdharalds, jrfnl, BrookeDot, rebeccahum

## Changed
- [#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.
- [#691](https://github.com/Automattic/VIP-Coding-Standards/pull/691): Composer: use VariableAnalysis 2.11.1.
- [#694](https://github.com/Automattic/VIP-Coding-Standards/pull/694): PHPCS: enable caching for quicker scanning.
- [#697](https://github.com/Automattic/VIP-Coding-Standards/pull/697): ProperEscapingFunction: upgrade htmlAttrNotByEscHTML to default severity level.

## Removed
- [#692](https://github.com/Automattic/VIP-Coding-Standards/pull/692): RestrictedFunctions: remove dbDelta group.

## [2.3.2] - 2021-04-28

Props: jrfnl
Expand Down Expand Up @@ -557,6 +570,7 @@ Initial release.
Props: david-binda, pkevan.


[2.3.3]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.3.2...2.3.3
[2.3.2]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.3.1...2.3.2
[2.3.1]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.3.0...2.3.1
[2.3.0]: https://github.com/Automattic/VIP-Coding-Standards/compare/2.2.0...2.3.0
Expand Down
4 changes: 2 additions & 2 deletions WordPress-VIP-Go/ruleset-test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ filter_var_array( $array, FILTER_SANITIZE_STRING ); // Ok.
filter_input_array( $array,FILTER_SANITIZE_STRING ); // Ok.
filter_input( INPUT_GET, 'foo', FILTER_DEFAULT ); // Warning.

// WordPressVIPMinimum.Functions.RestrictedFunctions.dbDelta_dbdelta
dbDelta( $query, true ); // Warning.



// WordPressVIPMinimum.Functions.RestrictedFunctions.wp_mail_wp_mail
wp_mail(); // Warning.
Expand Down
1 change: 0 additions & 1 deletion WordPress-VIP-Go/ruleset-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@
108 => 1,
109 => 1,
112 => 1,
115 => 1,
118 => 1,
119 => 1,
123 => 1,
Expand Down
17 changes: 9 additions & 8 deletions WordPress-VIP-Go/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,6 @@
<rule ref="WordPressVIPMinimum.Security.PHPFilterFunctions">
<severity>10</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.dbDelta_dbdelta">
<type>warning</type>
<severity>7</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.wp_mail_wp_mail">
<severity>7</severity>
</rule>
Expand Down Expand Up @@ -233,10 +229,6 @@
<rule ref="Generic.PHP.NoSilencedErrors">
<severity>1</severity>
</rule>
<rule ref="WordPressVIPMinimum.Security.ProperEscapingFunction.htmlAttrNotByEscHTML">
<!-- This is still safe, just sub-optimal-->
<severity>3</severity>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions.is_multi_author_is_multi_author">
<severity>1</severity>
</rule>
Expand All @@ -251,6 +243,15 @@
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable">
<severity>0</severity>
</rule>

<!-- Do not report on undefined variables before require nor in file scope. -->
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis">
<properties>
<property name="allowUnusedVariablesBeforeRequire" value="true"/>
<property name="allowUndefinedVariablesInFileScope" value="true"/>
</properties>
</rule>

<rule ref="WordPress.DB.SlowDBQuery.slow_db_query_meta_key">
<!-- We are silencing this one because VIP Go has a combined index on meta_key, meta_value-->
<severity>0</severity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ public function getGroups() {
'attachment_url_to_postid',
],
],
'dbDelta' => [
'type' => 'error',
'message' => 'All database modifications have to approved by the WordPress.com VIP team.',
'functions' => [
'dbDelta',
],
],
// @link https://docs.wpvip.com/technical-references/code-review/vip-notices/#h-switch_to_blog
'switch_to_blog' => [
'type' => 'warning',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ flush_rules(); // Ok - not in global class.
$wp_write->flush_rules(); // Ok - not in global class $wp_rewrite.
$wp_rewrite->flush_rules(); // Error.

db_delta(); // Ok - similarly-named function to dbDelta().
dbDelta(); // Error.



switch_blog(); // Ok - similarly-named function to switch_to_blog().
switch_to_blog( $blogid ); // Warning.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function getErrorList() {
43 => 1,
46 => 1,
50 => 1,
53 => 1,
59 => 1,
62 => 1,
75 => 1,
Expand Down
2 changes: 1 addition & 1 deletion WordPressVIPMinimum/ruleset-test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ wpcom_vip_irc(); // Error.
flush_rewrite_rules(); // Error.
$wp_rewrite->flush_rules(); // Error.
attachment_url_to_postid( $url ); // Error.
dbDelta(); // Error.

switch_to_blog( $blogid ); // Warning.
get_page_by_title( $page_title ); // Error.
url_to_postid( $url ); // Error.
Expand Down
1 change: 0 additions & 1 deletion WordPressVIPMinimum/ruleset-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
320 => 1,
321 => 1,
322 => 1,
323 => 1,
325 => 1,
326 => 1,
327 => 1,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require": {
"php": ">=5.4",
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7",
"sirbrillig/phpcs-variable-analysis": "^2.8.3",
"sirbrillig/phpcs-variable-analysis": "^2.11.1",
"squizlabs/php_codesniffer": "^3.5.5",
"wp-coding-standards/wpcs": "^2.3"
},
Expand Down