Skip to content
Snippets Groups Projects
Unverified Commit cab1d0b1 authored by Boegie's avatar Boegie Committed by GitHub
Browse files

feat(InlineComment): cspell configuration comments don't need to end in a dot (#3207576 by Spokje)

parent adb06efa
Branches
Tags
No related merge requests found
......@@ -346,7 +346,11 @@ class InlineCommentSniff implements Sniff
// Only check the end of comment character if the start of the comment
// is a letter, indicating that the comment is just standard text.
if (preg_match('/^\p{L}/u', $commentText) === 1) {
// 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
) {
$commentCloser = $commentText[(strlen($commentText) - 1)];
$acceptedClosers = [
'full-stops' => '.',
......
......@@ -47,6 +47,9 @@ test();
// 2 spaces instead of one.
test();
// cspell:ignore lines starting with cspell: don't need to end with a period
test();
/**
* Test function.
*/
......
......@@ -46,6 +46,9 @@ test();
// 2 spaces instead of one.
test();
// cspell:ignore lines starting with cspell: don't need to end with a period
test();
/**
* Test function.
*/
......
......@@ -29,9 +29,9 @@ class InlineCommentUnitTest extends CoderSniffUnitTest
24 => 1,
44 => 1,
47 => 1,
59 => 1,
81 => 1,
83 => 1,
62 => 1,
84 => 1,
86 => 1,
];
}//end getErrorList()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment