void (@NotNull AnalysisScope scope) { super.notifyInspectionsFinished(scope); context.message(PerformanceTestingBundle.message("command.inspection.finish"), getLine()); if (enabledInspectionTools.size() == 1 && !myOptions.hideResults) { try { File tempDirectory = FileUtil.createTempDirectory("inspection", "result"); final InspectionResultsView view = getView(); if (view != null) { ExportToXMLActionKt.dumpToXml(view.getCurrentProfile(), view.getTree(), view.getProject(), view.getGlobalInspectionContext(), tempDirectory.toPath()); File[] files = tempDirectory.listFiles(); if (files != null) { for (File file : files) { if (file.isHidden()) { continue; } String identifier = buildIdentifier(file.getName(), myOptions.inspectionTrueFields, project); context.message("#########", getLine()); context.message(file.getName(), getLine()); context.message( ArrayUtil.isEmpty(myOptions.inspectionTrueFields) ? null : StringUtil.join(myOptions.inspectionTrueFields, "-"), getLine()); context.message(project.getName(), getLine()); context.message("#########", getLine()); Path path = file.toPath(); context.message(path.toString(), getLine()); long warningCount; try (Stream<String> lines = Files.lines(path).filter(line -> line.contains("<problem>"))) { warningCount = lines.count(); } if (ApplicationManagerEx.isInIntegrationTest()) { if (warningCount < Integer.MAX_VALUE) { Path perfMetricsPath = Paths.get(PathManager.getLogPath()).resolve("performance-metrics").resolve("inspectionMetrics.json"); ResultsToFileProcessor.writeMetricsToJson(perfMetricsPath, "inspection_execution", (int)warningCount, null); } else { LOGGER.error("warningCount is greater than Integer.MAX_VALUE"); } } reportStatisticsToTeamCity(identifier, String.valueOf(warningCount)); saveArtifact(path, identifier); } } else { LOGGER.error("tempDirectory.listFiles() is null"); } } } catch (IOException ex) { LOGGER.error(ex); } } actionCallback.setDone(); }