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

Change how we retrieve rule descriptions when generating the inclusive language database #21779

Merged

Conversation

agnieszkaszuba
Copy link
Contributor

@agnieszkaszuba agnieszkaszuba commented Oct 30, 2024

Context

  • Previously, we retrieved the inclusive language assessment rule descriptions by using a regex to extract them from the functions used to apply the rule. This method was unreliable and didn't work for all rules. Instead, in this PR, a new property is added to each inclusive language assessment with a rule that contains the rule description.

Summary

This PR can be summarized in the following changelog entry:

  • Adds a rule description property to each inclusive language assessment that has a rule.
  • [shopify-seo] Adds a rule description property to each inclusive language assessment that has a rule.

Relevant technical choices:

  • I chose to duplicate the list of precedence/following exceptions that are passed to the functions that apply the rules, and to the function that generates the rule description. Rather than extracting them to a separate variable. I thought that the benefit of avoiding duplication doesn't outweigh the benefit of being able to see the exception lists next to the other assessment data, rather than somewhere else. This way, we can find the information quicker, as well as more easily spot any mistakes or missing exceptions.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Generate the inclusive language database following these instructions: How to generate the inclusive language database.
  • Confirm that the rules for the assessments are outputted correctly. They should be the same as in this file: Inclusive language database test.
  • Smoke test the inclusive language analysis
    • Create a post and add some phrases that have rules, for example: seniors, I'm so OCD, alcoholics, normal person.
    • Confirm that the inclusive language analysis returns feedback for all those phrases.
    • Change some of the phrases so that they are considered inclusive according to the rules, for example: high school seniors, I have OCD, alcoholics anonymous.
    • Confirm that no feedback shows for these phrases.

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:

  • Use the same steps as above, except for the first two steps which do not need to be tested by QA.

Impact check

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

  • No further impact.

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 Improve script for generating inclusive language database so that all rules are outputted

@agnieszkaszuba agnieszkaszuba added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Oct 30, 2024
@coveralls
Copy link

coveralls commented Oct 30, 2024

Pull Request Test Coverage Report for Build a3361a40d4b6a61bf823df4f5c25941691440c50

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 2 files are covered.
  • 114 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.1%) to 57.369%

Files with Coverage Reduction New Missed Lines %
packages/js/src/general/app.js 12 0.0%
packages/js/src/general/store/alert-center.js 15 52.54%
packages/js/src/first-time-configuration/first-time-configuration-steps.js 87 0.0%
Totals Coverage Status
Change from base Build bc6d99581204013d45809c4a7fae57c52efedbed: 0.1%
Covered Lines: 13308
Relevant Lines: 22842

💛 - Coveralls

@agnieszkaszuba agnieszkaszuba added the Shopify This PR impacts Shopify. label Oct 30, 2024
@@ -89,27 +79,12 @@ describe( "Export of the inclusive language configuration", () => {
resultLines.unshift( header.join( ";" ) );

// Set doExport to true to write the results to a temporary file.
const doExport = false;
const doExport = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this value be set back to false before merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thanks!

@Jordi-PV Jordi-PV added this to the 23.9 milestone Nov 1, 2024
@Jordi-PV
Copy link
Contributor

Jordi-PV commented Nov 1, 2024

Generate the inclusive language database following these instructions: How to generate the inclusive language database.

Just to confirm, even though it creates the inclusive-language-database.csv file and the rules for the assessments are outputted correctly matching the Inclusive language database test, I get an error when running the inclusiveLanguage test 🤔

@Jordi-PV
Copy link
Contributor

Jordi-PV commented Nov 1, 2024

AT 👍 It works like a charm
CR 👍 (i just left one small comment before merging it)

@@ -36,7 +36,7 @@ export default class InclusiveLanguageAssessment {
* @returns {void}
Copy link
Contributor

Choose a reason for hiding this comment

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

Also good to add the description of these parameters:

 * @param {string} [config.ruleDescription] A description of the rule.
 * @param {string} [config.category] The category of the assessment.

@agnieszkaszuba
Copy link
Contributor Author

Thanks, I've implemented both your suggestions! About the error, I think I've always had it when I run the command, so it is not a problem. I added to the documentation that this error is expected.

@Jordi-PV Jordi-PV merged commit 91a8f44 into trunk Nov 5, 2024
16 checks passed
@Jordi-PV Jordi-PV deleted the add-rule-description-field-to-inclusive-language-assessments branch November 5, 2024 08:07
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 Shopify This PR impacts Shopify.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants