wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Filter depth and processed elements' tags

Open wordpressfan opened this issue 1 year ago • 2 comments

Description

Fixes #6904

Explain how this code impacts users.

This PR adds two filters:

  1. rocket_lazy_render_content_depth: returns integer value with default of 2 to adjust the depth.
  2. rocket_lazy_render_content_processed_tags: returns array value with default of:
[
	'DIV',
	'MAIN',
	'FOOTER',
	'SECTION',
	'ARTICLE',
	'HEADER',
]

To adjust the elements to be processed by this feature.

Type of change

  • [x] Enhancement (non-breaking change which improves an existing functionality).

Detailed scenario

As groomed and mentioned above.

Technical description

Documentation

We only added the filters as mentioned above

New dependencies

No

Risks

We shouldn't have any risk here, we just added the filter so the user can change those values, the only think that I can think of, is that the user can break the functionality by returning not valid elements from the tags filter or by decreasing the depth value.

Mandatory Checklist

Code validation

  • [x] I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • [x] I triggered all changed lines of code at least once without new errors/warnings/notices.

Code style

  • [x] I wrote a self-explanatory code about what it does.
  • [x] I protected entry points against unexpected inputs.

Additional Checks

  • [x] In the case of complex code, I wrote comments to explain it.
  • [x] When possible, I prepared ways to observe the implemented system (logs, data, etc.).

wordpressfan avatar Aug 27 '24 12:08 wordpressfan

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 7999ed2618d11d7fa9b63fc78a7810789072d4b9[^1] :x: 20.70% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (7999ed2618d11d7fa9b63fc78a7810789072d4b9) Report Missing Report Missing Report Missing
Head commit (d734781d7a8aa2dfc70b1e085b61f5f1fbe185a4) 37943 9516 25.08%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#6917) 570 118 20.70%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines 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.

codacy-production[bot] avatar Aug 27 '24 12:08 codacy-production[bot]

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
:white_check_mark: -0.01% (target: -0.10%) :white_check_mark: 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (d7a5719c9211d080f22af8594480b3f260219196) 37925 16540 43.61%
Head commit (1599c451c6b4da471a50c97302931f9832e79bd0) 37917 (-8) 16532 (-8) 43.60% (-0.01%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#6917) 21 21 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines 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

codacy-production[bot] avatar Aug 27 '24 12:08 codacy-production[bot]

Closing this PR as it is merged in #6929 which will be merged in LRC branch already

MathieuLamiot avatar Aug 30 '24 12:08 MathieuLamiot