Test for words in 'cspell:ignore' that can be removed

Created on 2 October 2023, about 1 year ago
Updated 15 November 2023, about 1 year ago

Problem/Motivation

Currently, there is no tool that will check the various cspell lines in core to see if they are still needed. No does cspell offer such a thing. Although there is an issue, https://github.com/streetsidesoftware/cspell/issues/4150.

Most of the lines in core are cspell:ignore with a few cspell:disable-next-line. The latter are near code being changed so is more likely to be kept up to date. However, the ignore lines are at the top of the file and are easy to get out of sync.

Steps to reproduce

Proposed resolution

Add a check in commit-code-check.sh to report if any of the words in a cspell:ignore line in any of the modified files can be removed.

Remaining tasks

Review
Manual testing

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Needs work

Version

11.0 πŸ”₯

Component
OtherΒ  β†’

Last updated about 1 hour ago

Created by

πŸ‡³πŸ‡ΏNew Zealand quietone

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @quietone
  • Status changed to Needs review about 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    I applied the patch and ran the script for two cases. The following shows the relevant part of the output.

    1) Add a word that is not used to an ignore line.

    $ ddev commit-code-check --cached
    /var/www/html/core/modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php: xyzzy
    
    CSpell: Ignored words can be removed
    1/1 ./modules/block/tests/src/Unit/Plugin/migrate/process/BlockVisibilityTest.php 323.07ms
    2/2 ./scripts/dev/commit-code-check.sh 203.57ms
    CSpell: Files checked: 2, Issues found: 0 in 0 files
    
    CSpell: failed

    1) Add a comment to a file that has an ignore line.

    $ ddev commit-code-check --cached
    
    CSpell: No ignored words found
    1/1 ./modules/block_content/tests/src/Kernel/Plugin/migrate/source/d6/BoxTranslationTest.php 334.55ms
    2/2 ./scripts/dev/commit-code-check.sh 14.46ms
    CSpell: Files checked: 2, Issues found: 0 in 0 files
    
    CSpell: passed
    

    No need to run tests but setting to NR.

  • πŸ‡³πŸ‡ΏNew Zealand quietone
  • Status changed to RTBC about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Verified this was working.

    Applied patch #2

    In action.module I added // cspell:ignore addedline which is a word in the dictionary.txt

    Running commit-code-check.sh I got

    Stephens-MBP:web $:./core/scripts/dev/commit-code-check.sh --cached
    /Users/smustgrave/Sites/Drupal-Demos/drupal-11.x/web/core/modules/action/action.module: addedline
    
    CSpell: Ignored words can be removed
    1/1 ./modules/action/action.module 249.26ms
    2/2 ./scripts/dev/commit-code-check.sh 9.18ms
    CSpell: Files checked: 2, Issues found: 0 in 0 files
    

    Removing the line from action.module and running again was all green.

  • Status changed to Needs work about 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    We need to update the gitlab-ci pipeline to do this otherwise only committers might run this check.

  • Status changed to Needs review about 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    I agree that this needs to be run in gitlab. However, I think that part is better that it is done as part of or after this issue, πŸ“Œ Reconcile gitlab lint jobs and commit-code-check.sh Needs work . That issue is proposing breaking up commit-code-check into several scripts that can be run in both environments. So, this would just be incorporating into one of those new scripts instead of direct additions to the pipeline.

  • Status changed to Needs work about 1 year ago
  • The Needs Review Queue Bot β†’ tested this issue.

    While you are making the above changes, we recommend that you convert this patch to a merge request β†’ . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

  • Status changed to Needs review about 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Let's get a response to #6 before changing to an MR or other work on the code.

  • Status changed to Needs work about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Brought this up in #needs-review-queue-initiative channel and @alexpott mentioned this should be added to pipeline.

Production build 0.71.5 2024