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

Expose all assessors and word complexity helpers #21337

Open
wants to merge 19 commits into
base: trunk
Choose a base branch
from

Conversation

FAMarfuaty
Copy link
Contributor

@FAMarfuaty FAMarfuaty commented Apr 24, 2024

Context

  • Currently, in yoastseo package, we only expose the following assessors: Assessor, ContentAssessor, SeoAssessor, and TaxonomyAssessor. The other assessors such as the related keyword and the e-commerce assessors are not exposed.
  • With this PR, we expose the other assessors so that the consumers of the yoastseo package can retrieve those assessors from index.js, instead of using complete path.
  • Additionally, these two helpers for retrieving the word complexity helpers and configs are also exposed in this PR. This way, the consumers of the yoastseo package can easily retrieve the language helpers and configs without the need to import the individual language files.

Summary

This PR can be summarized in the following changelog entry:

  • [yoastseo other] Exposes all assessors and the helpers to retrieve the word complexity configs and helpers.
  • Simplifies the way we import yoastseo modules inside content-analysis-api app.
  • Simplifies the way we import yoastseo modules inside content-analysis app.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

To test the exposing of the word complexity helpers

To test the exposing of the assessors

Related Keyphrase

  • Smoke test the Related keyphrase functionality and confirm that no error occurs

Product assessors

Content analysis API app

  • Make sure that this app still works and no error is found

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • No further impact other than what is covered in the testing instruction above.

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@FAMarfuaty FAMarfuaty added the changelog: other Needs to be included in the 'Other' category in the changelog label Apr 26, 2024
@coveralls
Copy link

coveralls commented Apr 26, 2024

Pull Request Test Coverage Report for Build 763724a873c65f1d00a803286873d46876d0e93a

Details

  • 18 of 18 (100.0%) changed or added relevant lines in 5 files are covered.
  • 3706 unchanged lines in 106 files lost coverage.
  • Overall coverage decreased (-4.3%) to 48.31%

Files with Coverage Reduction New Missed Lines %
admin/class-option-tabs-formatter.php 1 0.0%
src/actions/configuration/first-time-configuration-action.php 1 91.84%
src/builders/indexable-home-page-builder.php 1 98.0%
src/builders/indexable-term-builder.php 1 99.15%
src/context/meta-tags-context.php 1 28.29%
src/generators/breadcrumbs-generator.php 1 64.23%
src/generators/schema/webpage.php 1 90.32%
src/integrations/blocks/structured-data-blocks.php 1 16.0%
src/integrations/settings-integration.php 1 28.49%
src/integrations/watchers/indexable-ancestor-watcher.php 1 98.41%
Totals Coverage Status
Change from base Build 0044dfb1761a21a1413bf8de5e4aec8a6ff0a278: -4.3%
Covered Lines: 24947
Relevant Lines: 53521

💛 - Coveralls

@FAMarfuaty FAMarfuaty marked this pull request as ready for review April 26, 2024 09:00
@FAMarfuaty FAMarfuaty added changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog and removed changelog: other Needs to be included in the 'Other' category in the changelog labels Apr 26, 2024
@FAMarfuaty FAMarfuaty changed the title Expose all assessors Expose all assessors and word complexity helpers Apr 26, 2024
… assessors and word complexity helpers and configs
Copy link
Contributor

@mhkuu mhkuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! 🎉 Just a few small things to consider before we can merge 👍

apps/content-analysis-api/index.js Outdated Show resolved Hide resolved
Comment on lines +2 to +3
import Assessor from "../../../../src/scoring/assessors/collectionPages/seoAssessor.js";
import Paper from "../../../../src/values/Paper.js";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a few of these files, the import end with .js, in others it's without .js. Let's settle on one way for all of these (I guess without .js).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this info on Stackoverflow where the way I understand it is that using file extension is actually better because tools like Webpack can resolve it immediately, except for index.js I guess where we don't need to add the extension. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's use the extension 👍

import SEOAssessor from "../../src/scoring/seoAssessor";
import contentAssessor from "../../src/scoring/contentAssessor";
import SEOAssessor from "../../src/scoring/assessors/seoAssessor";
import contentAssessor from "../../src/scoring/assessors/contentAssessor";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Capital C as it's a class?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we link to this file from somewhere in the code, or perhaps on Confluence? Could you check?

@@ -6,27 +6,27 @@ import { forEach, has, includes, isEmpty, isNull, isObject, isString, isUndefine
import { getLogger } from "loglevel";

// YoastSEO.js dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is a little bit outdated 😅 Could you change the order of the imports so all assessors are together? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git didn't quite understand the move of some files. I think the new code is correct but could you double-check yourself as well? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants