use of org.infernus.idea.checkstyle.csapi.CheckstyleActions in project checkstyle-idea by jshiell.
the class CheckstylePluginApi method visitCurrentConfiguration.
public void visitCurrentConfiguration(@NotNull final ConfigurationVisitor visitor) {
ConfigurationLocation activeLocation = pluginConfigurationManager().getCurrent().getActiveLocation();
if (activeLocation != null) {
CheckstyleActions checkstyleInstance = checkstyleProjectService().getCheckstyleInstance();
checkstyleInstance.peruseConfiguration(checkstyleInstance.loadConfiguration(activeLocation, true, new HashMap<>()), module -> visitor.accept(activeLocation.getDescription(), module));
}
}
use of org.infernus.idea.checkstyle.csapi.CheckstyleActions in project checkstyle-idea by jshiell.
the class ServiceLayerBasicTest method createChecker.
private CheckStyleChecker createChecker(@NotNull final String configXmlFile) throws IOException, URISyntaxException {
final ConfigurationLocation configLoc = new StringConfigurationLocation(FileUtil.readFile(configXmlFile), mock(Project.class));
final Module module = mock(Module.class);
when(module.getProject()).thenReturn(PROJECT);
final TabWidthAndBaseDirProvider configurations = mock(TabWidthAndBaseDirProvider.class);
when(configurations.tabWidth()).thenReturn(2);
when(configurations.baseDir()).thenReturn(Optional.of(new File(getClass().getResource(configXmlFile).toURI()).getParent()));
final CheckstyleActions csInstance = checkstyleProjectService.getCheckstyleInstance();
return csInstance.createChecker(module, configLoc, Collections.emptyMap(), configurations, getClass().getClassLoader());
}
use of org.infernus.idea.checkstyle.csapi.CheckstyleActions in project checkstyle-idea by jshiell.
the class VersionMixExceptionTest method runChecker.
private void runChecker(@NotNull final CheckStyleChecker checker) throws URISyntaxException {
final File sourceFile = new File(getClass().getResource("SourceFile.java").toURI());
final ScannableFile file1 = mock(ScannableFile.class);
when(file1.getFile()).thenReturn(sourceFile);
final List<ScannableFile> filesToScan = Collections.singletonList(file1);
final CheckstyleActions csInstance = csService.getCheckstyleInstance();
//
csInstance.scan(//
checker.getCheckerWithConfig4UnitTest(), //
filesToScan, //
false, //
2, Optional.of(sourceFile.getParent()));
}
use of org.infernus.idea.checkstyle.csapi.CheckstyleActions in project checkstyle-idea by jshiell.
the class ServiceLayerBasicTest method runChecker.
private void runChecker(@NotNull final CheckStyleChecker checker) throws URISyntaxException {
final File sourceFile = new File(getClass().getResource("SourceFile.java").toURI());
final ScannableFile file1 = mock(ScannableFile.class);
when(file1.getFile()).thenReturn(sourceFile);
final List<ScannableFile> filesToScan = Collections.singletonList(file1);
final CheckstyleActions csInstance = checkstyleProjectService.getCheckstyleInstance();
//
csInstance.scan(//
checker.getCheckerWithConfig4UnitTest(), //
filesToScan, //
false, //
2, Optional.of(sourceFile.getParent()));
}
Aggregations