From 3a37ee12a072ed24f4e4548903ad8d8e6413a8ec Mon Sep 17 00:00:00 2001
From: Alex Pott <1732-alexpott@users.noreply.drupalcode.org>
Date: Tue, 28 Jan 2025 13:53:26 +0000
Subject: [PATCH] Issue #3502706 by alexpott, marcoscano: Tidy up spelling and
 fail if we break it

---
 .cspell-project-words.txt                              | 6 ------
 .gitlab-ci.yml                                         | 4 ++++
 src/Controller/ListUsageController.php                 | 4 ++--
 src/EntityUpdateManagerInterface.php                   | 2 +-
 tests/src/Functional/EntityUsageLayoutBuilderTest.php  | 6 +++---
 tests/src/FunctionalJavascript/EmbeddedContentTest.php | 2 +-
 tests/src/Kernel/EntityUsageTest.php                   | 2 +-
 7 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/.cspell-project-words.txt b/.cspell-project-words.txt
index 5c6b8b6..af16343 100644
--- a/.cspell-project-words.txt
+++ b/.cspell-project-words.txt
@@ -1,12 +1,6 @@
 # List of words excluded from cspell validation for the project Entity Usage.
 basefield
 basefields
-embed
-embedd
 linkit
-myref
-onlyone
-summarise
-testlist
 webform
 webforms
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4588c9d..4275da3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -42,3 +42,7 @@ phpcs:
   allow_failure: false
 phpstan:
   allow_failure: false
+cspell:
+  allow_failure: false
+eslint:
+  allow_failure: false
diff --git a/src/Controller/ListUsageController.php b/src/Controller/ListUsageController.php
index 754d01b..6f17b7e 100644
--- a/src/Controller/ListUsageController.php
+++ b/src/Controller/ListUsageController.php
@@ -260,7 +260,7 @@ class ListUsageController extends ControllerBase {
 
           foreach ($revision_groups as $index => $label) {
             if (!empty($revisions[$index])) {
-              $used_in[] = $this->summariseRevisionGroup($default_langcode, $label, $revisions[$index]);
+              $used_in[] = $this->summarizeRevisionGroup($default_langcode, $label, $revisions[$index]);
             }
           }
 
@@ -319,7 +319,7 @@ class ListUsageController extends ControllerBase {
    * @return array
    *   A render array summarizing the information passed in.
    */
-  protected function summariseRevisionGroup($default_langcode, $revision_label, array $languages) {
+  protected function summarizeRevisionGroup($default_langcode, $revision_label, array $languages) {
     $language_objects = $this->languageManager()->getLanguages(LanguageInterface::STATE_ALL);
     if (count($languages) === 1 && !empty($languages[$default_langcode])) {
       // If there's only one relevant revision and it's the entity's default
diff --git a/src/EntityUpdateManagerInterface.php b/src/EntityUpdateManagerInterface.php
index 1385378..8e51976 100644
--- a/src/EntityUpdateManagerInterface.php
+++ b/src/EntityUpdateManagerInterface.php
@@ -37,7 +37,7 @@ interface EntityUpdateManagerInterface {
    *   - default: The main entity (default language, default revision) is being
    *   deleted (delete also other languages and revisions).
    *   - translation: Only one translation is being deleted.
-   *   - revision: Onlyone revision is being deleted.
+   *   - revision: Only one revision is being deleted.
    *
    * @throws \InvalidArgumentException
    */
diff --git a/tests/src/Functional/EntityUsageLayoutBuilderTest.php b/tests/src/Functional/EntityUsageLayoutBuilderTest.php
index 149a1f4..e1edef7 100644
--- a/tests/src/Functional/EntityUsageLayoutBuilderTest.php
+++ b/tests/src/Functional/EntityUsageLayoutBuilderTest.php
@@ -92,7 +92,7 @@ class EntityUsageLayoutBuilderTest extends BrowserTestBase {
     $type->save();
 
     $fieldStorage = FieldStorageConfig::create([
-      'field_name' => 'myref',
+      'field_name' => 'my_ref',
       'entity_type' => 'block_content',
       'type' => 'entity_reference',
       'settings' => [
@@ -109,14 +109,14 @@ class EntityUsageLayoutBuilderTest extends BrowserTestBase {
     $block = BlockContent::create([
       'type' => $type->id(),
       'reusable' => 0,
-      'myref' => $innerEntity,
+      'my_ref' => $innerEntity,
     ]);
     $block->save();
 
     $block2 = BlockContent::create([
       'type' => $type->id(),
       'reusable' => 1,
-      'myref' => $innerEntity2,
+      'my_ref' => $innerEntity2,
     ]);
     $block2->save();
 
diff --git a/tests/src/FunctionalJavascript/EmbeddedContentTest.php b/tests/src/FunctionalJavascript/EmbeddedContentTest.php
index 6cedbb7..f8e81f5 100644
--- a/tests/src/FunctionalJavascript/EmbeddedContentTest.php
+++ b/tests/src/FunctionalJavascript/EmbeddedContentTest.php
@@ -550,7 +550,7 @@ class EmbeddedContentTest extends EntityUsageJavascriptTestBase {
   /**
    * Tests the MediaEmbed plugin parsing does not error with malformed HTML.
    */
-  public function testMediaEmbeddWithMalformedHtml() {
+  public function testMediaEmbedWithMalformedHtml() {
     $embedded_text = '<drupal-media data-entity-type="media" data-entity-uuid=""></drupal-media>';
 
     $node = Node::create([
diff --git a/tests/src/Kernel/EntityUsageTest.php b/tests/src/Kernel/EntityUsageTest.php
index 46fc2d9..f33ed3c 100644
--- a/tests/src/Kernel/EntityUsageTest.php
+++ b/tests/src/Kernel/EntityUsageTest.php
@@ -103,7 +103,7 @@ class EntityUsageTest extends EntityKernelTestBase {
    * @covers \Drupal\entity_usage\EntityUsage::listSources
    * @covers \Drupal\entity_usage\EntityUsage::listTargets
    */
-  public function testlistSources() {
+  public function testListSources() {
     // Add additional entity to test with more than 1 source.
     $entity_3 = EntityTest::create(['name' => $this->randomMachineName()]);
     $entity_3->save();
-- 
GitLab