From 10401b7aa6ca2d151744f528795965f4b84ab965 Mon Sep 17 00:00:00 2001 From: Jonathan Smith <jonathan1055@sandfordsolutions.com> Date: Wed, 18 Dec 2024 17:22:04 +0000 Subject: [PATCH 1/5] Add assets/extra-dictionary.txt --- .gitignore | 1 + includes/include.drupalci.main.yml | 2 ++ scripts/prepare-cspell.php | 8 +++++--- scripts/run-local-checks.sh | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 57deff00..2a68c5f7 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ composer.json package.json phpcs.xml !assets/** +extra-dictionary.txt diff --git a/includes/include.drupalci.main.yml b/includes/include.drupalci.main.yml index 0c87b7ce..a2cc185e 100644 --- a/includes/include.drupalci.main.yml +++ b/includes/include.drupalci.main.yml @@ -880,6 +880,8 @@ cspell: - _cspell_unrecognized_words.txt - _cspell_json.txt script: + - echo "Executing curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/assets/extra-dictionary.txt" + - curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/assets/extra-dictionary.txt - echo "Executing curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/prepare-cspell.php" - curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/prepare-cspell.php # Restore composer.json back to an unchanged version. diff --git a/scripts/prepare-cspell.php b/scripts/prepare-cspell.php index e6cb508f..c76c93d6 100644 --- a/scripts/prepare-cspell.php +++ b/scripts/prepare-cspell.php @@ -101,9 +101,6 @@ $cspell_json['words'] = array_values(array_unique(array_merge( $cspell_json['words'] ?? [], array_filter(explode(',', $words ?? '')), $module_name_parts, - // Add lando and ddev which appear in the original version of phpcs.xml.dist - // See https://www.drupal.org/project/gitlab_templates/issues/3427357#comment-15487034 - ['lando', 'ddev'], ))); // ---------- @@ -160,6 +157,11 @@ $dictionary_definitions = [ 'name' => 'dictionary', 'path' => $webRoot . '/core/misc/cspell/dictionary.txt', ], + [ + 'name' => 'extra-dictionary', + 'path' => './extra-dictionary.txt', + 'description' => 'Additional words commonly used in contrib projects that are not in the core dictionaries', + ], [ 'name' => 'project-words', 'path' => './.cspell-project-words.txt', diff --git a/scripts/run-local-checks.sh b/scripts/run-local-checks.sh index e39e5af5..b742c5b4 100755 --- a/scripts/run-local-checks.sh +++ b/scripts/run-local-checks.sh @@ -16,6 +16,7 @@ # Copy configuration files for the tools. cp -a ./assets/internal/. . +cp -a ./assets/extra-dictionary.txt . # Run prepare-cspell to allow testing with the modified .cspell.json file. export _CSPELL_IGNORE_STANDARD_FILES=0 -- GitLab From e4e3c90b33fef72e1354bf32f89fe1680c17f095 Mon Sep 17 00:00:00 2001 From: Jonathan Smith <jonathan1055@sandfordsolutions.com> Date: Wed, 18 Dec 2024 17:33:18 +0000 Subject: [PATCH 2/5] Add the new dictionary file --- .gitignore | 1 - assets/extra-dictionary.txt | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 assets/extra-dictionary.txt diff --git a/.gitignore b/.gitignore index 2a68c5f7..57deff00 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,3 @@ composer.json package.json phpcs.xml !assets/** -extra-dictionary.txt diff --git a/assets/extra-dictionary.txt b/assets/extra-dictionary.txt new file mode 100644 index 00000000..a088ee06 --- /dev/null +++ b/assets/extra-dictionary.txt @@ -0,0 +1,5 @@ +ddev +endapply +lando +nightwatchjs +testgroups -- GitLab From 49066c574c301870eb31f6192a4b39acb217931d Mon Sep 17 00:00:00 2001 From: Jonathan Smith <jonathan1055@sandfordsolutions.com> Date: Wed, 18 Dec 2024 17:35:25 +0000 Subject: [PATCH 3/5] Tidy up in run-local-checks.sh --- scripts/run-local-checks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run-local-checks.sh b/scripts/run-local-checks.sh index b742c5b4..ccd9ac99 100755 --- a/scripts/run-local-checks.sh +++ b/scripts/run-local-checks.sh @@ -38,5 +38,5 @@ php scripts/unformatted-links.php || EXIT_CODE=$((EXIT_CODE+1)) # Clean up all files that were copied. if [[ "$1" == "clean" ]]; then rm -rf node_modules/ vendor/ - rm .cspell.json .eslintrc.js .shellcheckrc .project-words.txt composer.json composer.lock package.json package-lock.json phpcs.xml .prettierrc.json + rm .cspell.json .eslintrc.js .shellcheckrc .project-words.txt composer.json composer.lock package.json package-lock.json phpcs.xml .prettierrc.json extra-dictionary.txt fi -- GitLab From 64e17cdc36fe1bfc9e6bf8ae30a4665421afab84 Mon Sep 17 00:00:00 2001 From: Jonathan Smith <jonathan1055@sandfordsolutions.com> Date: Thu, 19 Dec 2024 09:47:13 +0000 Subject: [PATCH 4/5] Remove all initial work --- assets/extra-dictionary.txt | 5 ----- includes/include.drupalci.main.yml | 2 -- scripts/prepare-cspell.php | 8 +++----- scripts/run-local-checks.sh | 3 +-- 4 files changed, 4 insertions(+), 14 deletions(-) delete mode 100644 assets/extra-dictionary.txt diff --git a/assets/extra-dictionary.txt b/assets/extra-dictionary.txt deleted file mode 100644 index a088ee06..00000000 --- a/assets/extra-dictionary.txt +++ /dev/null @@ -1,5 +0,0 @@ -ddev -endapply -lando -nightwatchjs -testgroups diff --git a/includes/include.drupalci.main.yml b/includes/include.drupalci.main.yml index a2cc185e..0c87b7ce 100644 --- a/includes/include.drupalci.main.yml +++ b/includes/include.drupalci.main.yml @@ -880,8 +880,6 @@ cspell: - _cspell_unrecognized_words.txt - _cspell_json.txt script: - - echo "Executing curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/assets/extra-dictionary.txt" - - curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/assets/extra-dictionary.txt - echo "Executing curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/prepare-cspell.php" - curl -OL https://git.drupalcode.org/$_CURL_TEMPLATES_REPO/-/raw/$_CURL_TEMPLATES_REF/scripts/prepare-cspell.php # Restore composer.json back to an unchanged version. diff --git a/scripts/prepare-cspell.php b/scripts/prepare-cspell.php index c76c93d6..e6cb508f 100644 --- a/scripts/prepare-cspell.php +++ b/scripts/prepare-cspell.php @@ -101,6 +101,9 @@ $cspell_json['words'] = array_values(array_unique(array_merge( $cspell_json['words'] ?? [], array_filter(explode(',', $words ?? '')), $module_name_parts, + // Add lando and ddev which appear in the original version of phpcs.xml.dist + // See https://www.drupal.org/project/gitlab_templates/issues/3427357#comment-15487034 + ['lando', 'ddev'], ))); // ---------- @@ -157,11 +160,6 @@ $dictionary_definitions = [ 'name' => 'dictionary', 'path' => $webRoot . '/core/misc/cspell/dictionary.txt', ], - [ - 'name' => 'extra-dictionary', - 'path' => './extra-dictionary.txt', - 'description' => 'Additional words commonly used in contrib projects that are not in the core dictionaries', - ], [ 'name' => 'project-words', 'path' => './.cspell-project-words.txt', diff --git a/scripts/run-local-checks.sh b/scripts/run-local-checks.sh index ccd9ac99..e39e5af5 100755 --- a/scripts/run-local-checks.sh +++ b/scripts/run-local-checks.sh @@ -16,7 +16,6 @@ # Copy configuration files for the tools. cp -a ./assets/internal/. . -cp -a ./assets/extra-dictionary.txt . # Run prepare-cspell to allow testing with the modified .cspell.json file. export _CSPELL_IGNORE_STANDARD_FILES=0 @@ -38,5 +37,5 @@ php scripts/unformatted-links.php || EXIT_CODE=$((EXIT_CODE+1)) # Clean up all files that were copied. if [[ "$1" == "clean" ]]; then rm -rf node_modules/ vendor/ - rm .cspell.json .eslintrc.js .shellcheckrc .project-words.txt composer.json composer.lock package.json package-lock.json phpcs.xml .prettierrc.json extra-dictionary.txt + rm .cspell.json .eslintrc.js .shellcheckrc .project-words.txt composer.json composer.lock package.json package-lock.json phpcs.xml .prettierrc.json fi -- GitLab From 5ab76c88fa5e5927f707a24c1960f8812a7b996a Mon Sep 17 00:00:00 2001 From: Jonathan Smith <jonathan1055@sandfordsolutions.com> Date: Thu, 19 Dec 2024 09:51:33 +0000 Subject: [PATCH 5/5] Just add to the "words" array in .cspell.json --- scripts/prepare-cspell.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/prepare-cspell.php b/scripts/prepare-cspell.php index e6cb508f..90d2a53b 100644 --- a/scripts/prepare-cspell.php +++ b/scripts/prepare-cspell.php @@ -104,6 +104,9 @@ $cspell_json['words'] = array_values(array_unique(array_merge( // Add lando and ddev which appear in the original version of phpcs.xml.dist // See https://www.drupal.org/project/gitlab_templates/issues/3427357#comment-15487034 ['lando', 'ddev'], + // Add some common words that were dropped from core dictionary in Drupal 11.1 + // See https://www.drupal.org/project/gitlab_templates/issues/3494834 + ['endapply', 'nightwatchjs', 'testgroups'], ))); // ---------- -- GitLab