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 version 2.2.1 #1855

Merged
merged 21 commits into from
Feb 4, 2020
Merged

Release version 2.2.1 #1855

merged 21 commits into from
Feb 4, 2020

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jan 30, 2020

⚠️ DO NOT MERGE (YET) ⚠️

Please do add approvals if you agree as otherwise I won't be able to release.

PR for tracking changes for the 2.2.1 release. Target release date: Sunday February 2 Tuesday February 4.

  • Check if the minimum WP version property needs updating and if so, action it - N/A
  • Check if the DeprecatedFunctions and the other deprecated WP feature sniffs need updating and if so, action it - N/A
  • Add changelog for 2.2.1 - PR Changelog for WPCS 2.2.1 #1854
  • Merge this PR
  • Add release tag against master (careful, GH defaults to develop!) & copy & paste the changelog to it
  • Close the 2.2.1 milestone
  • Open a new milestone for the next release
  • If any open PRs/issues which were milestoned for 2.2.1 do not make it into the release, update their milestone. (not applicable)
  • Tweet about the release.
  • Post about it in Slack.
  • Submit for "Month in WordPress": https://make.wordpress.org/community/month-in-wordpress-submissions/
  • Open PR to merge master into develop to get rid of the This branch is out-of-date with the base branch messages on each release. (only after major releases)

jrfnl and others added 14 commits November 21, 2019 00:55
Closure `use` parentheses do not have a parenthesis owner.

While this is a plaster on the wound as the sniff really needs to be split up, for now, it fixes the notice.

Fixes 1792
As [PHP 7.4 has been released](https://www.php.net/archive/2019.php#2019-11-28-1), the build against PHP 7.4 should no longer be allowed to fail.

Includes fixing the `language` setting. This can't be an array and thrown warnings as it was when the Travis script is validated.
Travis: don't allow PHP 7.4 build to fail
Add metrics to make it easier for people to decide whether or not to en/disable this rule.

The generated metrics will look like this and can be called up using `--report=info`:
```
PHP CODE SNIFFER INFORMATION REPORT
----------------------------------------------------------------------
Multi-line array - comma after last item:
	no    => 2,064 ( 95.82%)
	yes   =>    90 (  4.18%)
	-------------------------
	total => 2,154 (100.00%)

Single line array - comma after last item: 0 [804/804, 100%]
```
…spacing-closure-use-return-type

ControlStructureSpacing: fix undefined index error
…dd-metrics

CommaAfterArrayItem: add metrics for comma after last item
The metrics for this sniff would be different depending on whether or not a (custom/default) whitelist was used.

If `use_default_whitelist` was set to `false` and no custom whitelist was passed, the metrics would look something like this:
```
Error silencing:
        @Header( 'Content-Type: ' ...                 => 1 ( 12.50%)
        @Header( 'Content-type: application/json' ... => 1 ( 12.50%)
        @Header( 'X-Robots-Tag: noindex' ...          => 1 ( 12.50%)
        @ignore_user_abort( true ...                  => 1 ( 12.50%)
        @include_once $converter_file...              => 1 ( 12.50%)
        @ini_get( 'disable_functions' ...             => 1 ( 12.50%)
        @ini_set( $key,...                            => 1 ( 12.50%)
        @is_file( $this->...                          => 1 ( 12.50%)
        -------------------------------------------------------------
        total                                         => 8 (100.00%)
```

... while if `use_default_whitelist` was set to `true` òr a custom whitelist was passed, those same metrics would look something like this:
```
PHP CODE SNIFFER INFORMATION REPORT
----------------------------------------------------------------------
Error silencing:
        header                             => 3 ( 37.50%)
        @include_once $converter_file...   => 1 ( 12.50%)
        ignore_user_abort                  => 1 ( 12.50%)
        ini_get                            => 1 ( 12.50%)
        ini_set                            => 1 ( 12.50%)
        whitelisted function call: is_file => 1 ( 12.50%)
        --------------------------------------------------
        total                              => 8 (100.00%)

----------------------------------------------------------------------
```

The change now made will make it so:
* the grouping by function will always happen;
* function calls will consistently be prefixed with a `@`, unless whitelisted, in which case they are prefixed with `whitelisted function call: ` (like before).

The improved metrics will look something like this:

```
PHP CODE SNIFFER INFORMATION REPORT
----------------------------------------------------------------------
Error silencing:
        @Header                            => 3 ( 37.50%)
        @ignore_user_abort                 => 1 ( 12.50%)
        @include_once $converter_file...   => 1 ( 12.50%)
        @ini_get                           => 1 ( 12.50%)
        @ini_set                           => 1 ( 12.50%)
        whitelisted function call: is_file => 1 ( 12.50%)
        --------------------------------------------------
        total                              => 8 (100.00%)

----------------------------------------------------------------------
```
Looks like Travis (finally) has got a "normal" PHP 7.4 image available.

While we're at it, let's add a build against `nightly` (PHP 8) back which is allowed to fail.
NoSilencedErrors: improve consistency metrics
Travis: test against PHP 7.4, not snapshot
Fix off-by-one error when $treat_files_as_scoped is true
…_color to the list of escaping functions. Fixes #1846
The DealerDirect Composer plugin has just released version `0.6.0`.
As Composer treats minors < 1.0 as majors, updating to this version requires an update to the `composer.json` requirements.

> For pre-1.0 versions it also acts with safety in mind and treats `^0.3` as `>=0.3.0 <0.4.0`.

Refs:
* https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases/tag/v0.6.0
* https://getcomposer.org/doc/articles/versions.md#caret-version-range-
@jrfnl jrfnl added this to the 2.2.1 milestone Jan 30, 2020
@jrfnl jrfnl requested a review from a team January 30, 2020 00:17
Copy link
Member

@dingo-d dingo-d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

dingo-d and others added 2 commits January 30, 2020 09:37
…y-suggestion

Update suggested version of Composer PHPCS plugin
When a function call to one of the singular/plural text translation functions - like `_n_noop()` - is missing an argument, the sniff would still try an execute the `compare_single_and_plural_arguments()` check and on PHP 7.4 would generate a "Trying to access array offset on value of type null" error which would stop the PHPCS run dead with an `Internal.Exception` error code.

Fixed by skipping the check in that case. The missing argument should be reported by the preceding `check_argument_tokens()` check anyhow.

Includes unit test.
@jrfnl
Copy link
Member Author

jrfnl commented Feb 1, 2020

Due to the bug exposed by PR #1857 for which a fix is pulled in #1858, I'm delaying the release with two days to allow that fix to go in and be included in the release.

paulschreiber and others added 4 commits February 2, 2020 15:20
Let sanitize_hex_color() count as an escape function
I18n: bug fix - trying to access array offset on null (PHP 7.4)
* Release date set at this **Tuesday February 4rd**.
* Includes all currently merged changes.
Copy link
Member

@GaryJones GaryJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than merging in the changelog, the rest LGTM.

@jrfnl jrfnl merged commit b5a4532 into master Feb 4, 2020
@jrfnl
Copy link
Member Author

jrfnl commented Feb 4, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants