当前位置: 首页>>代码示例>>Java>>正文


Java UserPreferences.createDefaultUserPreferences方法代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.config.UserPreferences.createDefaultUserPreferences方法的典型用法代码示例。如果您正苦于以下问题:Java UserPreferences.createDefaultUserPreferences方法的具体用法?Java UserPreferences.createDefaultUserPreferences怎么用?Java UserPreferences.createDefaultUserPreferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.umd.cs.findbugs.config.UserPreferences的用法示例。


在下文中一共展示了UserPreferences.createDefaultUserPreferences方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDefaultUserPreferences

import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
public static UserPreferences createDefaultUserPreferences() {
    UserPreferences prefs = UserPreferences.createDefaultUserPreferences();
    IPreferenceStore store = FindbugsPlugin.getDefault().getPreferenceStore();
    String categoriesStr = store.getString(DISABLED_CATEGORIES);
    Set<String> ids = decodeIds(categoriesStr);
    for (String categoryId : ids) {
        prefs.getFilterSettings().removeCategory(categoryId);
    }
    prefs.setRunAtFullBuild(false);

    // Do not need, as per default the factory default is used if key is
    // missing
    // TODO later we can use custom workspace settings to disable detectors
    // here
    // Iterator<DetectorFactory> iterator =
    // DetectorFactoryCollection.instance().factoryIterator();
    // while (iterator.hasNext()) {
    // DetectorFactory factory = iterator.next();
    // prefs.enableDetector(factory, factory.isDefaultEnabled());
    // }
    return prefs;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:23,代码来源:FindBugsPreferenceInitializer.java

示例2: Project

import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
 * Create an anonymous project.
 */
public Project() {
    enabledPlugins = new HashMap<String,Boolean>();
    configuration = UserPreferences.createDefaultUserPreferences();
    analysisTargets = new LinkedList<String>();
    srcDirList = new LinkedList<String>();
    auxClasspathEntryList = new LinkedList<String>();
    isModified = false;
    currentWorkingDirectoryList = new ArrayList<File>();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:13,代码来源:Project.java

示例3: setUpEngine

import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
 * Sets up a FB engine to run on the 'findbugsTestCases' project. It enables
 * all the available detectors and reports all the bug categories. Uses a
 * normal priority threshold.
 */
private void setUpEngine(String... analyzeMe) throws IOException {
    this.engine = new FindBugs2();
    Project project = new Project();
    project.setProjectName("findbugsTestCases");
    this.engine.setProject(project);

    DetectorFactoryCollection detectorFactoryCollection = DetectorFactoryCollection.instance();
    engine.setDetectorFactoryCollection(detectorFactoryCollection);

    bugReporter = new BugCollectionBugReporter(project);
    bugReporter.setPriorityThreshold(Priorities.LOW_PRIORITY);

    engine.setBugReporter(this.bugReporter);
    UserPreferences preferences = UserPreferences.createDefaultUserPreferences();
    DetectorFactory checkExpectedWarnings = detectorFactoryCollection.getFactory("CheckExpectedWarnings");
    preferences.enableDetector(checkExpectedWarnings, true);
    preferences.getFilterSettings().clearAllCategories();
    this.engine.setUserPreferences(preferences);

    for (String s : analyzeMe)
        project.addFile(getFindbugsTestCasesFile(s).getPath());

    project.addAuxClasspathEntry("lib/junit.jar");
    File lib = getFindbugsTestCasesFile("lib");
     for(File f : lib.listFiles()) {
         String path = f.getPath();
         if (f.canRead() && path.endsWith(".jar"))
             project.addAuxClasspathEntry(path);
     }

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:37,代码来源:DetectorsTest.java

示例4: createUserPreferences

import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
private UserPreferences createUserPreferences() {
    UserPreferences userPreferences = UserPreferences.createDefaultUserPreferences();
    String includeFilterFilename = getIncludeFilterFilename();
    if (StringUtils.isNotBlank(includeFilterFilename)) {
        userPreferences.getIncludeFilterFiles().put(includeFilterFilename, true);
    }
    String excludeFilterFilename = getExcludeFilterFilename();
    if (StringUtils.isNotBlank(excludeFilterFilename)) {
        userPreferences.getExcludeFilterFiles().put(excludeFilterFilename, true);
    }
    return userPreferences;
}
 
开发者ID:TouK,项目名称:sputnik,代码行数:13,代码来源:FindBugsProcessor.java

示例5: analyze

import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
/**
 * Launch an analysis on the given source files.
 *
 * @param classFiles
 * @param classPaths
 * @param bugReporter
 * @throws java.io.IOException
 * @throws InterruptedException
 * @throws edu.umd.cs.findbugs.PluginException
 * @throws URISyntaxException
 *
 */
public void analyze(String[] classFiles, String[] classPaths, BugReporter bugReporter) throws IOException, InterruptedException,
		PluginException, NoSuchFieldException, IllegalAccessException, URISyntaxException {
    Project project = new Project();
    project.setProjectName("automate-test-project");
    for (String file : classFiles) {
        project.addFile(file);
    }

    // Add classpath list to project's auxclasspath
    for (String classpath : classPaths) {
    	project.addAuxClasspathEntry(classpath);
    }

    if (loadedPlugin == null) {
        //Initialize the plugin base on the findbugs.xml
        byte[] archive = buildFakePluginJar();

        File f = new File(System.getProperty("java.io.tmpdir"), "plugin.jar");
        log.info("Writing " + f.getCanonicalPath());
        f.deleteOnExit();
        FileOutputStream out = new FileOutputStream(f);
        out.write(archive);
        out.close();

        loadedPlugin = Plugin.loadCustomPlugin(f.toURI().toURL(), project);
    }

    //FindBugs engine
    FindBugs2 engine = new FindBugs2();
    engine.setNoClassOk(true);
    engine.setMergeSimilarWarnings(false);
    engine.setBugReporter(bugReporter);
    engine.setProject(project);
    engine.setProgressCallback(mock(FindBugsProgress.class));

    engine.setDetectorFactoryCollection(DetectorFactoryCollection.instance());

    //User preferences set to miss no bugs report
    UserPreferences prefs = UserPreferences.createDefaultUserPreferences();

    ProjectFilterSettings filter = prefs.getFilterSettings();
    filter.setMinRank(20);
    filter.setDisplayFalseWarnings(true);
    filter.setMinPriority("Low");

    engine.setUserPreferences(prefs);

    log.info("Analyzing... {}", classFiles);
    engine.execute();
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:63,代码来源:FindBugsLauncher.java

示例6: execute

import edu.umd.cs.findbugs.config.UserPreferences; //导入方法依赖的package包/类
public Map<String, List<ReportedBug>> execute() throws IOException, InterruptedException, IllegalStateException {
	FindBugs2 findBugs = new FindBugs2();
	Project project = getProject();

	findBugs.setProject(project);

	XMLBugReporter reporter = new XMLBugReporter(project);
	reporter.setPriorityThreshold(bugPriority);
	reporter.setAddMessages(true);
	reporter.setUseLongBugCodes(true);

	findBugs.setBugReporter(reporter);

	UserPreferences userPrefs = UserPreferences.createDefaultUserPreferences();
	userPrefs.setEffort(userPrefsEffort);
	findBugs.setUserPreferences(userPrefs);

	findBugs.setDetectorFactoryCollection(DetectorFactoryCollection.instance());
	findBugs.setAnalysisFeatureSettings(effort);
	findBugs.finishSettings();

	findBugs.execute();

	Map<String, List<ReportedBug>> reportedBugs = new HashMap<String, List<ReportedBug>>();
	for (BugInstance b : reporter.getBugCollection()) {
		String filename = b.getPrimarySourceLineAnnotation().getSourcePath();

		if (!reportedBugs.containsKey(filename)) {
			reportedBugs.put(filename, new ArrayList<ReportedBug>());
		}

		ReportedBug rb = new ReportedBug(b.getBugRank(), b.getBugRankCategory().toString(), b.getPriority(),
				b.getPriorityString(), b.getType(), b.getAbbrev(), b.getBugPattern().getDetailPlainText(),
				b.getBugPattern().getCategory(), b.getPrimaryClass().getClassName(), b.getAbridgedMessage(),
				b.getMessage());

		if (b.getPrimaryMethod() != null) {
			String methodName = b.getPrimaryMethod().getFullMethod(b.getPrimaryClass());
			rb.setMethod(methodName.substring(methodName.lastIndexOf(".") + 1));
		}

		if (b.getPrimaryField() != null) {
			rb.setField(b.getPrimaryField().getFieldName());
		}

		if (b.getPrimaryLocalVariableAnnotation() != null) {
			rb.setLocalVariable(b.getPrimaryLocalVariableAnnotation().getName());
		}

		reportedBugs.get(filename).add(rb);
	}

	findBugs.dispose();
	return reportedBugs;
}
 
开发者ID:visminer,项目名称:repositoryminer,代码行数:56,代码来源:FindBugsExecutor.java


注:本文中的edu.umd.cs.findbugs.config.UserPreferences.createDefaultUserPreferences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。