cspell complains about DrupalPractice.General.OptionsT.TforValue

Created on 31 July 2024, 5 months ago
Updated 22 August 2024, 4 months ago

I have this line of code in one of my modules:
// phpcs:disable DrupalPractice.General.OptionsT.TforValue

But cspell complains about this, saying Unknown word (Tfor)

I believe this is because the sniff name does not follow proper camel casing. Maybe if it were named properly cspell wouldn't complain? Or at the very least, ALL sniff that we use ought to be in the dictionary so they aren't flagged.

What would be the proper fix here?

🐛 Bug report
Status

Active

Version

8.3

Component
Other 

Last updated 1 day ago

Created by

🇺🇸United States tr Cascadia

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

Comments & Activities

  • Issue created by @tr
  • 🇮🇳India abhiyanshu

    @TR I would suggest to update the cspell Dictionary and add specific terms to ignoreWords if they are valid in your context.

    Simply Update/add TforValue to ignoreWords in .cspell.json, save it, and run cspell again to check if it stops flagging TforValue.

    {
      "version": "0.1",
      "ignoreWords": [
        "TforValue"
      ]
    }
  • 🇺🇸United States tr Cascadia

    Yes, of course I can do that. I could also turn off cspell entirely.

    But it's silly that Drupal-specific phpcs sniff names are not automatically excluded.

    I mean, solving a phpcs issue with a phpcs:ignore causes a new cspell issue. That's just silly.

    Either cspell should ignore things like phpcs directives or the phpcs sniffs should use naming/casing conventions that are recognized by cspell.

    I *think* if it were named DrupalPractice.General.OptionsT.TForValue instead of DrupalPractice.General.OptionsT.TforValue then cspell wouldn't complain. (TFor instead of Tfor).

    And since incorrect camel casing is considered a phpcs error, it's again very silly that the phpcs sniffs have incorrect camel casing.

  • 🇳🇿New Zealand quietone

    This is not something that can be fixed in core. The sniffs are named by the Coder Module. I am moving this there.

    There is another sniff that also includes a spelling error, according to our use of cspell. That is Drupal.CSS.ColourDefinition. There is an issue in Coder asking for it to be renamed, 🐛 Rename ColourDefinitionSniff to ColorDefinitionSniff Needs work . I suggest you read comment #5 in that issue.

  • 🇦🇹Austria klausi 🇦🇹 Vienna

    Coder sniff names are internal error codes - sometimes we have to build camel case word combinations to make the error code useful.

    So we cannot fix the sniff names, because people rely on the codes now in their configuration. And we should not change error codes just to make cspell happy.

    So that leaves us with the option to exclude those words in cspell, where would be a good place for that? Probably Drupal core's dictionary file? Is is possible to put long dot works like "DrupalPractice.General.OptionsT.TforValue" there?

  • 🇬🇧United Kingdom jonathan1055

    I commented on #3418190-10: Rename ColourDefinitionSniff to ColorDefinitionSniff and the same solution can be done here. It is not practical to rename the sniff, nor is it practical to ask any contrib maintainer to add this word to their ignore list. We just need to add into the Core dictionary of words to ignore. See core/misc/cspell/dictionary.txt

Production build 0.71.5 2024