use of com.github.sevntu.checkstyle.common.MethodCallDependencyCheckInvoker in project methods-distance by sevntu-checkstyle.
the class MainServlet method processDsm.
private void processDsm(URL sourceUrl, HttpServletResponse resp) throws CheckstyleException, IOException {
class DsmDependencyInformationConsumer implements DependencyInformationConsumer {
private Configuration configuration;
@Override
public void setConfiguration(Configuration configuration) {
this.configuration = configuration;
}
@Override
public void accept(String filePath, Dependencies dependencies) {
try {
final String javaSource = FileUtils.getFileContents(filePath);
final MethodOrder methodOrder = new MethodOrder(dependencies);
final String html = DependencyInfoMatrixSerializer.serialize(methodOrder, javaSource, configuration);
resp.setContentType("text/html");
resp.getWriter().append(html);
} catch (final IOException | CheckstyleException ex) {
throw new ResponseGenerationException(ex);
}
}
}
final Map<String, String> config = getCheckConfiguration();
final DsmDependencyInformationConsumer consumer = new DsmDependencyInformationConsumer();
final MethodCallDependencyCheckInvoker invoker = new MethodCallDependencyCheckInvoker(config, consumer);
consumer.setConfiguration(invoker.getConfiguration());
invoker.invoke(Collections.singletonList(downloadSource(sourceUrl)));
}
use of com.github.sevntu.checkstyle.common.MethodCallDependencyCheckInvoker in project methods-distance by sevntu-checkstyle.
the class Main method main.
public static void main(String... args) throws CheckstyleException {
final CliArguments arguments = new CliArguments(args);
final Map<String, String> attributes = Collections.singletonMap("screenLinesCount", "50");
final DependencyInformationSerializer serializer = new DependencyInformationSerializer(arguments);
final MethodCallDependencyCheckInvoker invoker = new MethodCallDependencyCheckInvoker(attributes, serializer);
invoker.invoke(arguments.getFiles());
}
use of com.github.sevntu.checkstyle.common.MethodCallDependencyCheckInvoker in project methods-distance by sevntu-checkstyle.
the class ReorderCli method main.
public static void main(String... args) throws CheckstyleException {
final Map<String, String> attributes = Collections.singletonMap("screenLinesCount", "50");
final DependencyInformationSerializer serializer = new DependencyInformationSerializer();
final MethodCallDependencyCheckInvoker runner = new MethodCallDependencyCheckInvoker(attributes, serializer);
final List<File> files = Collections.singletonList(new File(args[0]));
runner.invoke(files);
}
use of com.github.sevntu.checkstyle.common.MethodCallDependencyCheckInvoker in project methods-distance by sevntu-checkstyle.
the class MainServlet method processDot.
private void processDot(URL sourceUrl, HttpServletResponse resp) throws CheckstyleException, IOException {
final DependencyInformationConsumer consumer = (filePath, dependencies) -> {
try {
final String dot = DependencyInfoGraphSerializer.serializeInfo(dependencies);
resp.setContentType("text/vnd.graphviz");
resp.getWriter().append(dot);
} catch (final IOException ex) {
throw new ResponseGenerationException(ex);
}
};
final Map<String, String> config = getCheckConfiguration();
final MethodCallDependencyCheckInvoker invoker = new MethodCallDependencyCheckInvoker(config, consumer);
invoker.invoke(Collections.singletonList(downloadSource(sourceUrl)));
}
Aggregations