use of com.puppycrawl.tools.checkstyle.TreeWalker in project methods-distance by sevntu-checkstyle.
the class ReportCli method main.
public static void main(String... args) throws CheckstyleException {
final DependencyInformationConsumer consumer = new ViolationReporterDependencyInformationConsumer();
final ModuleFactory moduleFactory = new DependencyInformationConsumerInjector(consumer);
final DefaultConfiguration moduleConfig = new DefaultConfiguration(MethodCallDependencyCheckstyleModule.class.getCanonicalName());
moduleConfig.addAttribute("screenLinesCount", "50");
final TreeWalker tw = new TreeWalker();
tw.setModuleFactory(moduleFactory);
tw.finishLocalSetup();
tw.setupChild(moduleConfig);
final AuditListener listener = new DefaultLogger(System.out, false);
final Checker checker = new Checker();
checker.setModuleFactory(moduleFactory);
checker.addFileSetCheck(tw);
checker.addListener(listener);
final List<File> files = Collections.singletonList(new File(args[0]));
checker.process(files);
}
use of com.puppycrawl.tools.checkstyle.TreeWalker in project checkstyle by checkstyle.
the class TestInputConfiguration method createConfigurationWithoutFilters.
public DefaultConfiguration createConfigurationWithoutFilters() {
final DefaultConfiguration root = new DefaultConfiguration(ROOT_MODULE_NAME);
final DefaultConfiguration treeWalker = new DefaultConfiguration(TreeWalker.class.getName());
root.addProperty("charset", StandardCharsets.UTF_8.name());
childrenModules.stream().map(ModuleInputConfiguration::createConfiguration).filter(moduleConfig -> !moduleConfig.getName().endsWith("Filter")).forEach(moduleConfig -> {
if (CHECKER_CHILDREN.contains(moduleConfig.getName())) {
root.addChild(moduleConfig);
} else {
treeWalker.addChild(moduleConfig);
}
});
root.addChild(treeWalker);
return root;
}
use of com.puppycrawl.tools.checkstyle.TreeWalker in project checkstyle by checkstyle.
the class TestInputConfiguration method createConfiguration.
public DefaultConfiguration createConfiguration() {
final DefaultConfiguration root = new DefaultConfiguration(ROOT_MODULE_NAME);
final DefaultConfiguration treeWalker = new DefaultConfiguration(TreeWalker.class.getName());
root.addProperty("charset", StandardCharsets.UTF_8.name());
childrenModules.stream().map(ModuleInputConfiguration::createConfiguration).forEach(moduleConfig -> {
if (CHECKER_CHILDREN.contains(moduleConfig.getName())) {
root.addChild(moduleConfig);
} else {
treeWalker.addChild(moduleConfig);
}
});
root.addChild(treeWalker);
return root;
}
Aggregations