private @NotNull InspectionProfileLoader<? extends InspectionProfileImpl> getInspectionProfileLoader(@NotNull Project project) {
    return new InspectionProfileLoaderBase<>(project) {
      @Override
      public @Nullable InspectionProfileImpl loadProfileByName(@NotNull String profileName) {
        InspectionProfileManager.getInstance().getProfiles(); //  force init provided profiles
        InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
        InspectionProfileImpl inspectionProfile = profileManager.getProfile(profileName, false);
        if (inspectionProfile == null) {  // check if the IDE profile is used for the project
          for (InspectionProfileImpl profile : profileManager.getProfiles()) {
            if (Comparing.strEqual(profile.getName(), profileName)) {
              inspectionProfile = profile;
              break;
            }
          }
        }

        return inspectionProfile;
      }

      @Override
      public @Nullable InspectionProfileImpl loadProfileByPath(@NotNull String profilePath) {
        InspectionProfileImpl inspectionProfileFromYaml = tryLoadProfileFromYaml(profilePath,
                                                                                 InspectionToolRegistrar.getInstance(),
                                                                                 (BaseInspectionProfileManager)InspectionProjectProfileManager.getInstance(project));
        if (inspectionProfileFromYaml != null) return inspectionProfileFromYaml;

        try {
          InspectionProfileImpl inspectionProfile = ApplicationInspectionProfileManagerBase.getInstanceBase().loadProfile(profilePath);
          if (inspectionProfile != null) {
            reportMessage(1, "Loaded the '" + inspectionProfile.getName() + "' profile from the file '" + profilePath + "'");
          }
          return inspectionProfile;
        }
        catch (IOException e) {
          throw new InspectionApplicationException("Failed to read inspection profile file '" + profilePath + "': " + e);
        }
        catch (JDOMException e) {
          throw new InspectionApplicationException("Invalid xml structure of inspection profile file '" + profilePath + "': " + e);
        }
      }
    };
  }
private @NotNull InspectionProfileLoader<? extends InspectionProfileImpl> getInspectionProfileLoader(@NotNull Project project)