use of com.github.sevntu.checkstyle.common.DependencyInformationConsumerInjector 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.github.sevntu.checkstyle.common.DependencyInformationConsumerInjector in project methods-distance by sevntu-checkstyle.
the class MethodCallDependenciesModuleTestSupport method createChecker.
protected final Checker createChecker(Configuration checkConfig) throws Exception {
final DefaultConfiguration dc = createCheckerConfig(checkConfig);
final Checker checker = new Checker();
// make sure the tests always run with default error messages (language-invariant)
// so the tests don't fail in supported locales like German
final Locale locale = Locale.ROOT;
checker.setLocaleCountry(locale.getCountry());
checker.setLocaleLanguage(locale.getLanguage());
// following line is the only difference to super-class implementation of this method.
checker.setModuleFactory(new DependencyInformationConsumerInjector(collector));
checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader());
checker.configure(dc);
checker.addListener(new BaseCheckTestSupport.BriefLogger(stream));
return checker;
}
Aggregations