Spell check all files if dictionary.txt changes

Created on 6 May 2021, about 3 years ago
Updated 12 September 2023, 10 months ago

Problem/Motivation

It'd be cool if core/scripts/dev/commit-code-check.sh could detect a change in the dictionary and re-run the tests. We can test if the dictionary is in $FILES - also we should only do this on DrupalCI - there's a flag for that too. Also we could extend this to:

running PHPCS on all files if phpcs.xml.dist is updated
running all JS build checks if core/yarn.lock is updated
Thus spoketh @alexpott in #3212547-7: cspell Dictionaries changed, checking all files

I think it's not only cool, but also necessary to prevent issues like #3212521: [backport] cspell dislikes identifer in core/modules/views/src/Plugin/views/filter/FilterPluginBase.php and will fail any patch touching that file

Steps to reproduce

Proposed resolution

Detect a change to the dictionary and then run spellcheck:core locally and on drupalci if it is has changed.

  if [[ $FILE == "core/misc/cspell/dictionary.txt" ]]; then
    CSPELL_DICTIONARY_FILE_CHANGED=1;
  fi

Remaining tasks

Review patch #10

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

10.1

Component
Base 

Last updated about 6 hours ago

Created by

🇳🇱Netherlands Spokje

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • last update 11 months ago
    CI aborted
  • 🇳🇿New Zealand quietone New Zealand

    Ran into this with 📌 Remove "Please" from the codebase Fixed . And, if this were done it would reduce the barriers for novices to contribute to spelling issues.

    This patch will spell check core if dictionary.txt changes. I also modified the spellcheck:core command by adding the option --no-progress so only error messages are output. That alone makes spell checking core easier. I tested locally and it seems to be working correctly.

    Since this is a useful addition for developers, and the lack of this has caused problems and followups I am changing this to a task.

  • last update 11 months ago
    29,878 pass
  • 🇳🇿New Zealand quietone New Zealand
    +++ b/core/scripts/dev/commit-code-check.sh
    @@ -139,6 +139,10 @@
    +
    

    Extra line needs to be removed

    No interdiff because this is a small patch

  • last update 11 months ago
    29,878 pass
  • 🇮🇳India _utsavsharma

    Addressed extra line needs to be removed.

  • 🇳🇿New Zealand quietone New Zealand
  • 🇳🇿New Zealand quietone New Zealand

    @_utsavsharma, The extra line was removed in #10, no work needed to be done on the patch. The comment states you were addressing the extra line but the patch removed 2 extra lines with no comment as to why. In cases, when a script is being changed we keep to the same code style so it is easy to read an maintain. Therefor, no credit for an unhelpful patch How is credit granted for Drupal core issues .

    The original IS suggests running spellcheck:core only on drupalci. I think it should be done locally to prevent errors when working on spelling issues. It is rare and should be rare that a non-spelling issue is altering the dictionary.

  • Status changed to RTBC 11 months ago
  • 🇳🇱Netherlands Spokje

    Hiding patches to make clear #10 is the current one.

    Code changes make sense to me and will prevent the need for "emergency-repair-commits" when we sometimes forget to run spellcheck locally. So: RTBC.

    • catch committed cdd3e5ef on 11.x
      Issue #3212579 by quietone, Spokje: Spell check all files if dictionary....
  • Status changed to Fixed 11 months ago
  • 🇬🇧United Kingdom catch

    Committed/pushed to 11.x, thanks!

    I don't think we need this in 10.1.x, but if we do, happy to cherry-pick.

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

  • Status changed to Fixed 10 months ago
  • 🇬🇧United Kingdom catch

    Went ahead and cherry-picked now we're trying to sort out cspell linting with gitlab.

Production build 0.69.0 2024