@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.setProgressCallback(mock(FindBugsProgress.class)); engine.setDetectorFactoryCollection(DetectorFactoryCollection.instance());
/** * 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.setDetectorFactoryCollection(DetectorFactoryCollection.instance()); engine.setAnalysisFeatureSettings(FindBugs.DEFAULT_EFFORT);
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; }
reporter.setPriorityThreshold(Detector.LOW_PRIORITY); findbugs.setBugReporter(reporter); findbugs.setDetectorFactoryCollection( DetectorFactoryCollection.instance() );
reporter.setPriorityThreshold(Detector.LOW_PRIORITY); findbugs.setBugReporter(reporter); findbugs.setDetectorFactoryCollection( DetectorFactoryCollection.instance() );