Problem/Motivation

Some code has repeated words:

  • the the
  • entity entity
  • insert other finds here

Proposed resolution

Remove repeated words.

Can automated checking for this? Does not look like cspell supports this.

Remaining tasks

Find all the duplicated words to fix.

User interface changes

Some UI text improved.

API changes

None

Data model changes

None

Release notes snippet

N/a

Issue fork drupal-3283602

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

eleonel created an issue. See original summary.

eleonel’s picture

StatusFileSize
new817 bytes
eleonel’s picture

Status: Active » Needs review
cilefen’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -typos +Documentation
alexpott’s picture

Status: Reviewed & tested by the community » Needs work

@eleonel if you have a way to check for these automatically can you roll them into a single patch. Fixing them one-by-one is unnecessary.

This issue can be merged with #3283925: Fix a message typo in ConfigEntityTest.php, #3283927: Fix a help text typo in core.content_structure.html.twig and #3283931: Fix a comment typo in MigrateSqlSourceTestBase.php for example.

alexpott’s picture

@eleonel also I'm unsure if there are other issues you've found recently that'll need to be merged in with this too.

ankithashetty’s picture

Status: Needs work » Needs review
StatusFileSize
new4.82 KB

@alexpott, as suggested by you in #5, searched the entire codebase for occurrence of "the the" keyword and found in 5 files. Attached is a patch file to fix all the typo's in a single file.
Please review.

Thanks!

eleonel’s picture

StatusFileSize
new2.8 KB
new1.44 KB
alexpott’s picture

Title: Fix a comment typo in BlockTest » Fix repeated words
Issue summary: View changes

Can we also search for "entity entity"? That'll merge in #3283925: Fix a message typo in ConfigEntityTest.php too - plus fixing it in another place.

Updating the issue summary to indicate the scope.

Note we need to merge #7 and #8

alexpott’s picture

Plus there is another "entity entity" to fix.

eleonel’s picture

StatusFileSize
new5.47 KB
new3.23 KB
eleonel’s picture

@alexpott I found multiple typos by using https://github.com/hcodes/yaspeller

alexpott’s picture

#10 needs to be addressed... @eleonel so you could paste the output of yaspeller here and the we could choose what to fix.

eleonel’s picture

StatusFileSize
new660.52 KB

@alexpott scanning report on core/modules folder

yaspeller --ignore-uppercase --find-repeat-words --ignore-latin --ignore-digits --ignore-capitalization --only-errors core/modules --report html --verbose
HTML report: ./yaspeller_report.html
eleonel’s picture

StatusFileSize
new3.55 MB

@alexpott scanning report on repository root but (excluding core/modules folder).

alexpott’s picture

Thanks @eleonel - there's way too many false positives in #14 to actually be useful :( for example The %toolbar_item toolbar item requires the %plugins plugins to be enabled. is not a repeat of plugins.

Also the scanner is not very PHP aware and so misses repeated words like and in

    // We expect to find 5 elements: current page == 1, links to pages 2 and
    // and 3, links to 'next >' and 'last >>' pages.

- you can see this in core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php - PHPStorm's grammar checker can find that. Haven't worked out how to make it only do repeated words though.

alexpott’s picture

Status: Needs review » Needs work
StatusFileSize
new3.93 MB

Here's the grammar report from PHPStorm - it contains lots of split line repeated words like "in" in core/modules/ckeditor5/src/Plugin/CKEditor5PluginDefinition.php - line 95/96

Someone could process this xml file and output only the <description>Possible typo: you repeated a word</description> problems - isolate the false positives and then fix the list here.

urvashi_vora made their first commit to this issue’s fork.

urvashi_vora’s picture

Status: Needs work » Needs review
StatusFileSize
new2.67 MB

Hi,

Please review this patch.

Thanks

eleonel’s picture

Status: Needs review » Needs work
StatusFileSize
new15.66 KB

@urvashi_vora thanks for your patch, but I can see is removing valid duplicated words, like center center in css files

Patch with issues

urvashi_vora’s picture

Hi @eleonel,

Thanks for letting me know, I will exclude them and will create another patch.

urvashi_vora’s picture

StatusFileSize
new2.67 MB

Hi @eleonel,

Can you please review this patch?

It excludes CSS file repeated word removal.

Thanks

urvashi_vora’s picture

Status: Needs work » Needs review
eleonel’s picture

Status: Needs review » Needs work
StatusFileSize
new33.26 KB

@urvashi_vora I can still see valid duplicated words being removed in your latest patch, eg

Patch with issues

So you need to exclude false positives before removing the duplicated words, also I can see changes in minified files, you can ignore that kind of files I guess.

Also please merge your patch with the existing ones: #11 and create an interdiff to see the changes from latest patch (#11)

urvashi_vora’s picture

Status: Needs work » Needs review
StatusFileSize
new23.36 KB
new17.44 KB

Hi @eleonel,

I hope now the issue gets fixed.

Please review this patch along with interdiff.

Thanks

alexpott’s picture

Status: Needs review » Needs work
  1. +++ b/core/includes/file.inc
    @@ -9,7 +9,7 @@
    - * @defgroup file File interface
    + * @defgroup file interface
    

    This is incorrect.

  2. +++ b/core/modules/config/tests/src/Functional/ConfigEntityTest.php
    @@ -189,7 +189,7 @@ public function testCRUD() {
    -      $this->fail('Not possible to overwrite an entity entity.');
    +      $this->fail('Not possible to overwrite an  entity.');
    

    There's a double space in the new text.

  3. +++ b/core/modules/config/tests/src/Functional/ConfigImportUITest.php
    @@ -525,7 +525,7 @@ public function testExtensionValidation() {
    -    $this->assertSession()->pageTextContains('Unable to uninstall the Theme test base theme theme since the Theme test subtheme theme is installed.');
    +    $this->assertSession()->pageTextContains('Unable to uninstall the Theme test base theme since the Theme test subtheme theme is installed.');
    

    This is incorrect. HEAD is correct.

  4. +++ b/core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
    @@ -337,7 +337,7 @@ protected function setUpFields(EntityInterface $entity, UserInterface $account)
    -      $entity->set('field_rest_test', ['value' => 'All the faith he had had had had no effect on the outcome of his life.']);
    +      $entity->set('field_rest_test', ['value' => 'All the faith he had no effect on the outcome of his life.']);
    
    @@ -2370,7 +2370,7 @@ public function testPatchIndividual() {
    -    $this->assertSame('All the faith he had had had had no effect on the outcome of his life.', $updated_entity->get('field_rest_test')->value);
    +    $this->assertSame('All the faith he had no effect on the outcome of his life.', $updated_entity->get('field_rest_test')->value);
    
    +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
    @@ -229,7 +229,7 @@ public function setUp() {
    -        $this->entity->set('field_rest_test', ['value' => 'All the faith they had had had had no effect on the outcome of their life.']);
    +        $this->entity->set('field_rest_test', ['value' => 'All the faith they had no effect on the outcome of their life.']);
    
    @@ -1071,7 +1071,7 @@ public function testPatch() {
    -    $this->assertSame('All the faith they had had had had no effect on the outcome of their life.', $updated_entity->get('field_rest_test')->value);
    +    $this->assertSame('All the faith they had no effect on the outcome of their life.', $updated_entity->get('field_rest_test')->value);
    

    This is a famously correct use of repetitive hads... google it :).

  5. +++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php
    @@ -249,23 +249,23 @@ public function providerTestAccessWithoutBundles() {
    -      ['configure all user user layout overrides'],
    +      ['configure all user layout overrides'],
    ...
    -        'configure all user user layout overrides' => [
    +        'configure all user layout overrides' => [
    ...
    -      ['configure editable user user layout overrides'],
    +      ['configure editable user layout overrides'],
    ...
    -        'configure all user user layout overrides' => [
    +        'configure all user layout overrides' => [
    

    I think these are correct... This is from configure all $bundle $entity_type_id layout overrides - the user entity type has no bundle so there is a fake bundle called user.

  6. +++ b/core/modules/system/tests/src/Functional/Module/NonStableModulesTest.php
    @@ -186,10 +186,10 @@ public function testDeprecatedConfirmForm(): void {
    -    $assert->pageTextContains('The Deprecated module module is deprecated');
    +    $assert->pageTextContains('The Deprecated module is deprecated');
    ...
    -      'The Deprecated module module is deprecated. (more information)',
    +      'The Deprecated module is deprecated. (more information)',
    
    @@ -220,7 +220,7 @@ public function testDeprecatedConfirmForm(): void {
    -    $assert->pageTextContains('The Deprecated module module is deprecated');
    +    $assert->pageTextContains('The Deprecated module is deprecated');
    
    @@ -232,7 +232,7 @@ public function testDeprecatedConfirmForm(): void {
    -    $assert->pageTextContains('You must enable the Deprecated module module to install Deprecated module dependency');
    +    $assert->pageTextContains('You must enable the Deprecated module to install Deprecated module dependency');
    
    @@ -296,7 +296,7 @@ public function testDeprecatedConfirmForm(): void {
    -    $assert->pageTextContains('The Deprecated module module is deprecated');
    +    $assert->pageTextContains('The Deprecated module is deprecated');
    
    @@ -362,10 +362,10 @@ public function testDeprecatedAndExperimentalConfirmForm(): void {
    -    $assert->pageTextContains('The Deprecated module module is deprecated');
    +    $assert->pageTextContains('The Deprecated module is deprecated');
    ...
    -      'The Deprecated module module is deprecated. (more information)',
    +      'The Deprecated module is deprecated. (more information)',
    

    These changes are incorrect.

urvashi_vora’s picture

Status: Needs work » Needs review
StatusFileSize
new14.78 KB

Hi @alexpott,

As per your suggestions, here is the new patch.

Thanks

spokje’s picture

Status: Needs review » Needs work

Patch needs reroll

mrinalini9’s picture

Status: Needs work » Needs review
StatusFileSize
new13.14 KB

Hi,

I have rerolled patch #29, please review it.

Thanks & Regards,
Mrinalini

alexpott’s picture

+++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderAccessTest.php
@@ -249,23 +249,23 @@ public function providerTestAccessWithoutBundles() {
-      ['configure all user user layout overrides'],
+      ['configure all user layout overrides'],
...
-        'configure all user user layout overrides' => [
+        'configure all user layout overrides' => [
...
-      ['configure editable user user layout overrides'],
+      ['configure editable user layout overrides'],
...
-        'configure all user user layout overrides' => [
+        'configure all user layout overrides' => [

These changes are incorrect.I was thinking incorrect in #28 but for some strange reason I typed correct - sorry.

mrinalini9’s picture

StatusFileSize
new11.9 KB
new1 KB

Added patch by reverting back the changes mentioned in #32, please review it.

The last submitted patch, 31: fix-repeated-words-3283602-31.patch, failed testing. View results

sourabhjain’s picture

Changes made in #33, Looks fine to me.

alexpott’s picture

We need a Drupal 9 version of the patch that fixes core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php like #29 did. The reason that patch failed to apply on D10 is because that does not exist there.

mrinalini9’s picture

StatusFileSize
new12.92 KB

Added patch for Drupal 9.5.x that includes the changes from core/modules/tour/tests/src/FunctionalJavascript/TourLegacyTest.php , please review it.

Munavijayalakshmi’s picture

Version: 10.0.x-dev » 9.5.x-dev
Assigned: Unassigned » Munavijayalakshmi
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new165.67 KB

Patch applied successfully.

Munavijayalakshmi’s picture

Assigned: Munavijayalakshmi » Unassigned
alexpott’s picture

Component: block.module » documentation
Status: Reviewed & tested by the community » Fixed

Committed and pushed 5d4b6b4a87 to 10.1.x and db293a8b3a to 10.0.x. Thanks!
Committed 153f1a4 and pushed to 9.5.x. Thanks!

Didn't backport to 9.4.x because of the help topic changes.

  • alexpott committed 5d4b6b4 on 10.1.x
    Issue #3283602 by urvashi_vora, eleonel, mrinalini9, ankithashetty,...

  • alexpott committed db293a8 on 10.0.x
    Issue #3283602 by urvashi_vora, eleonel, mrinalini9, ankithashetty,...

  • alexpott committed 153f1a4 on 9.5.x
    Issue #3283602 by urvashi_vora, eleonel, mrinalini9, ankithashetty,...

Status: Fixed » Closed (fixed)

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

Munavijayalakshmi’s picture

Thanks.