File tree Expand file tree Collapse file tree
custom-checks/checkstyle/src
main/java/org/openhab/tools/analysis/checkstyle/readme
java/org/openhab/tools/analysis/checkstyle/test
resources/checkstyle/markdownCheckTest/testFrontMatterIgnored Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515import static org .openhab .tools .analysis .checkstyle .api .CheckConstants .*;
1616
1717import java .io .File ;
18+ import java .util .List ;
1819
1920import org .openhab .tools .analysis .checkstyle .api .AbstractStaticCheck ;
2021
2122import com .puppycrawl .tools .checkstyle .api .CheckstyleException ;
2223import com .puppycrawl .tools .checkstyle .api .FileText ;
24+ import com .vladsch .flexmark .ext .yaml .front .matter .YamlFrontMatterExtension ;
2325import com .vladsch .flexmark .parser .Parser ;
2426import com .vladsch .flexmark .util .ast .Node ;
2527import com .vladsch .flexmark .util .data .MutableDataSet ;
@@ -54,6 +56,7 @@ private void checkReadMe(FileText fileText) {
5456 MutableDataSet options = new MutableDataSet ();
5557 // By setting this option to true, the parser provides line numbers in the original markdown text for each node
5658 options .set (Parser .TRACK_DOCUMENT_LINES , true );
59+ options .set (Parser .EXTENSIONS , List .of (YamlFrontMatterExtension .create ()));
5760
5861 Node readmeMarkdownNode = parseMarkdown (fileText , options );
5962 // CallBack is used in order to use the protected log method of the AbstractStaticCheck in the Visitor
Original file line number Diff line number Diff line change @@ -249,6 +249,11 @@ public void testDocFolderWrong() throws Exception {
249249 verifyMarkDownFile ("testDocFolderWrong" , expectedMessages );
250250 }
251251
252+ @ Test
253+ public void testFrontMatterIgnored () throws Exception {
254+ verifyMarkDownFile ("testFrontMatterIgnored" , noMessagesExpected ());
255+ }
256+
252257 private void createValidConfig () {
253258 config = createModuleConfig (MarkdownCheck .class );
254259 }
Original file line number Diff line number Diff line change 1+ ---
2+ title : Sample document
3+ description : |
4+ # not a header
5+ * not a list
6+ ```
7+ not code formatting
8+ ```
9+ children :
10+ - ["doc/test1", "Test1"]
11+ - ["doc/test2", "Test2"]
12+ ---
13+
14+ # Actual Header
15+
16+ Body text.
You can’t perform that action at this time.
0 commit comments