use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class AvoidHtmlCommentCheckTest method should_detect_on_erb_documents.
@Test
public void should_detect_on_erb_documents() {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/AvoidHtmlCommentCheck/document.html.erb"), new AvoidHtmlCommentCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(6).withMessage("Make sure that the HTML comment does not contain sensitive information.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class TodoCommentCheckTest method detected.
@Test
public void detected() {
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/TodoCommentCheck.html"), new TodoCommentCheck());
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(3).withMessage("Complete the task associated to this \"TODO\" comment.").next().atLine(4).next().atLine(8);
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class IllegalNamespaceCheckTest method custom.
@Test
public void custom() {
IllegalNamespaceCheck check = new IllegalNamespaceCheck();
check.namespaces = "foo,baz";
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/IllegalNamespaceCheck.html"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(1).withMessage("Using \"baz\" namespace is not allowed.").next().atLine(1).withMessage("Using \"foo\" namespace is not allowed.").next().atLine(6).withMessage("Using \"foo\" namespace is not allowed.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class LibraryDependencyCheckTest method illegal_import.
@Test
public void illegal_import() throws FileNotFoundException {
LibraryDependencyCheck check = new LibraryDependencyCheck();
check.libraries = "java.sql";
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/LibraryDependencyCheck/IllegalImport.jsp"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(2).withMessage("Remove the usage of this library which is not allowed.");
}
use of org.sonar.plugins.html.visitor.HtmlSourceCode in project sonar-web by SonarSource.
the class IllegalAttributeCheckTest method custom.
@Test
public void custom() {
IllegalAttributeCheck check = new IllegalAttributeCheck();
check.attributes = "foo.a,b";
HtmlSourceCode sourceCode = TestHelper.scan(new File("src/test/resources/checks/IllegalAttributeCheck.html"), check);
checkMessagesVerifier.verify(sourceCode.getIssues()).next().atLine(1).withMessage("Remove the \"a\" attribute from the \"foo\" tag").next().atLine(3).withMessage("Remove the \"b\" attribute from the \"baz\" tag");
}
Aggregations