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
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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'             => '.',
+3 −0
Original line number Diff line number Diff line
@@ -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.
 */
+3 −0
Original line number Diff line number Diff line
@@ -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.
 */
+3 −3
Original line number Diff line number Diff line
@@ -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()