use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class NonConsecutiveHeadingCheckTest method h2_with_h1.
@Test
public void h2_with_h1() throws Exception {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/NonConsecutiveHeadingCheck/H2WithH1.html"), new NonConsecutiveHeadingCheck());
checkMessagesVerifier.verify(sourceCode.getIssues());
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class NonConsecutiveHeadingCheckTest method h5_with_h4.
@Test
public void h5_with_h4() throws Exception {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/NonConsecutiveHeadingCheck/H5WithH4.html"), new NonConsecutiveHeadingCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(1).withMessage("Do not skip level H3.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class TableHeaderReferenceCheckTest method detected.
@Test
public void detected() throws Exception {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/TableHeaderReferenceCheck.html"), new TableHeaderReferenceCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLocation(35, 4, 35, 22).withMessage("id \"bar\" in \"headers\" does not reference any <th> header.").next().atLine(56).withMessage("id \"bar\" in \"headers\" does not reference any <th> header.").next().atLine(78).withMessage("id \"oof\" in \"headers\" does not reference any <th> header.").next().atLine(89).withMessage("id \"bar\" in \"headers\" reference the header of another column/row.").next().atLine(90).withMessage("id \"foo\" in \"headers\" reference the header of another column/row.").next().atLine(108).withMessage("id \"oof\" in \"headers\" does not reference any <th> header.").next().atLine(119).withMessage("id \"bar\" in \"headers\" reference the header of another column/row.").next().atLine(123).withMessage("id \"foo\" in \"headers\" reference the header of another column/row.").next().atLine(152).withMessage("id \"bar\" in \"headers\" does not reference any <th> header.").next().atLine(220).withMessage("id \"bar\" in \"headers\" does not reference any <th> header.").next().atLine(227).withMessage("id \"bar\" in \"headers\" does not reference any <th> header.").next().atLine(275).withMessage("id \"foo\" in \"headers\" does not reference any <th> header.").next().atLine(281).withMessage("id \"foo\" in \"headers\" does not reference any <th> header.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class PageCountLines method addMeasures.
private void addMeasures() {
HtmlSourceCode htmlSourceCode = getHtmlSourceCode();
htmlSourceCode.addMeasure(CoreMetrics.NCLOC, detailedLinesOfCode.size());
htmlSourceCode.addMeasure(CoreMetrics.COMMENT_LINES, detailedLinesOfComments.size());
htmlSourceCode.setDetailedLinesOfCode(detailedLinesOfCode);
LOG.debug("HtmlSensor: " + getHtmlSourceCode().toString() + ": " + detailedLinesOfComments.size() + "," + headerCommentLines + "," + blankLines);
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class PageCountLinesTest method testCountLines.
@Test
public void testCountLines() {
List<Node> nodeList = lexer.parse(readFile("src/main/webapp/user-properties.jsp"));
assertThat(nodeList.size()).isGreaterThan(100);
HtmlSourceCode htmlSourceCode = createHtmlSourceCode("test/user-properties.jsp");
scanner.scan(nodeList, htmlSourceCode);
assertThat(htmlSourceCode.getMeasure(CoreMetrics.NCLOC)).isEqualTo(224);
assertThat(htmlSourceCode.getDetailedLinesOfCode().size()).isEqualTo(224);
assertThat(htmlSourceCode.getMeasure(CoreMetrics.COMMENT_LINES)).isEqualTo(14);
}
Aggregations