Package edu.umd.cs.findbugs

Examples of edu.umd.cs.findbugs.ProjectStats


        }

        EventDispatchThreadHelper.invokeLater(new Runnable() {
          public void run() {
            _bugTreePanel.getBugTree().validate();
            final ProjectStats stats = projectStats.get();
            final int numAnalysedClasses = stats != null ? stats.getNumClasses() : 0;

            final StringBuilder message = new StringBuilder()
                .append(VersionManager.getName())
                .append(": <b>found ")
                .append(_bugTreePanel.getGroupModel().getBugCount())
View Full Code Here


          for (final Plugin plugin : Plugin.getAllPlugins()) {
            importProject.setPluginStatusTrinary(plugin.getPluginId(), !preferences.isPluginDisabled(plugin.getPluginId()));
          }
          _importBugCollection.readXML(fileToImport);

          final ProjectStats projectStats = _importBugCollection.getProjectStats();
          int bugCount = 0;
          for (final BugInstance bugInstance : _importBugCollection) {
            if (indicator.isCanceled()) {
              EventManagerImpl.getInstance().fireEvent(new BugReporterEventImpl(Operation.ANALYSIS_ABORTED, project.getName()));
              Thread.currentThread().interrupt();
              return;
            }
            final Integer bugCounter = bugCount++;
            final double fraction = bugCounter.doubleValue() / projectStats.getTotalBugs();
            indicator.setFraction(fraction);
            indicator.setText2("Importing bug '" + bugCount + "' of '" + projectStats.getTotalBugs() + "' - " + bugInstance.getMessageWithoutPrefix());
            EventManagerImpl.getInstance().fireEvent(new BugReporterEventImpl(Operation.NEW_BUG_INSTANCE, bugInstance, bugCounter, projectStats, project.getName()));
          }

          showToolWindowNotifier(project, "Imported bug collection from '" + fileToImport + "'.", MessageType.INFO);
View Full Code Here

        for (BugInstance bugInstance : from.getCollection()) {
            if (hashes == null || hashes.add(bugInstance.getInstanceHash())) {
                into.add(bugInstance);
            }
        }
        ProjectStats stats = into.getProjectStats();
        ProjectStats stats2 = from.getProjectStats();
        stats.addStats(stats2);

        Project project = into.getProject();
        Project project2 = from.getProject();
        project.add(project2);
View Full Code Here

        resultCollection.setWithMessages(commandLine.withMessages);
        if (commandLine.hashChangedSpecified) {
            origCollection.computeBugHashes();
        }
        commandLine.adjustFilter(project, resultCollection);
        ProjectStats projectStats = resultCollection.getProjectStats();
        projectStats.clearBugCounts();
        if (commandLine.classPattern != null) {
            projectStats.purgeClassesThatDontMatch(commandLine.classPattern);
        }
        sourceSearcher = new SourceSearcher(project);

        long trimToVersion = -1;
        if (commandLine.trimToVersionAsString != null) {
            Map<String, AppVersion> versions = new HashMap<String, AppVersion>();
            SortedMap<Long, AppVersion> timeStamps = new TreeMap<Long, AppVersion>();

            for (Iterator<AppVersion> i = origCollection.appVersionIterator(); i.hasNext();) {
                AppVersion v = i.next();
                versions.put(v.getReleaseName(), v);
                timeStamps.put(v.getTimestamp(), v);
            }
            // add current version to the maps
            AppVersion v = resultCollection.getCurrentAppVersion();
            versions.put(v.getReleaseName(), v);
            timeStamps.put(v.getTimestamp(), v);

            trimToVersion = edu.umd.cs.findbugs.workflow.Filter.FilterCommandLine.getVersionNum(versions, timeStamps,
                    commandLine.trimToVersionAsString, true, v.getSequenceNumber());
            if (trimToVersion < origCollection.getSequenceNumber()) {
                String name = resultCollection.getAppVersionFromSequenceNumber(trimToVersion).getReleaseName();
                long timestamp = resultCollection.getAppVersionFromSequenceNumber(trimToVersion).getTimestamp();
                resultCollection.setReleaseName(name);
                resultCollection.setTimestamp(timestamp);
                resultCollection.trimAppVersions(trimToVersion);
            }

        }

        if (commandLine.maxAgeSpecified || commandLine.notAProblemSpecified || commandLine.shouldFixSpecified) {

            Cloud cloud = origCollection.getCloud();
            SigninState signinState = cloud.getSigninState();
            if (!signinState.canDownload()) {
                disconnect(verbose, commandLine, resultCollection,  cloud.getCloudName() + " state is " + signinState
                        + "; ignoring filtering options that require cloud access");

            } else if (!cloud.waitUntilIssueDataDownloaded(20, TimeUnit.SECONDS)) {
                if (verbose) {
                    System.out.println("Waiting for cloud information required for filtering");
                }
                if (!cloud.waitUntilIssueDataDownloaded(60, TimeUnit.SECONDS)) {
                    disconnect(verbose, commandLine, resultCollection,
                            "Unable to connect to cloud; ignoring filtering options that require cloud access");
                }
            }
        }

        commandLine.getReady(origCollection);

        for (BugInstance bug : origCollection.getCollection()) {
            if (commandLine.accept(origCollection, bug)) {
                if (trimToVersion >= 0) {
                    if (bug.getFirstVersion() > trimToVersion) {
                        dropped++;
                        continue;
                    } else if (bug.getLastVersion() >= trimToVersion) {
                        bug.setLastVersion(-1);
                        bug.setRemovedByChangeOfPersistingClass(false);
                    }
                }
                resultCollection.add(bug, false);
                passed++;
            } else {
                dropped++;
            }
        }

        if (commandLine.purgeHistorySpecified && commandLine.purgeHistory) {
            resultCollection.clearAppVersions();
            for (BugInstance bug : resultCollection.getCollection()) {
                bug.clearHistory();
            }


        }
        if (verbose) {
            System.out.println(passed + " warnings passed through, " + dropped + " warnings dropped");
        }
        if (commandLine.withSourceSpecified && commandLine.withSource && !commandLine.dontUpdateStats
                && projectStats.hasClassStats()) {
            for (PackageStats stats : projectStats.getPackageStats()) {
                Iterator<ClassStats> i = stats.getClassStats().iterator();
                while (i.hasNext()) {
                    String className = i.next().getName();
                    if (sourceSearcher.sourceNotFound.contains(className) || !sourceSearcher.sourceFound.contains(className)
                            && !sourceSearcher.findSource(SourceLineAnnotation.createReallyUnknown(className))) {
                        i.remove();
                    }
                }
            }

        }
        projectStats.recomputeFromComponents();
        if (argCount == args.length) {
            assert !verbose;
            resultCollection.writeXML(System.out);
        } else {
            resultCollection.writeXML(args[argCount++]);
View Full Code Here

    }

    public void report(PrintWriter out) {
        TreeMap<BugRankCategory, Stats> stats = new TreeMap<BugRankCategory, Stats>();
        ProjectStats projectStats = bugCollection.getProjectStats();
        Collection<BugInstance> bugs = bugCollection.getCollection();
        Cloud cloud = bugCollection.getCloud();
        cloud.setMode(Cloud.Mode.COMMUNAL);

        out.printf("Cloud sync and summary report for %s%n", bugCollection.getProject().getProjectName());

        out.printf("Code dated %s%n", new Date(bugCollection.getTimestamp()));
        out.printf("Code analyzed %s%n", new Date(bugCollection.getAnalysisTimestamp()));

        out.printf("%7d total classes%n", projectStats.getNumClasses());
        out.printf("%7d total issues%n", bugs.size());
        long recentTimestamp = System.currentTimeMillis() - options.ageInHours * 3600 * 1000L;
        int allRecentIssues = 0;

        for (BugInstance b : bugs) {
View Full Code Here

            origCollection.readXML(System.in);
        } else {
            origCollection.readXML(fileName);
        }
        AppVersion appVersion = origCollection.getCurrentAppVersion();
        ProjectStats stats = origCollection.getProjectStats();
        out.print(appVersion.getReleaseName());
        out.print('\t');
        if (formatDates) {
            out.print("\"" + new Date(appVersion.getTimestamp()) + "\"");
        } else {
            out.print(appVersion.getTimestamp());
        }
        out.print('\t');

        out.print(appVersion.getNumClasses());
        out.print('\t');
        out.print(appVersion.getCodeSize());
        out.print('\t');
        out.print(origCollection.getErrors().size());
        out.print('\t');
        out.print(stats.getTotalBugs());
        out.print('\t');
        out.print(stats.getBugsOfPriority(Priorities.HIGH_PRIORITY));
        out.print('\t');
        out.print(stats.getBugsOfPriority(Priorities.NORMAL_PRIORITY));
        out.print('\t');
        out.print(stats.getBugsOfPriority(Priorities.LOW_PRIORITY));
        if (fileName != null) {
            out.print('\t');
            out.print(fileName);
        }
View Full Code Here

        for (Iterator<BugInstance> i = newCollection.iterator(); i.hasNext();) {
            BugInstance bugInstance = i.next();
            result.add(bugInstance);
        }
        ProjectStats stats = result.getProjectStats();
        ProjectStats stats2 = newCollection.getProjectStats();
        stats.addStats(stats2);

        Project project = result.getProject();
        project.add(newCollection.getProject());
View Full Code Here

        I18N i18n = I18N.instance();

        int packageCount = 0;
        int classCount = 0;
        int ncss = 0;
        ProjectStats projectStats = bugCollection.getProjectStats();
        for (PackageStats ps : projectStats.getPackageStats()) {
            int num = ps.getNumClasses();
            if (ClassName.matchedPrefixes(packagePrefixes, ps.getPackageName()) && num > 0) {
                packageCount++;
                ncss += ps.size();
                classCount += num;
View Full Code Here

        if (argCount == args.length) {
            origCollection.readXML(System.in);
        } else {
            origCollection.readXML(args[argCount]);
        }
        ProjectStats stats = origCollection.getProjectStats();
        printRow("kind", "name", "density/KNCSS", "bugs", "NCSS");
        double projectDensity = density(stats.getTotalBugs(), stats.getCodeSize());
        printRow("project", origCollection.getCurrentAppVersion().getReleaseName(), projectDensity, stats.getTotalBugs(),
                stats.getCodeSize());
        for (PackageStats p : stats.getPackageStats()) {
            if (p.getTotalBugs() > 4) {

                double packageDensity = density(p.getTotalBugs(), p.size());
                if (Double.isNaN(packageDensity) || packageDensity < projectDensity) {
                    continue;
View Full Code Here

    private CloudPlugin plugin;

    @Override
    public void setUp() {
        projectStats = new ProjectStats();
        bugCollection = new SortedBugCollection(projectStats);
        plugin = new CloudPluginBuilder().setCloudid("myAbstractCloud").setClassLoader(this.getClass().getClassLoader())
                .setCloudClass(MyAbstractCloud.class).setUsernameClass(NoNameLookup.class).setProperties(new PropertyBundle())
                .setDescription("no description").setDetails("no details").createCloudPlugin();
        cloud = new MyAbstractCloud(plugin, bugCollection, new Properties());
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.ProjectStats

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.