use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class ComplexityCheckTest method custom.
@Test
public void custom() {
ComplexityCheck check = new ComplexityCheck();
check.max = 15;
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/ComplexityCheck.html"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(null).withCost(2d).withMessage("Split this file to reduce complexity per file from 17 to no more than the 15 authorized.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class FileLengthCheckTest method custom.
@Test
public void custom() {
FileLengthCheck check = new FileLengthCheck();
check.maxLength = 2;
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/FileLengthCheck.html"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(null).withMessage("Current file has 3 lines, which is greater than 2 authorized. Split it into smaller files.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class MaxLineLengthCheckTest method test.
@Test
public void test() {
HtmlSourceCode file = TestHelper.scan(new File("src/test/resources/checks/MaxLineLengthCheck.html"), new MaxLineLengthCheck());
checkMessagesVerifier.verify(file.getIssues()).next().atLine(2).withMessage("Split this 121 characters long line (which is greater than 120 authorized).").next().atLine(3).withMessage("Split this 122 characters long line (which is greater than 120 authorized).").next().atLine(8).withMessage("Split this 133 characters long line (which is greater than 120 authorized).").next().atLine(15).withMessage("Split this 137 characters long line (which is greater than 120 authorized).");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class MaxLineLengthCheckTest method custom.
@Test
public void custom() {
MaxLineLengthCheck check = new MaxLineLengthCheck();
check.maxLength = 40;
HtmlSourceCode file = TestHelper.scan(new File("src/test/resources/checks/MaxLineLengthCheck.html"), check);
checkMessagesVerifier.verify(file.getIssues()).next().atLine(1).next().atLine(2).next().atLine(3).next().atLine(6).withMessage("Split this 41 characters long line (which is greater than 40 authorized).").next().atLine(8).withMessage("Split this 133 characters long line (which is greater than 40 authorized).").next().atLine(15).withMessage("Split this 137 characters long line (which is greater than 40 authorized).");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class AvoidCommentedOutCodeCheckTest method detected.
@Test
public void detected() {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/AvoidCommentedOutCodeCheck.html"), new AvoidCommentedOutCodeCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(3).withMessage("Remove this commented out code.").next().atLine(9).next().atLine(11);
}
Aggregations