Search in sources :

Example 1 with ViolationReporterDependencyInformationConsumer

use of com.github.sevntu.checkstyle.module.ViolationReporterDependencyInformationConsumer 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);
}
Also used : ModuleFactory(com.puppycrawl.tools.checkstyle.ModuleFactory) Checker(com.puppycrawl.tools.checkstyle.Checker) ViolationReporterDependencyInformationConsumer(com.github.sevntu.checkstyle.module.ViolationReporterDependencyInformationConsumer) DependencyInformationConsumerInjector(com.github.sevntu.checkstyle.common.DependencyInformationConsumerInjector) TreeWalker(com.puppycrawl.tools.checkstyle.TreeWalker) DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) MethodCallDependencyCheckstyleModule(com.github.sevntu.checkstyle.module.MethodCallDependencyCheckstyleModule) AuditListener(com.puppycrawl.tools.checkstyle.api.AuditListener) ViolationReporterDependencyInformationConsumer(com.github.sevntu.checkstyle.module.ViolationReporterDependencyInformationConsumer) DependencyInformationConsumer(com.github.sevntu.checkstyle.module.DependencyInformationConsumer) DefaultLogger(com.puppycrawl.tools.checkstyle.DefaultLogger) File(java.io.File)

Aggregations

DependencyInformationConsumerInjector (com.github.sevntu.checkstyle.common.DependencyInformationConsumerInjector)1 DependencyInformationConsumer (com.github.sevntu.checkstyle.module.DependencyInformationConsumer)1 MethodCallDependencyCheckstyleModule (com.github.sevntu.checkstyle.module.MethodCallDependencyCheckstyleModule)1 ViolationReporterDependencyInformationConsumer (com.github.sevntu.checkstyle.module.ViolationReporterDependencyInformationConsumer)1 Checker (com.puppycrawl.tools.checkstyle.Checker)1 DefaultConfiguration (com.puppycrawl.tools.checkstyle.DefaultConfiguration)1 DefaultLogger (com.puppycrawl.tools.checkstyle.DefaultLogger)1 ModuleFactory (com.puppycrawl.tools.checkstyle.ModuleFactory)1 TreeWalker (com.puppycrawl.tools.checkstyle.TreeWalker)1 AuditListener (com.puppycrawl.tools.checkstyle.api.AuditListener)1 File (java.io.File)1