use of org.infernus.idea.checkstyle.service.entities.CheckerWithConfig in project checkstyle-idea by jshiell.
the class OpDestroyCheckerTest method testDestroyChecker.
@Test
public void testDestroyChecker() {
CheckerWithConfig checkerWithConfig = new CheckerWithConfig(new Checker(), new DefaultConfiguration("testConfig"));
new CheckstyleActionsImpl(PROJECT, mock(CheckstyleProjectService.class)).destroyChecker(checkerWithConfig);
}
use of org.infernus.idea.checkstyle.service.entities.CheckerWithConfig in project checkstyle-idea by jshiell.
the class OpCreateChecker method execute.
@Override
@NotNull
public CheckStyleChecker execute(@NotNull final Project project) throws CheckstyleException {
final Configuration csConfig = loadConfig(project);
final Checker checker = new Checker();
// for Checkstyle to load modules (checks)
checker.setModuleClassLoader(getClass().getClassLoader());
// for checks to load the classes and resources to be analyzed
setClassLoader(checker, loaderOfCheckedCode);
try {
checker.configure(csConfig);
} catch (Error e) {
// e.g. java.lang.NoClassDefFoundError thrown by Checkstyle for pre-8.0 custom checks
throw new CheckstyleToolException(e);
}
CheckerWithConfig cwc = new CheckerWithConfig(checker, csConfig);
final TabWidthAndBaseDirProvider configs = configurations != null ? configurations : new Configurations(module, csConfig);
return new CheckStyleChecker(cwc, configs.tabWidth(), configs.baseDir(), checkstyleProjectService.getCheckstyleInstance());
}
use of org.infernus.idea.checkstyle.service.entities.CheckerWithConfig in project checkstyle-idea by jshiell.
the class OpScanTest method testEmptyListOfFiles.
@Test
public void testEmptyListOfFiles() throws CheckstyleException {
OpScan cmd = new OpScan(new CheckerWithConfig(null, null), Collections.emptyList(), false, 2, Optional.empty());
Assert.assertEquals(Collections.emptyMap(), cmd.execute(PROJECT));
}
Aggregations