private void runAnalysis(Project project,
                           Path projectPath,
                           InspectionProfileImpl inspectionProfile,
                           AnalysisScope scope,
                           InspectionsReportConverter reportConverter,
                           Path resultsDataPath) throws IOException {
    GlobalInspectionContextEx context = createGlobalInspectionContext(project);
    if (myAnalyzeChanges) {
      AnalysisScope baseScope = scope;
      GlobalInspectionContextEx baseContext = createGlobalInspectionContext(project);

      scope = runAnalysisOnCodeWithoutChanges(
        project,
        baseContext,
        () -> runUnderProgress(project, projectPath, baseContext, baseScope, resultsDataPath, new ArrayList<>())
      );
      setupSecondAnalysisHandler(project, context);
    }

    List<Path> inspectionsResults = new ArrayList<>();
    runUnderProgress(project, projectPath, context, scope, resultsDataPath, inspectionsResults);
    Path descriptionsFile = resultsDataPath.resolve(InspectionsResultUtil.DESCRIPTIONS + InspectionsResultUtil.XML_EXTENSION);
    try {
      InspectionsResultUtil.describeInspections(descriptionsFile,
                                                myRunWithEditorSettings ? null : inspectionProfile.getName(),
                                                inspectionProfile);
    }
    catch (XMLStreamException e) {
      throw new IOException(e);
    }
    inspectionsResults.add(descriptionsFile);
    // convert report
    if (reportConverter != null) {
      try {
        List<File> results = ContainerUtil.map(inspectionsResults, Path::toFile);
        reportConverter.convert(resultsDataPath.toString(), myOutPath, context.getTools(),
                                results);
        InspectResultsConsumer.runConsumers(context.getTools(), results, project);
        if (myOutPath != null) {
          reportConverter.projectData(project, Paths.get(myOutPath).resolve(PROJECT_STRUCTURE_DIR));
        }
      }
      catch (InspectionsReportConverter.ConversionException e) {
        reportError("\n" + e.getMessage());
        printHelpAndExit();
      }
    }
  }
private void runAnalysis(Project project,
                           Path projectPath,
                           InspectionProfileImpl inspectionProfile,
                           AnalysisScope scope,
                           InspectionsReportConverter reportConverter,
                           Path resultsDataPath)