Skip to content

Commit c58e5a0

Browse files
committed
fix(InlineCommen): Allow spellchecker keyword (#3424914)
1 parent 05c5367 commit c58e5a0

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

coder_sniffer/Drupal/Sniffs/Commenting/InlineCommentSniff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public function process(File $phpcsFile, $stackPtr)
351351
// Also, when the comment starts with cspell: don't check the end of the
352352
// comment.
353353
if (preg_match('/^\p{L}/u', $commentText) === 1
354-
&& preg_match('/(cspell|spell\-checker):/i', $commentText) === 0
354+
&& preg_match('/(cspell|spell\-checker|spellchecker):/i', $commentText) === 0
355355
) {
356356
$commentCloser = $commentText[(strlen($commentText) - 1)];
357357
$acceptedClosers = [

tests/Drupal/Commenting/InlineCommentUnitTest.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,6 @@ $x = 2;
126126
// And here as well.
127127
// spell-checker:ignore bananarama
128128
$x = 3;
129+
// Different keword.
130+
// spellchecker:disable-next-line
131+
$x = 4;

tests/Drupal/Commenting/InlineCommentUnitTest.inc.fixed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,6 @@ $x = 2;
125125
// And here as well.
126126
// spell-checker:ignore bananarama
127127
$x = 3;
128+
// Different keword.
129+
// spellchecker:disable-next-line
130+
$x = 4;

0 commit comments

Comments
 (0)