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: more code structure rules #362

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Dec 14, 2023

YoastCS rules: enforce a consistent OO structure order

Related to #303

Impact on Yoast packages:

Plugin/Tool Errors/Warnings
PHPUnit Polyfills --
WP Test Utils --
YoastCS --
WHIP --
Yoast Test Helper --
Duplicate Post --
Yst ACF --
Yst WooCommerce --
Yst News --
Yst Local --
Yst Video --
Yst Premium 1
Yst Free --

Note: this rule was previously already "silently" enforced via clean-up sweeps.

YoastCS rules: disallow long closures

This sniff will throw an error when a closure is more than 10 lines long.

Note: blank lines and comment-only lines are not includes in the closure line count.

Related to #303

Impact on Yoast packages:

Plugin/Tool Errors/Warnings
PHPUnit Polyfills 1 error (11 lines)
WP Test Utils --
YoastCS --
WHIP --
Yoast Test Helper 1 error (17 lines)
Duplicate Post --
Yst ACF --
Yst WooCommerce --
Yst News --
Yst Local 1 error (16 lines)
Yst Video --
Yst Premium 1 error (15 lines)
Yst Free 3 errors (21/25/37 lines)

Related to 303

Impact on Yoast packages:

| Plugin/Tool       | Errors/Warnings |
|-------------------|-----------------|
| PHPUnit Polyfills | --
| WP Test Utils     | --
| YoastCS           | --
| WHIP              | --
| Yoast Test Helper | --
| Duplicate Post    | --
| Yst ACF           | --
| Yst WooCommerce   | --
| Yst News          | --
| Yst Local         | --
| Yst Video         | --
| Yst Premium       | 1
| Yst Free          | --

Note: this rule was previously already "silently" enforced via clean-up sweeps.
This sniff will throw an error when a closure is more than 10 lines long.

Note: blank lines and comment-only lines are not includes in the closure line count.

Related to 303

Impact on Yoast packages:

| Plugin/Tool       | Errors/Warnings |
|-------------------|-----------------|
| PHPUnit Polyfills | 1 error (11 lines)
| WP Test Utils     | --
| YoastCS           | --
| WHIP              | --
| Yoast Test Helper | 1 error (17 lines)
| Duplicate Post    | --
| Yst ACF           | --
| Yst WooCommerce   | --
| Yst News          | --
| Yst Local         | 1 error (16 lines)
| Yst Video         | --
| Yst Premium       | 1 error (15 lines)
| Yst Free          | 3 errors (21/25/37 lines)
@coveralls
Copy link

Coverage Status

coverage: 99.411%. remained the same
when pulling 02d8905 on JRF/yoastcs-more-code-structure-rules
into 340b3a2 on develop.

@jrfnl jrfnl merged commit 39e325a into develop Dec 14, 2023
28 checks passed
@jrfnl jrfnl deleted the JRF/yoastcs-more-code-structure-rules branch December 14, 2023 02:40
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