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

Issue fork drupal-3212579

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

Spokje created an issue. See original summary.

spokje’s picture

@Wim Leers Indeed, it's always annoying to have a broken HEAD (and I use the term "broken" very loosely here, but rather as an umbrella describing "Forces Out Of Your Control Breaking Your Issue") interfering with issues.

(Not too sure FOOYCBYI is going to be entered in the Urban Dictionary soon...)

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

longwave’s picture

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Title: Detect changes in cspell dictionary in core/scripts/dev/commit-code-check.sh and re-run cspell on all files if there are » Spell check all files in dictionary.txt changes
Category: Feature request » Task
Status: Active » Needs review
StatusFileSize
new2.44 KB

Ran into this with #2921133: Remove "Please" from the codebase. 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.

quietone’s picture

StatusFileSize
new2.44 KB
+++ 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

_utsavsharma’s picture

StatusFileSize
new638 bytes
new2.44 KB

Addressed extra line needs to be removed.

quietone’s picture

Title: Spell check all files in dictionary.txt changes » Spell check all files if dictionary.txt changes
quietone’s picture

Issue summary: View changes

@_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 perHow 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.

spokje’s picture

Status: Needs review » Reviewed & tested by the community

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....
catch’s picture

Status: Reviewed & tested by the community » Fixed

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.

Status: Fixed » Closed (fixed)

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

catch’s picture

Version: 11.x-dev » 10.1.x-dev

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