From ecb9e6e9f013383f6b017349ac494aebe6f8249b Mon Sep 17 00:00:00 2001 From: indigoxela Date: Fri, 2 Aug 2024 08:53:24 +0200 Subject: [PATCH] Issue #16: Allow additional inline comments before special cspell comments --- Backdrop/Sniffs/Commenting/InlineCommentSniff.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Backdrop/Sniffs/Commenting/InlineCommentSniff.php b/Backdrop/Sniffs/Commenting/InlineCommentSniff.php index 6cbc2e9..3888035 100644 --- a/Backdrop/Sniffs/Commenting/InlineCommentSniff.php +++ b/Backdrop/Sniffs/Commenting/InlineCommentSniff.php @@ -216,6 +216,12 @@ public function process(File $phpcsFile, $stackPtr) break; } + // Comments for cspell exclude or include patterns also mean a new + // section. + if (preg_match('|^//[\s]*cspell:|', $tokens[$nextComment]['content']) === 1) { + break; + } + $commentTokens[] = $nextComment; $lastComment = $nextComment; }//end while