-
Notifications
You must be signed in to change notification settings - Fork 894
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
Jordi-PV
merged 4 commits into
trunk
from
add-rule-description-field-to-inclusive-language-assessments
Nov 5, 2024
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d13a3f4
Change how we retrieve rule descriptions when generating inclusive la…
agnieszkaszuba 0a6946b
Remove unused import
agnieszkaszuba 43847a9
Don't export inclusive language database as default
agnieszkaszuba 8a44457
Add parameter descriptions
agnieszkaszuba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...yoastseo/spec/scoring/assessments/inclusiveLanguage/helpers/createRuleDescriptionsSpec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { isPreceded, notPreceded, notFollowed, notPrecededAndNotFollowed } from "../../../../../src/scoring/assessments/inclusiveLanguage/helpers/createRuleDescriptions"; | ||
|
||
describe( "A test for creating assessment rule descriptions", function() { | ||
it( "should create a rule description for phrases that should be targeted only when preceded by specific words", function() { | ||
expect( isPreceded( [ "I am", "you are" ] ) ).toBe( "Targeted when preceded by 'I am', 'you are'." ); | ||
} ); | ||
it( "should create a rule description for phrases that should be targeted unless preceded by specific words", function() { | ||
expect( notPreceded( [ "I am", "you are" ] ) ).toBe( "Targeted unless preceded by 'I am', 'you are'." ); | ||
} ); | ||
it( "should create a rule description for phrases that should be targeted unless followed by specific words", function() { | ||
expect( notFollowed( [ "in college", "in high school" ] ) ).toBe( "Targeted unless followed by 'in college', 'in high school'." ); | ||
} ); | ||
it( "should create a rule description for phrases that should be targeted unless preceded and/or followed by specific words", function() { | ||
expect( notPrecededAndNotFollowed( [ "high school", "college" ], [ "in college", "in high school" ] ) ).toBe( "Targeted unless preceded by 'high school', 'college' and/or followed by 'in college', 'in high school'." ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ export default class InclusiveLanguageAssessment { | |
* @returns {void} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also good to add the description of these parameters:
|
||
*/ | ||
constructor( { identifier, nonInclusivePhrases, inclusiveAlternatives, | ||
score, feedbackFormat, learnMoreUrl, rule, caseSensitive, category } ) { | ||
score, feedbackFormat, learnMoreUrl, rule, ruleDescription, caseSensitive, category } ) { | ||
this.identifier = identifier; | ||
this.nonInclusivePhrases = nonInclusivePhrases; | ||
this.inclusiveAlternatives = inclusiveAlternatives; | ||
|
@@ -48,6 +48,7 @@ export default class InclusiveLanguageAssessment { | |
this.learnMoreUrl = createAnchorOpeningTag( learnMoreUrl ); | ||
|
||
this.rule = rule || includesConsecutiveWords; | ||
this.ruleDescription = ruleDescription; | ||
this.caseSensitive = caseSensitive || false; | ||
this.category = category; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks!