final CheckStylePlugin checkStylePlugin,
final Module module)
throws IOException {
ScannableFile scannableFile = null;
try {
final CheckerContainer checkerContainer = getChecker(checkStylePlugin, module);
final Configuration config = getConfig(checkStylePlugin, module);
if (checkerContainer == null || config == null) {
return new ProblemDescriptor[0];
}
final List<Check> checks = CheckFactory.getChecks(config);
final Document fileDocument = PsiDocumentManager.getInstance(
manager.getProject()).getDocument(psiFile);
if (fileDocument == null) {
LOG.debug("Skipping check - file is binary or has no document: " + psiFile.getName());
return null;
}
scannableFile = new ScannableFile(psiFile, module);
final Map<String, PsiFile> filesToScan = Collections.singletonMap(scannableFile.getAbsolutePath(), psiFile);
final boolean suppressingErrors = checkStylePlugin.getConfiguration().isSuppressingErrors();
final CheckStyleAuditListener listener = new CheckStyleAuditListener(
filesToScan, manager, false, suppressingErrors, checkerContainer.getTabWidth(), checks);
final Checker checker = checkerContainer.getChecker();
synchronized (checker) {
checker.addListener(listener);
checker.process(Arrays.asList(scannableFile.getFile()));
checker.removeListener(listener);
}