void (@NotNull AnalysisScope scope, @NotNull InspectionManager manager, @NotNull GlobalInspectionContext context, @NotNull ProblemDescriptionsProcessor processor) { final Project project = context.getProject(); final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex(); final SearchScope searchScope = ReadAction.compute(() -> scope.toSearchScope()); if (!(searchScope instanceof GlobalSearchScope globalSearchScope)) { return; } index.iterateContent(file -> { if (onlyReportDirectoriesUnderSourceRoots && ReadAction.compute(() -> !index.isInSourceContent(file))) { return true; } if (!file.isDirectory() || file.getChildren().length != 0) { return true; } final PsiDirectory directory = ReadAction.compute(() -> PsiManager.getInstance(project).findDirectory(file)); final RefElement refDirectory = context.getRefManager().getReference(directory); if (refDirectory == null || context.shouldCheck(refDirectory, this)) { return true; } final String relativePath = getPathRelativeToModule(file, project); if (relativePath == null) { return true; } processor.addProblemElement(refDirectory, manager.createProblemDescriptor( LangBundle.message("empty.directories.problem.descriptor", relativePath), new EmptyPackageFix(file.getUrl(), file.getName()))); return true; }, globalSearchScope); }