wp-media / wp-rocket

Performance optimization plugin for WordPress
https://wp-rocket.me
GNU General Public License v2.0
701 stars 220 forks source link

Closes #7119 #7132

Open Khadreal opened 1 week ago

Khadreal commented 1 week ago

Description

Fixes #7119 Nothing impacts users.

Type of change

Detailed scenario

n/a

Technical description

Documentation

This pull request introduces several changes to enhance PHPStan integration and adds a new custom rule for validating @param tags in docblocks. The most important changes include adding a new script to reset the PHPStan baseline, updating the PHPStan configuration files, and implementing a custom PHPStan rule.

Enhancements to PHPStan integration:

Implementation of a custom PHPStan rule:

Code validation

Code style

codacy-production[bot] commented 1 week ago

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for dd33f7bebe6db79b5c4cff9609a2e9a1480173dc[^1] :white_check_mark: (target: 50.00%)
Coverage variation details | | Coverable lines | Covered lines | Coverage | | ------------- | ------------- | ------------- | ------------- | | Common ancestor commit (dd33f7bebe6db79b5c4cff9609a2e9a1480173dc) | Report Missing | Report Missing | Report Missing | | | Head commit (97c1c8d348732a3757be180a4abf87a4e7a9e4cd) | 38228 | 16731 | 43.77% | **Coverage variation** is the difference between the coverage for the head and common ancestor commits of the pull request branch: ` - `
Diff coverage details | | Coverable lines | Covered lines | Diff coverage | | ------------- | ------------- | ------------- | ------------- | | Pull request (#7132) | 0 | 0 | **∅ (not applicable)** | **Diff coverage** is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: `/ * 100%`

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more [^1]: Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

Miraeld commented 1 day ago

As we are getting some complexities in the test of this rules, we've decided to seperate the rule and the test in two issues.

This is why I'm deleting the beginning of test implementation from this PR, to create a new issue for it.

To make it short, the problem that is happening in here is that the custom rules is able to parse docblocks while running for real code. But in the tests, it's detecting the docblock but considering them empty, and we can't explain it at the moment.

As we don't want to block any development made, we've decided to proceed with manual test at first, and implement tests in a second step.

remyperona commented 1 day ago

Did we validate that all possible errors are correctly covered?

Miraeld commented 1 day ago

@remyperona as I said in the comment, unit tests are a bit tricky with the docblock. If you feel like you could add them please feel free. Otherwise I will wait @CrochetFeve0251 to be available to take a look at them. That's why I originated created another issue. I tried to manually test everything I could think off, and it was working tho.

remyperona commented 1 day ago

If we did manual testing for the possible cases, sounds good.