private Pair executeImpl()

in src/main/java/org/jetbrains/plugins/spotbugs/core/FindBugsStarter.java [241:336]


	private Pair<SortedBugCollection, Reporter> executeImpl(
			@NotNull final ProgressIndicator indicator,
			@NotNull final Module module,
			@NotNull final FindBugsProject findBugsProject,
			final int analyzedClassCountOffset
	) throws IOException, InterruptedException {

		final ModuleSettings moduleSettings = ModuleSettings.getInstance(module);
		AbstractSettings settings = projectSettings;
		String importFilePathKey = WorkspaceSettings.PROJECT_IMPORT_FILE_PATH_KEY;
		if (moduleSettings.overrideProjectSettings) {
			settings = moduleSettings;
			importFilePathKey = module.getName();
		}

		final String importFilePath = WorkspaceSettings.getInstance(project).importFilePath.get(importFilePathKey);
		if (!StringUtil.isEmptyOrSpaces(importFilePath)) {
			final boolean success = RuntimeSettingsImporter.importSettings(project, module, settings, importFilePath, importFilePathKey);
			/*
			 * Do continue analysis on import settings failure, but invalidate plugin state
			 * on success because the plugins settings can change anytime.
			 */
			if (success) {
				PluginLoader.invalidate();
			}
		}

		if (!PluginLoader.load(project, moduleSettings.overrideProjectSettings ? module : null, settings, true)) {
			throw new ProcessCanceledException();
		}

		final DetectorFactoryCollection detectorFactoryCollection = DetectorFactoryCollection.instance();

		final ProjectFilterSettings projectFilterSettings;
		final UserPreferences userPrefs = UserPreferences.createDefaultUserPreferences();
		{
			userPrefs.setEffort(settings.analysisEffort);
			projectFilterSettings = userPrefs.getFilterSettings();
			projectFilterSettings.setMinRank(settings.minRank);
			projectFilterSettings.setMinPriority(settings.minPriority);

			for (final String category : DetectorFactoryCollection.instance().getBugCategories()) {
				projectFilterSettings.removeCategory(category);
				projectFilterSettings.addCategory(category);
			}
			for (final String category : settings.hiddenBugCategory) {
				projectFilterSettings.removeCategory(category);
			}

			userPrefs.setIncludeFilterFiles(new HashMap<>(settings.includeFilterFiles));
			userPrefs.setExcludeBugsFiles(new HashMap<>(settings.excludeBugsFiles));
			userPrefs.setExcludeFilterFiles(new HashMap<>(settings.excludeFilterFiles));

			configureDetectors(settings.detectors, detectorFactoryCollection, userPrefs);
			for (final PluginSettings pluginSettings : settings.plugins) {
				configureDetectors(pluginSettings.detectors, detectorFactoryCollection, userPrefs);
			}
		}

		final SortedBugCollection bugCollection = new SortedBugCollection(findBugsProject);

		final Reporter reporter = new Reporter(
				project,
				module,
				bugCollection,
				projectFilterSettings,
				indicator,
				_cancellingByUser,
				analyzedClassCountOffset
		);

		reporter.setPriorityThreshold(userPrefs.getUserDetectorThreshold());
		reporter.setRankThreshold(projectFilterSettings.getMinRank());

		final FindBugs2 engine = new FindBugs2();
		{
			engine.setNoClassOk(true);
			engine.setMergeSimilarWarnings(false);
			engine.setBugReporter(reporter);
			engine.setProject(findBugsProject);
			engine.setProgressCallback(reporter);
			configureFilter(engine, userPrefs);
			engine.setDetectorFactoryCollection(detectorFactoryCollection);
			engine.setUserPreferences(userPrefs);
		}

		try {
			engine.execute();
		} finally {
			engine.dispose();
		}

		bugCollection.setTimestamp(System.currentTimeMillis());

		return Pair.create(bugCollection, reporter);
	}