PsiElementVisitor (final @NotNull ProblemsHolder holder, boolean isOnTheFly) { if (isOnTheFly) { //disable good code red in the editor as there general highlighting pass already does the job and the inspection just mess things return PsiElementVisitor.EMPTY_VISITOR; } final PsiFile file = holder.getFile(); if (InjectedLanguageManager.getInstance(file.getProject()).isInjectedFragment(file)) { return PsiElementVisitor.EMPTY_VISITOR; } final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(file); if (virtualFile == null || CompilerConfiguration.getInstance(holder.getProject()).isExcludedFromCompilation(virtualFile)) { return PsiElementVisitor.EMPTY_VISITOR; } GoodCodeRedVisitor visitor = getGoodCodeRedVisitor(file); if (visitor == null) { return PsiElementVisitor.EMPTY_VISITOR; } return visitor.createVisitor(holder); }