diff --git a/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php b/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php index 161ee9949c98c898f96f39239e5c495d86491b08..990a059f8bd09e7faf5e3909705ad3593e420086 100644 --- a/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php +++ b/coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php @@ -351,7 +351,7 @@ class InlineCommentSniff implements Sniff // Also, when the comment starts with cspell: don't check the end of the // comment. if (preg_match('/^\p{L}/u', $commentText) === 1 - && strpos($commentText, 'cspell:') !== 0 + && preg_match('/(cspell|spell\-checker):ignore/i', $commentText) === 0 ) { $commentCloser = $commentText[(strlen($commentText) - 1)]; $acceptedClosers = [ diff --git a/tests/Drupal/Commenting/InlineCommentUnitTest.inc b/tests/Drupal/Commenting/InlineCommentUnitTest.inc index 1b0188cce2b6cdf1bb73811f2ffa59cd12d26051..401d02fc8c0437fbd77dd9acf3e68fed10db7071 100644 --- a/tests/Drupal/Commenting/InlineCommentUnitTest.inc +++ b/tests/Drupal/Commenting/InlineCommentUnitTest.inc @@ -116,3 +116,13 @@ function test2() { return $x; } + +// Allow all the cspell comment variants. +// cspell:ignore bananarama +$x = 1; +// With some comment before it. +// cSpell:ignore bananarama +$x = 2; +// And here as well. +// spell-checker:ignore bananarama +$x = 3; diff --git a/tests/Drupal/Commenting/InlineCommentUnitTest.inc.fixed b/tests/Drupal/Commenting/InlineCommentUnitTest.inc.fixed index 901d3f56f1d73df5942ee7c492153e5743c1ed29..fabc368ff605ad05d0fb61419e47db59319232d1 100644 --- a/tests/Drupal/Commenting/InlineCommentUnitTest.inc.fixed +++ b/tests/Drupal/Commenting/InlineCommentUnitTest.inc.fixed @@ -115,3 +115,13 @@ function test2() { return $x; } + +// Allow all the cspell comment variants. +// cspell:ignore bananarama +$x = 1; +// With some comment before it. +// cSpell:ignore bananarama +$x = 2; +// And here as well. +// spell-checker:ignore bananarama +$x = 3;