/** * @param justPrintConfiguration * @throws InterruptedException */ public static void printVersion(boolean justPrintConfiguration) throws InterruptedException { System.out.println("FindBugs " + Version.COMPUTED_RELEASE); if (justPrintConfiguration) { for (Plugin plugin : Plugin.getAllPlugins()) { System.out.printf( "Plugin %s, version %s, loaded from %s%n", plugin.getPluginId(), plugin.getVersion(), plugin.getPluginLoader().getURL()); if (plugin.isCorePlugin()) System.out.println(" is core plugin"); if (plugin.isInitialPlugin()) System.out.println(" is initial plugin"); if (plugin.isEnabledByDefault()) System.out.println(" is enabled by default"); if (plugin.isGloballyEnabled()) System.out.println(" is globally enabled"); Plugin parent = plugin.getParentPlugin(); if (parent != null) { System.out.println(" has parent plugin " + parent.getPluginId()); } for (CloudPlugin cloudPlugin : plugin.getCloudPlugins()) { System.out.printf(" cloud %s%n", cloudPlugin.getId()); System.out.printf(" %s%n", cloudPlugin.getDescription()); } for (DetectorFactory factory : plugin.getDetectorFactories()) { System.out.printf(" detector %s%n", factory.getShortName()); } System.out.println(); } printPluginUpdates(true, 10); } else printPluginUpdates(false, 3); }
void unRegisterDetector(DetectorFactory factory) { if (FindBugs.DEBUG) { System.out.println("Unregistering detector: " + factory.getFullName()); } String detectorName = factory.getShortName(); factoryList.remove(factory); factoriesByName.remove(detectorName); factoriesByDetectorClassName.remove(factory.getFullName()); }
/** Register a DetectorFactory. */ void registerDetector(DetectorFactory factory) { if (FindBugs.DEBUG) { System.out.println("Registering detector: " + factory.getFullName()); } String detectorName = factory.getShortName(); if (!factoryList.contains(factory)) { factoryList.add(factory); } else { LOGGER.log( Level.WARNING, "Trying to add already registered factory: " + factory + ", " + factory.getPlugin()); } factoriesByName.put(detectorName, factory); factoriesByDetectorClassName.put(factory.getFullName(), factory); }
public boolean isDisabledByDefault(String bugPatternOrCode) { @CheckForNull BugPattern pattern = lookupBugPattern(bugPatternOrCode); if (pattern != null) { for (DetectorFactory fac : factoryList) { if (fac.isDefaultEnabled() && fac.getReportedBugPatterns().contains(pattern)) { return false; } } return true; } @CheckForNull BugCode code = lookupBugCode(bugPatternOrCode); if (code != null) { for (DetectorFactory fac : factoryList) { if (fac.isDefaultEnabled()) { for (BugPattern p : fac.getReportedBugPatterns()) { if (p.getBugCode().equals(code)) { return false; } } } } return true; } return false; }