public static void describeInspections(@NonNls Path outputPath, @Nullable String name, @NotNull InspectionProfile profile)
    throws IOException, XMLStreamException {
    Map<Pair<String, String>, Set<InspectionToolWrapper<?, ?>>> map = new HashMap<>();
    for (InspectionToolWrapper<?, ?> toolWrapper : profile.getInspectionTools(null)) {
      String groupName = toolWrapper.getGroupDisplayName();
      String[] path = toolWrapper.getGroupPath();
      String groupPath = path.length == 0 ? "" : String.join("/", JBIterable.of(path).take(path.length - 1));
      Set<InspectionToolWrapper<?, ?>> groupInspections = map.computeIfAbsent(
        new Pair<>(groupName, groupPath), __ -> new HashSet<>());
      groupInspections.add(toolWrapper);
    }

    try (Writer fw = new OutputStreamWriter(Files.newOutputStream(outputPath), StandardCharsets.UTF_8)) {
      XMLStreamWriter xmlWriter = XMLOutputFactory.newDefaultFactory().createXMLStreamWriter(fw);
      xmlWriter.writeStartElement(INSPECTIONS_NODE);
      if (name != null) {
        xmlWriter.writeAttribute(PROFILE, name);
      }
      List<String> inspectionsWithoutDescriptions = new ArrayList<>(1);
      for (Map.Entry<Pair<String, String>, Set<InspectionToolWrapper<?, ?>>> entry : map.entrySet()) {
        xmlWriter.writeStartElement("group");
        String groupName = entry.getKey().getFirst();
        String groupPath = entry.getKey().getSecond();
        xmlWriter.writeAttribute("name", groupName);
        xmlWriter.writeAttribute("path", groupPath);
        for (InspectionToolWrapper<?, ?> toolWrapper : entry.getValue()) {
          xmlWriter.writeStartElement("inspection");
          final String shortName = toolWrapper.getShortName();
          xmlWriter.writeAttribute("shortName", shortName);
          xmlWriter.writeAttribute("defaultSeverity", toolWrapper.getDefaultLevel().getSeverity().getName());
          xmlWriter.writeAttribute("displayName", toolWrapper.getDisplayName());
          xmlWriter.writeAttribute("enabled", Boolean.toString(isToolEnabled(profile, shortName)));
          String language = toolWrapper.getLanguage();
          if (language != null) {
            xmlWriter.writeAttribute("language", language);
          }
          InspectionEP extension = toolWrapper.getExtension();
          if (extension != null) {
            PluginDescriptor plugin = extension.getPluginDescriptor();
            String pluginId = plugin.getPluginId().getIdString();
            xmlWriter.writeAttribute("pluginId", pluginId);
            xmlWriter.writeAttribute("pluginVersion", plugin.getVersion());
          }
          xmlWriter.writeAttribute("isGlobalTool", String.valueOf(toolWrapper instanceof GlobalInspectionToolWrapper));

          final String description = toolWrapper.loadDescription();
          if (description != null) {
            xmlWriter.writeCharacters(description);
          }
          else {
            inspectionsWithoutDescriptions.add(shortName);
          }
          xmlWriter.writeEndElement();
        }
        xmlWriter.writeEndElement();
      }
      xmlWriter.writeEndElement();

      if (!inspectionsWithoutDescriptions.isEmpty()) {
        LOG.error("Descriptions are missed for tools: " + StringUtil.join(inspectionsWithoutDescriptions, ", "));
      }
    }
  }
public static void describeInspections(@NonNls Path outputPath, @Nullable String name, @NotNull InspectionProfile profile)