@Nonnull public BugCollectionBugReporter run(Path... files) { DetectorFactoryCollection.resetInstance(new DetectorFactoryCollection()); try (FindBugs2 engine = new FindBugs2(); Project project = createProject(files)) { engine.setProject(project); final DetectorFactoryCollection detectorFactoryCollection = DetectorFactoryCollection.instance(); engine.setDetectorFactoryCollection(detectorFactoryCollection); BugCollectionBugReporter bugReporter = new BugCollectionBugReporter(project); bugReporter.setPriorityThreshold(Priorities.LOW_PRIORITY); bugReporter.setRankThreshold(BugRanker.VISIBLE_RANK_MAX); engine.setBugReporter(bugReporter); final UserPreferences preferences = UserPreferences.createDefaultUserPreferences(); preferences.getFilterSettings().clearAllCategories(); preferences.enableAllDetectors(true); engine.setUserPreferences(preferences); try { engine.execute(); } catch (final IOException | InterruptedException e) { throw new AssertionError("Analysis failed with exception", e); } if (!bugReporter.getQueuedErrors().isEmpty()) { bugReporter.reportQueuedErrors(); throw new AssertionError( "Analysis failed with exception. Check stderr for detail."); } return bugReporter; } }
engine.setMergeSimilarWarnings(false); engine.setBugReporter(bugReporter); engine.setProject(project); engine.setProgressCallback(mock(FindBugsProgress.class));
project.addFile(tmpdir.getAbsolutePath()); engine.setProject(project); PluginLoader fakeLoader = new PluginLoader(true, tmpfile.toURL()); Plugin fakePlugin = new Plugin("edu.umd.cs.findbugs.fakeplugin", null, null, fakeLoader, true, false);
/** * Create the IFindBugsEngine that will be used to analyze the application. * * @param p * the Project * @param pcb * the PrintCallBack * @return the IFindBugsEngine */ private static IFindBugsEngine createEngine(@Nonnull Project p, BugReporter pcb) { FindBugs2 engine = new FindBugs2(); engine.setBugReporter(pcb); engine.setProject(p); engine.setDetectorFactoryCollection(DetectorFactoryCollection.instance()); // // Honor -effort option if one was given on the command line. // engine.setAnalysisFeatureSettings(Driver.getAnalysisSettingList()); return engine; }
private FindBugs2 createFindBugs(Project project, BugCollectionBugReporter bugReporter) { final FindBugs2 findBugs = new FindBugs2(); findBugs.setProject(project); findBugs.setBugReporter(bugReporter); findBugs.setDetectorFactoryCollection(DetectorFactoryCollection.instance()); findBugs.setUserPreferences(UserPreferences.createDefaultUserPreferences()); return findBugs; }
engine.setProject(project);
private FindBugs2 createFindBugs(Project project, BugCollectionBugReporter bugReporter) { final FindBugs2 findBugs = new FindBugs2(); findBugs.setProject(project); findBugs.setBugReporter(bugReporter); findBugs.setDetectorFactoryCollection(DetectorFactoryCollection.instance()); findBugs.setUserPreferences(UserPreferences.createDefaultUserPreferences()); return findBugs; }
findbugs.setProject(project); final Collection<String> ignored = Collections2.transform( Arrays.asList(BugType.values()),
findbugs.setProject(project); final Collection<String> ignored = Collections2.transform( Arrays.asList(BugType.values()),