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

Closes #40: 3.19 Preload fonts beacon processing part #42

Open
wants to merge 19 commits into
base: feature/3.19-beacons
Choose a base branch
from

Conversation

jeawhanlee
Copy link
Contributor

@jeawhanlee jeawhanlee commented Feb 18, 2025

Description

Closes wp-media/wp-rocket#7241
Closes wp-media/wp-rocket#7270

Adds new script to the beacon to extract fonts used above the fold.

Type of change

  • New feature (non-breaking change which adds functionality).

Detailed scenario

N/A

Technical description

Documentation

The BeaconPreloadFonts class analyzes font usage on a webpage, focusing on fonts visible above the fold. It detects network-loaded and stylesheet fonts, checks for system fonts, and verifies element visibility. The class cleans URLs, extracts @font-face rules, and summarizes font usage data, including counts of elements using each font. It logs results and handles errors during processing. Overall, it helps optimize font loading for better user experience.

New dependencies

N/A

Risks

List possible performance & security issues or risks, and explain how they have been mitigated.
See here

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

N/A

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

@jeawhanlee jeawhanlee self-assigned this Feb 18, 2025
Copy link

codacy-production bot commented Feb 18, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+4.74% (target: -1.00%) 79.70% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (1e2e9c7) 677 466 68.83%
Head commit (862ae55) 1207 (+530) 888 (+422) 73.57% (+4.74%)

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 (#42) 537 428 79.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

@jeawhanlee jeawhanlee linked an issue Feb 18, 2025 that may be closed by this pull request
@jeawhanlee jeawhanlee requested review from a team and Miraeld February 19, 2025 10:01
@jeawhanlee jeawhanlee changed the base branch from develop to feature/3.19-beacons February 19, 2025 10:39
@jeawhanlee
Copy link
Contributor Author

Some codacy issues to fix but can be reviewed now.

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