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

YoastCS: upgrade to WordPressCS 3.0.1 #323

Merged
merged 4 commits into from
Nov 3, 2023
Merged

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Nov 3, 2023

Composer: use WordPressCS 3.0.1+

  • Update the dependency.
  • Make the associated workflow adjustments.
  • Update the YoastCS ruleset for WPCS 3.0:
    • Update a renamed property name.
    • Update sniff references for sniffs which have been swopped over to other sniffs.
    • Remove inclusion of various sniffs which are now included in WPCS (Core/Extra) or have an equivalent included.
    • Undo the silencing of the Modernize.FunctionCalls.Dirname.Nested (PHP 7.0+) error code as the majority of the Yoast repos have a PHP 7.2 minimum.
    • Redo the silencing of the Modernize.FunctionCalls.Dirname.Nested (PHP 7.0+) error code specifically for the YoastCS codebase as it still has a PHP 5.4 minimum.

Refs:

NamingConventions/ObjectNameDepth: account for upstream WPCS changes

Update some function calls using WPCS native utilities, which still exist, but have been moved around or have a changed signature.

Ref:

NamingConventions/ValidHookName::transform(): sync parameter names

The parameter name of the upstream method was updated in WPCS 3.0.0 to not overlap with a reserved keyword.
And for potential future support of function calls to sniff methods using named parameters, the signature of a method in a child class overloading a method in a parent class should be kept in sync.

This makes it so for the NamingConventions/ValidHookName::transform() method.

CS: minor tweaks to comply with WordPressCS 3.0

jrfnl added 4 commits November 4, 2023 00:29
* Update the dependency.
* Make the associated workflow adjustments.
* Update the YoastCS ruleset for WPCS 3.0:
    - Update a renamed property name.
    - Update sniff references for sniffs which have been swopped over to other sniffs.
    - Remove inclusion of various sniffs which are now included in WPCS (Core/Extra) or have an equivalent included.
    - Undo the silencing of the `Modernize.FunctionCalls.Dirname.Nested` (PHP 7.0+) error code as the majority of the Yoast repos have a PHP 7.2 minimum.
    - Redo the silencing of the `Modernize.FunctionCalls.Dirname.Nested` (PHP 7.0+) error code specifically for the YoastCS codebase as it still has a PHP 5.4 minimum.

Refs:
* https://make.wordpress.org/core/2023/08/21/wordpresscs-3-0-0-is-now-available/
* https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.0.0
* https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.0.1
* https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-ruleset-maintainers
* https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-Developers-of-external-standards
Update some function calls using WPCS native utilities, which still exist, but have been moved around or have a changed signature.

Ref:
* https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-Developers-of-external-standards
The parameter name of the upstream method was updated in WPCS 3.0.0 to not overlap with a reserved keyword.
And for potential future support of function calls to sniff methods using named parameters, the signature of a method in a child class overloading a method in a parent class should be kept in sync.

This makes it so for the `NamingConventions/ValidHookName::transform()` method.
@jrfnl jrfnl added this to the 3.0 milestone Nov 3, 2023
@jrfnl jrfnl changed the title Jrf/yoastcs update to wpcs 3.0 YoastCS: upgrade to WordPressCS 3.0.1 Nov 3, 2023
@coveralls
Copy link

Coverage Status

coverage: 97.644%. remained the same
when pulling 042b770 on JRF/yoastcs-update-to-wpcs-3.0
into 710632b on develop.

@jrfnl jrfnl merged commit 1acd027 into develop Nov 3, 2023
36 checks passed
@jrfnl jrfnl deleted the JRF/yoastcs-update-to-wpcs-3.0 branch November 3, 2023 23:35
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.

2 participants