Problem/Motivation

Use of he, she, his and her is largely unnecessary in code comments and test text.

Proposed resolution

Found by by grepping the codebase for (^|\W)(he|she|him|his|her|hers|woman|man|boy|girl|guy|guys)($|\W) and replace/improve the text appropriately.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

N/a

Comments

attiks’s picture

StatusFileSize
new10.09 KB

More: ag '\bhe\b' core --ignore=vendor

attiks’s picture

StatusFileSize
new11.56 KB

More added:
- ag '\bshe\b' core --ignore=vendor
- ag '\bher\b' core --ignore=vendor

nielsonm’s picture

Status: Needs review » Needs work

Patch no longer applies.

nielsonm’s picture

StatusFileSize
new14.7 KB

Rerolled and added some new edits.

nielsonm’s picture

Status: Needs work » Needs review
mark_fullmer’s picture

I think it would be preferable, when possible, to avoid number disagreement in pronouns ("user" = singular, "their" = plural).

Current: A module developer has to tag their backend service with "backend_overridable":
Proposed: A module developer has to tag the backend service with "backend_overridable":

Current patch: of node_access_rebuild() lets the user perform their changes and actually
Proposed: of node_access_rebuild() lets the user perform changes and actually

and so on...

mark_fullmer’s picture

StatusFileSize
new14.38 KB
  • Changed plural pronouns ("they","their") with singular referents to singular or avoided.
  • Changed "he or she" to "s/he".
mark_fullmer’s picture

mark_fullmer’s picture

StatusFileSize
new14.39 KB
  • Changed plural pronouns ("they","their") with singular referents to singular or avoided.
  • Changed "he or she" to "s/he".
  • Made syntax a bit more natural

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

frankfarm’s picture

Status: Needs review » Reviewed & tested by the community

I'm pleased that this issue exists and that we are working to resolution for it.

I have reviewed the issue and find the rationale and patch to be sound.

At first I wondered if the construction of "s/he" was easily understood by those who understand English but are not native English speakers, but "s/he" is defined at:

http://www.merriam-webster.com/dictionary/s/he
http://www.dictionary.com/browse/s-he?s=t

so I am guessing that it should be fine.

catch’s picture

Status: Reviewed & tested by the community » Needs work

Completely agreed with cleaning this up.

However, in general we use 'they/their' as a singular gender-neutral pronoun rather than he/she or s/he which is quite clunky. I very rarely see he/she in text written in the past 5 years, and while they/their has got more popular recently, it's also been used for decades/centuries in English so the singular/plural ambivalence shouldn't be a problem in practice.

alexpott’s picture

It is also in the style guide for Drupal.org - see https://www.drupal.org/drupalorg/style-guide/words-phrases

Also, this is a living document. It should and will change as life happens. Had we written it ten years ago, it probably wouldn't have recommended using gender-neutral pronouns. Maybe that practice will be so common by the 2018 version of this guide that we don't even have to include it anymore.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new10.5 KB

Used \s(s?he|him|her)\s

alexpott’s picture

StatusFileSize
new5.19 KB
new15.68 KB

One thing we can't change is the GPL v2 license which says:

it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This is unnecessarily binary. But we need to file an issue against the GPL.

We also have some test text that uses he or she but is not help text and so can be ignored. I've changed one because ...and she could take it away seems odd and makes me ask why? Also made All the faith he had had had had no effect on the outcome of his life. not gendered because again not sure why.

alexpott’s picture

StatusFileSize
new3.51 KB
new15.67 KB

Whoops

alexpott’s picture

  1. +++ b/core/modules/quickedit/js/views/EditorView.es6.js
    @@ -149,7 +149,7 @@
    -            // When the user has indicated he wants to save his changes to this
    +            // When the user has triggered a save to their changes to this
    

    I think this one could do with finessing.

  2. +++ b/core/modules/workspaces/tests/src/Functional/WorkspaceBypassTest.php
    @@ -55,8 +55,8 @@ public function testBypassOwnWorkspace() {
    -    // Because editor 2 has the bypass permission, he should be able to create
    -    // and edit any node.
    +    // Because editor 2 has the bypass permission, editor 2 should be able to
    +    // create and edit any node.
    

    This comment is weird because it does not reflect what is actually tested for. Probably should have a followup.

quietone’s picture

The title caught my eye so had a read of the patch. Sorry, no suggestions for the two point in the previous comment.

  1. +++ b/core/modules/block/tests/src/Functional/BlockLanguageTest.php
    @@ -28,7 +28,6 @@ class BlockLanguageTest extends BrowserTestBase {
    -    // Create a new user, allow him to manage the blocks and the languages.
    

    Removing a comment caught my eye. This is in a test setup and not complicated, so it just takes a moment longer to parse the code. That is ok here, I think.

  2. +++ b/core/modules/quickedit/js/views/EditorView.es6.js
    @@ -124,7 +124,7 @@
    +            // The user is the process of activating in-place editing: if
    

    s/is/is in/ ?

alexpott’s picture

Version: 8.6.x-dev » 8.7.x-dev
Issue summary: View changes
StatusFileSize
new1.5 KB
new16.02 KB

Discussed #22.1 IRL with @justafish and they pointed out that to their changes is superfluous language.

Fixed #23 too.

alexpott’s picture

quietone’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed the changes since my last review in #23. The one issue I raised that needed a fix has been fixed, and the two from #22 has been addressed as well. One is fixed and the other has a followup.
This is good to go.

alexpott’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs review
StatusFileSize
new9.43 KB
new25.45 KB

Working on a sniff for coder and have improved the regex to (^|\W)(he|she|him|his|her|hers)($|\W) this results in a new patch.

alexpott’s picture

I've opened #3021632: Add a sniff to find unnecessarily gendered language in code comments so we can automatically check and don't regress.

alexpott’s picture

Issue summary: View changes

A comment from @aburke626 on slack prompted me to realise there is also (^|\W)(woman|man|boy|girl)($|\W).

That finds:

 * $options = [
 *   1 => ['first_name' => 'Indy', 'last_name' => 'Jones'],
 *   2 => ['first_name' => 'Darth', 'last_name' => 'Vader'],
 *   3 => ['first_name' => 'Super', 'last_name' => 'Man'],
 * ];

Where I think we could introduce some diversity into our super hero examples.

And it also finds a view with an option

        field_test_list_string_value:
          id: field_test_list_string_value
          table: field_data_field_test_list_string
          field: field_test_list_string_value
          relationship: none
          group_type: group
          admin_label: ''
          operator: or
          value:
            man: man
            woman: woman

which is unnecessarily binary. Given that that is test change I'm going to file a separate issue to address that.

dawehner’s picture

  1. +++ b/core/modules/block/tests/src/Functional/BlockLanguageTest.php
    @@ -28,7 +28,6 @@ class BlockLanguageTest extends BrowserTestBase {
    -    // Create a new user, allow him to manage the blocks and the languages.
    

    Nice!

  2. +++ b/core/modules/views_ui/views_ui.module
    @@ -318,7 +318,7 @@ function views_ui_views_analyze(ViewExecutable $view) {
       // system, so the alias will not work anymore. Report this to the user,
    -  // because he probably wanted something else.
    +  // because this is probably in error.
       foreach ($view->displayHandlers as $display) {
    

    s/in/an

  3. +++ b/core/modules/workspaces/tests/src/Functional/WorkspaceBypassTest.php
    @@ -55,8 +55,8 @@ public function testBypassOwnWorkspace() {
    -    // Because editor 2 has the bypass permission, he should be able to create
    -    // and edit any node.
    +    // Because editor 2 has the bypass permission, editor 2 should be able to
    +    // create and edit any node.
    

    I like how this improves the overall readability.

alexpott’s picture

StatusFileSize
new2.03 KB
new26.87 KB

Thanks for the review @dawehner re #2 - funnily enough something can be in error and something can be an error :) However I've totally rewritten comment because it is unnecessary wordy.

I've also replaced the superheroes. I don't feel that we could ever come up with a list that is truly diverse and have it be useful documentation therefore I've gone for shapes and colours.

alexpott’s picture

Issue summary: View changes

I've also checked for guy and guys - not found in our codebase.

mayaslatinek’s picture

Issue summary: View changes
StatusFileSize
new101.56 KB

Patch provided by @alexpott applies without problems; in the section shown in the image below I'm guessing it doesn't have to be so many had words right?
Had

alexpott’s picture

@Mark Slatinek it's about how many times had can appear in a sentence and it still be a proper english :) see https://english.stackexchange.com/questions/139436/all-the-faith-he-had-...

mayaslatinek’s picture

Ohh okay didn't know that, thank you for the info :)

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

alexpott’s picture

StatusFileSize
new574 bytes
new27.43 KB

Ok so now that coder has a rule and we've updated coder in core we can apply the rule to make sure we don't regress. Nice.

It'd be great to get this to rtbc and fixed in 8.8.x because these comments are completely unnecessarily written this way. And whilst our code comments are only a small part of how we welcome people to Drupal development there is no reason for them to unnecessarily exclusive.

alexpott’s picture

I've run phpcs with this patch applied and there are no errors. I added a "He" to a comment in the code base and re-ran and saw:

FILE: ...b/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 14 | ERROR | Unnecessarily gendered language in a comment
    |       | (Drupal.Commenting.GenderNeutralComment.GenderNeutral)
----------------------------------------------------------------------
tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Glad to see this cleaned up and with the rule added

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 615123f and pushed to 8.8.x. Thanks!

  • catch committed 615123f on 8.8.x
    Issue #2286655 by alexpott, attiks, mark_fullmer, nielsonm, Mark...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.