Fix cspell errors in Search API Saved Searches

Created on 13 March 2024, 8 months ago
Updated 25 August 2024, 3 months ago

We have currently disabled CSpell in our GitLab CI pipelines since it produced lots of bogus errors. However, it would of course be good to re-enable it, so we can catch any actual typos we add in the future.

I think I already fixed all of the actual mistakes, but I’m unsure how to (best) get CSpell to properly address the remaining reported errors. The Drupal documentation unfortunately only addresses the case of Core, not how to deal with this in contrib modules.
In most cases, ignoring some non-words by either adding a // cspell:disable WORD line at the top of the file or ignoring any lines with bogus text with either a single // cspell:disable-next-line directive or wrapping multiple such lines in // cspell:disable/// cspell:enable. should be fine, but CSpell also reports actual words like “datasource” and “cacheable”, which we use in several files and would ideally just add to a dictionary somehow.

One option for this is to create a custom .cspell.json for the module. Unfortunately, this file would then replace the one provided by Core, with no way to combine directives from both of them. There is already a template .cspell.json file which solves this by copying the necessary directives from Core’s .cspell.json file, but this seems less than ideal both because of the unstable and unpredictable relative paths and because we’d have to manually keep track of any changes to that template (or Core’s .cspell.json file). There is already an issue open for part of this, maybe some nicer solution will be found there: #3426136: Execute CSPELL in project root folder and make fixing words easier .

Passing extra allowed words in the _CSPELL_WORDS GitLab CI variable would be another option, but as this wouldn’t help with running CSpell locally, I wouldn’t want to do that.

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇦🇹Austria drunken monkey Vienna, Austria

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024