webapp.index.jsp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jxlint Show documentation
Show all versions of jxlint Show documentation
Framework for doing static analysis in Java
The newest version!
<%@ page import="com.google.common.base.Joiner" %>
<%@ page import="com.google.common.collect.Lists" %>
<%@ page import="com.selesse.jxlint.model.rules.LintRule" %>
<%@ page import="com.selesse.jxlint.settings.ProgramSettings" %>
<%@ page import="com.selesse.jxlint.web.HtmlReportExecutor" %>
<%@ page import="java.util.List" %>
<%
String folder = request.getParameter("folder");
String[] rulesEnabled = request.getParameterValues("ruleEnabled");
ProgramSettings programSettings = (ProgramSettings) application.getAttribute("programSettings");
String nameAndVersion = programSettings.getProgramName() + " " + programSettings.getProgramVersion();
%>
<%= nameAndVersion %> - web validator
<%= nameAndVersion %> - web validator
<%!
private boolean ruleIsChecked(String[] rulesEnabled, LintRule lintRule) {
if (rulesEnabled == null) {
return lintRule.isEnabled();
}
List rulesEnabledList = Lists.newArrayList(rulesEnabled);
return rulesEnabledList.contains(lintRule.getName());
}
%>
jxlintArgs = Lists.newArrayList("--check");
jxlintArgs.add(Joiner.on(",").join(rulesEnabled));
jxlintArgs.add(folder);
rulesEnabled = new String[jxlintArgs.size()];
jxlintArgs.toArray(rulesEnabled);
HtmlReportExecutor htmlReportExecutor = new HtmlReportExecutor(folder, programSettings, rulesEnabled);
if (htmlReportExecutor.directoryExists()) {
htmlReportExecutor.generateReport();
response.sendRedirect("report.jsp");
%>
<% } else { %>
Directory '<%= jxlintArgs.get(jxlintArgs.size() - 1) %>' does not exist
<% }
} %>
<%
if (request.getParameter("folder") != null && rulesEnabled != null) {
List