Description
Over in backdrop/backdrop-issues#6255, we have merged a few PRs that have added the following ignore lines in various files in our codebase:
// cspell:disable-next-line
// cspell:disable
// cspell:enable
As I have posted in backdrop/backdrop-issues#6302 (comment), PHPCS never complained about any of these additions, despite failing our regular coding standards around inline comments. Specifically, these lines:
- start with a lowercase letter
- do not end with a period or any of the allowed comment ending characters
Having said that:
- these aren't regular comments - they have a special purpose, which is to ignore lines when doing a spell check on the PR changes.
- PHPCS with its current configuration only complains about the missing ending period - not about the first letter being lowercase.
So questions:
-
Should we add an exception in our PHPCS configuration to allow these specific lines to be as they are? ...or should we add periods to them across our codebase?
-
Although I have tested and confirmed that adding a period to these lines stops PHPCS from complaining, I didn't change the letter c in
// cspell:
to uppercase. Should we or not? For reference: https://cspell.org/configuration/document-settings shows the following formats for these lines:cSpell:disable
(second letter uppercase - no space after the:
)spell-checker: disable
(when the full word is used, a space follows:
to separate it from thedisable
/enable
/disable-next-line
keywords)spellchecker: disable
(same as previous format, but without the dash)
So I am not sure if changing the format to
// Cspell:*
to make PHPCS happy will break CSpell or not 🤷🏼