public DetectorFactoryCollection() { this(true, false, Plugin.getAllPlugins(), new ArrayList<Plugin>()); }
/** * Enable or disable all known Detectors. * * @param enable * true if all detectors should be enabled, false if they should * all be disabled */ public void enableAllDetectors(boolean enable) { detectorEnablementMap.clear(); Collection<Plugin> allPlugins = Plugin.getAllPlugins(); for (Plugin plugin : allPlugins) { for (DetectorFactory factory : plugin.getDetectorFactories()) { detectorEnablementMap.put(factory.getShortName(), enable); } } }
public static synchronized Set<URI> getAllPluginsURIs() { Collection<Plugin> plugins = getAllPlugins(); Set<URI> uris = new HashSet<>(); for (Plugin plugin : plugins) { try { URI uri = plugin.getPluginLoader().getURL().toURI(); uris.add(uri); } catch (URISyntaxException e) { AnalysisContext.logError("Unable to get URI", e); } } return uris; }
public static void main(String[] args) { System.out.println("SpotBugs version " + Version.VERSION_STRING + ", " + Version.WEBSITE); DetectorFactoryCollection.instance(); System.out.println("Command line options"); TreeSet<FindBugsMain> cmds = new TreeSet<>(); for(Plugin p : Plugin.getAllPlugins()) { for(FindBugsMain m : p.getAllFindBugsMain()) { cmds.add(m); } } for(FindBugsMain m : cmds) { System.out.printf("fb %-12s %-12s %s%n", m.cmd, m.kind, m.description); } // System.out.println(); // System.out.println("GUI Options:"); // FindBugsCommandLine guiCmd = new FindBugsCommandLine(true) { // }; // guiCmd.printUsage(System.out); // System.out.println(); // System.out.println("TextUI Options:"); // FindBugs.showCommandLineOptions(); System.out.println(); showGeneralOptions(); }
private static int findRankUnknownPlugin(BugPattern pattern) { List<BugRanker> rankers = new ArrayList<>(); pluginLoop: for (Plugin plugin : Plugin.getAllPlugins()) { if (plugin.isCorePlugin()) { continue; } if (false) { rankers.add(plugin.getBugRanker()); continue pluginLoop; } for (DetectorFactory df : plugin.getDetectorFactories()) { if (df.getReportedBugPatterns().contains(pattern)) { if (PLUGIN_DEBUG) { System.out.println("Bug rank match " + plugin + " " + df + " for " + pattern); } rankers.add(plugin.getBugRanker()); continue pluginLoop; } } if (PLUGIN_DEBUG) { System.out.println("plugin " + plugin + " doesn't match " + pattern); } } rankers.add(getCoreRanker()); return rankBugPattern(pattern, rankers.toArray(new BugRanker[rankers.size()])); }
public static void main(String args[]) throws Throwable { String cmd; String a[]; if (args.length == 0) { cmd = "help"; a = new String[0]; } else { cmd = args[0]; a = new String[args.length - 1]; for (int i = 1; i < args.length; i++) { a[i - 1] = args[i]; } } DetectorFactoryCollection.instance(); for (Plugin plugin : Plugin.getAllPlugins()) { FindBugsMain main = plugin.getFindBugsMain(cmd); if (main != null) { try { main.invoke(a); } catch (java.lang.reflect.InvocationTargetException e) { throw e.getCause(); } return; } } throw new IllegalArgumentException("Unable to find FindBugs main for " + cmd); }
} else if ("-plugins".equals(arg)) { DetectorFactoryCollection.instance(); for(Plugin p : Plugin.getAllPlugins()) { LOG.info("Plugin: {}", p.getPluginId()); LOG.info(" description: {}", p.getShortDescription());
if (Plugin.getAllPlugins().size() > 1 && JavaWebStart.isRunningViaJavaWebstart()) {
return; for (Plugin plugin : Plugin.getAllPlugins()) { LOG.info("Plugin {}, version {}, loaded from {}", plugin.getPluginId(), plugin.getVersion(), plugin.getPluginLoader().getURL());
protected DetectorFactoryCollection() { this(true, false, Plugin.getAllPlugins(), new ArrayList<Plugin>()); }
/** * Disable the update check for every plugin. See http://findbugs.sourceforge.net/updateChecking.html */ private static void disableUpdateChecksOnEveryPlugin() { for (Plugin plugin : Plugin.getAllPlugins()) { plugin.setMyGlobalOption("noUpdateChecks", "true"); } }
/** * Enable or disable all known Detectors. * * @param enable * true if all detectors should be enabled, false if they should * all be disabled */ public void enableAllDetectors(boolean enable) { detectorEnablementMap.clear(); Collection<Plugin> allPlugins = Plugin.getAllPlugins(); for (Plugin plugin : allPlugins) { for (DetectorFactory factory : plugin.getDetectorFactories()) { detectorEnablementMap.put(factory.getShortName(), enable); } } }
public static synchronized Set<URI> getAllPluginsURIs() { Collection<Plugin> plugins = getAllPlugins(); Set<URI> uris = new HashSet<URI>(); for (Plugin plugin : plugins) { try { URI uri = plugin.getPluginLoader().getURL().toURI(); uris.add(uri); } catch (URISyntaxException e) { AnalysisContext.logError("Unable to get URI", e); } } return uris; }
public static void main(String[] args) { System.out.println("FindBugs version " + Version.RELEASE + ", " + Version.WEBSITE); DetectorFactoryCollection.instance(); System.out.println("Command line options"); TreeSet<FindBugsMain> cmds = new TreeSet<FindBugsMain>(); for(Plugin p : Plugin.getAllPlugins()) { for(FindBugsMain m : p.getAllFindBugsMain()) { cmds.add(m); } } for(FindBugsMain m : cmds) { System.out.printf("fb %-12s %-12s %s%n", m.cmd, m.kind, m.description); } // System.out.println(); // System.out.println("GUI Options:"); // FindBugsCommandLine guiCmd = new FindBugsCommandLine(true) { // }; // guiCmd.printUsage(System.out); // System.out.println(); // System.out.println("TextUI Options:"); // FindBugs.showCommandLineOptions(); System.out.println(); showGeneralOptions(); }
public static void main(String args[]) throws Throwable { String cmd; String a[]; if (args.length == 0) { cmd = "help"; a = new String[0]; } else { cmd = args[0]; a = new String[args.length - 1]; for (int i = 1; i < args.length; i++) { a[i - 1] = args[i]; } } DetectorFactoryCollection.instance(); for (Plugin plugin : Plugin.getAllPlugins()) { FindBugsMain main = plugin.getFindBugsMain(cmd); if (main != null) { try { main.invoke(a); } catch (java.lang.reflect.InvocationTargetException e) { throw e.getCause(); } return; } } throw new IllegalArgumentException("Unable to find FindBugs main for " + cmd); }
private static int findRankUnknownPlugin(BugPattern pattern) { List<BugRanker> rankers = new ArrayList<BugRanker>(); pluginLoop: for (Plugin plugin : Plugin.getAllPlugins()) { if (plugin.isCorePlugin()) { continue; } if (false) { rankers.add(plugin.getBugRanker()); continue pluginLoop; } for (DetectorFactory df : plugin.getDetectorFactories()) { if (df.getReportedBugPatterns().contains(pattern)) { if (PLUGIN_DEBUG) { System.out.println("Bug rank match " + plugin + " " + df + " for " + pattern); } rankers.add(plugin.getBugRanker()); continue pluginLoop; } } if (PLUGIN_DEBUG) { System.out.println("plugin " + plugin + " doesn't match " + pattern); } } rankers.add(getCoreRanker()); return rankBugPattern(pattern, rankers.toArray(new BugRanker[rankers.size()])); }
} else if ("-plugins".equals(arg)) { DetectorFactoryCollection.instance(); for(Plugin p : Plugin.getAllPlugins()) { System.out.println("Plugin: " + p.getPluginId()); System.out.println(" description: " + p.getShortDescription());
if (Plugin.getAllPlugins().size() > 1 && JavaWebStart.isRunningViaJavaWebstart()) {
pluginPanelCenter.add(new JLabel("Project Setting"), g); Collection<Plugin> plugins = Plugin.getAllPlugins(); int added = 0; for (final Plugin plugin : plugins) {
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());