@Override public Profiler getProfiler() { return bugReporter.getProjectStats().getProfiler(); } }
/** * Constructor. Creates an empty object. */ public SortedBugCollection() { this(new ProjectStats()); }
@Override public boolean add(BugInstance bugInstance, boolean updateActiveTime) { if (bugsPopulated) { AnalysisContext.logError("Bug collection marked as populated, but bugs added", new RuntimeException("Bug collection marked as populated, but bugs added")); bugsPopulated = false; } preciseHashOccurrenceNumbersAvailable = false; if (updateActiveTime) { bugInstance.setFirstVersion(sequence); } invalidateHashes(); if (!bugInstance.isDead()) { projectStats.addBug(bugInstance); } return bugSet.add(bugInstance); }
@Override public SortedBugCollection createEmptyCollectionWithMetadata() { SortedBugCollection dup = new SortedBugCollection(projectStats.clone(), comparator, project); dup.projectStats.clearBugCounts(); dup.errorList.addAll(this.errorList); dup.missingClassSet.addAll(this.missingClassSet); dup.summaryHTML = this.summaryHTML; dup.classFeatureSetMap.putAll(this.classFeatureSetMap); dup.sequence = this.sequence; dup.analysisVersion = this.analysisVersion; dup.analysisTimestamp = this.analysisTimestamp; dup.timestamp = this.timestamp; dup.releaseName = this.releaseName; for (AppVersion appVersion : appVersionList) { dup.appVersionList.add((AppVersion) appVersion.clone()); } return dup; }
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');
String totalClasses = getOptionalAttribute(attributes, "total_classes"); if (totalClasses != null && totalClasses.length() > 0) { bugCollection.getProjectStats().setTotalClasses(Integer.parseInt(totalClasses)); bugCollection.getProjectStats().setTotalSize(Integer.parseInt(totalSize)); bugCollection.getProjectStats().setReferencedClasses(Integer.parseInt(referencedClasses)); bugCollection.getProjectStats().setVMVersion(vmVersion); try { bugCollection.getProjectStats().setTimestamp(timestamp); } catch (java.text.ParseException e) { throw new SAXException("Unparseable sequence number: '" + timestamp + "'", e); int numClasses = Integer.parseInt(getRequiredAttribute(attributes, "total_types", qName)); int size = Integer.parseInt(getRequiredAttribute(attributes, "total_size", qName)); bugCollection.getProjectStats().putPackageStats(packageName, numClasses, size); int size = Integer.parseInt(getRequiredAttribute(attributes, "size", qName)); String sourceFile = getOptionalAttribute(attributes, "sourceFile"); bugCollection.getProjectStats().addClass(className, sourceFile, isInterface, size, false);
projectStats.clearBugCounts(); if (commandLine.classPattern != null) { projectStats.purgeClassesThatDontMatch(commandLine.classPattern); && projectStats.hasClassStats()) { for (PackageStats stats : projectStats.getPackageStats()) { Iterator<ClassStats> i = stats.getClassStats().iterator(); while (i.hasNext()) { projectStats.recomputeFromComponents(); if (argCount == args.length) { assert !verbose;
xmlOutput.addAttribute("total_classes", String.valueOf(getNumClasses())); xmlOutput.addAttribute("referenced_classes", String.valueOf(referencedClasses)); xmlOutput.addAttribute("total_size", String.valueOf(getCodeSize())); xmlOutput.addAttribute("num_packages", String.valueOf(packageStatsMap.size())); getProfiler().writeXML(xmlOutput); xmlOutput.closeTag("FindBugsSummary");
origCollectionVersionClone.setTimestamp(origCollectionVersion.getTimestamp()); origCollectionVersionClone.setReleaseName(origCollectionVersion.getReleaseName()); origCollectionVersionClone.setNumClasses(origCollection.getProjectStats().getNumClasses()); origCollectionVersionClone.setCodeSize(origCollection.getProjectStats().getCodeSize()); String sourceFile = classBugFoundIn.getSourceFileName(); boolean fixed = sourceFile != null && analyzedSourceFiles.contains(sourceFile) || newCollection.getProjectStats().getClassStats(className) != null; if (fixed) { if (!copyDeadBugs) { if (origCollection.getProjectStats().getClassStats(className) != null) { newBug.setIntroducedByChangeOfExistingClass(true);
Profiler profiler = bugReporter.getProjectStats().getProfiler(); profiler.start(this.getClass()); AnalysisContext.currentXFactory().canonicalizeAll(); bugReporter.getProjectStats().setReferencedClasses(referencedClassSet.size()); for (Iterator<AnalysisPass> passIterator = executionPlan.passIterator(); passIterator.hasNext();) { AnalysisPass pass = passIterator.next();
if (withMessages) { computeBugHashes(); getProjectStats().computeFileStats(this); String commonBase = null; for (String s : project.getSourceDirList()) { getProjectStats().writeXML(xmlOutput, withMessages);
/** * Report that a class has been analyzed. * * @param className * the full name of the class * @param sourceFile * TODO * @param isInterface * true if the class is an interface * @param size * a normalized class size value; see * detect/FindBugsSummaryStats. */ public void addClass(@DottedClassName String className, @CheckForNull String sourceFile, boolean isInterface, int size) { addClass(className, sourceFile, isInterface, size, true); }
static public void merge(HashSet<String> hashes, SortedBugCollection into, SortedBugCollection from) { 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); for(AnalysisError error : from.getErrors()) { into.addError(error); } return; }
public Map<String, String> getFileHashes(BugCollection bugs) { if (bugs.getProjectStats() != this) { throw new IllegalArgumentException("Collection doesn't own stats"); } if (fileBugHashes == null) { computeFileStats(bugs); } HashMap<String, String> result = new HashMap<>(); for (String sourceFile : fileBugHashes.getSourceFiles()) { result.put(sourceFile, fileBugHashes.getHash(sourceFile)); } return result; }
String totalClasses = getOptionalAttribute(attributes, "total_classes"); if (totalClasses != null && totalClasses.length() > 0) { bugCollection.getProjectStats().setTotalClasses(Integer.parseInt(totalClasses)); bugCollection.getProjectStats().setTotalSize(Integer.parseInt(totalSize)); bugCollection.getProjectStats().setReferencedClasses(Integer.parseInt(referencedClasses)); bugCollection.getProjectStats().setVMVersion(vmVersion); try { bugCollection.getProjectStats().setTimestamp(timestamp); } catch (java.text.ParseException e) { throw new SAXException("Unparseable sequence number: '" + timestamp + "'", e); int numClasses = Integer.parseInt(getRequiredAttribute(attributes, "total_types", qName)); int size = Integer.parseInt(getRequiredAttribute(attributes, "total_size", qName)); bugCollection.getProjectStats().putPackageStats(packageName, numClasses, size); int size = Integer.parseInt(getRequiredAttribute(attributes, "size", qName)); String sourceFile = getOptionalAttribute(attributes, "sourceFile"); bugCollection.getProjectStats().addClass(className, sourceFile, isInterface, size, false);
projectStats.clearBugCounts(); if (commandLine.classPattern != null) { projectStats.purgeClassesThatDontMatch(commandLine.classPattern); && projectStats.hasClassStats()) { for (PackageStats stats : projectStats.getPackageStats()) { Iterator<ClassStats> i = stats.getClassStats().iterator(); while (i.hasNext()) { projectStats.recomputeFromComponents(); if (argCount == args.length) { assert !verbose;
xmlOutput.addAttribute("total_classes", String.valueOf(getNumClasses())); xmlOutput.addAttribute("referenced_classes", String.valueOf(referencedClasses)); xmlOutput.addAttribute("total_size", String.valueOf(getCodeSize())); xmlOutput.addAttribute("num_packages", String.valueOf(packageStatsMap.size())); getProfiler().writeXML(xmlOutput); xmlOutput.closeTag("FindBugsSummary");
origCollectionVersionClone.setTimestamp(origCollectionVersion.getTimestamp()); origCollectionVersionClone.setReleaseName(origCollectionVersion.getReleaseName()); origCollectionVersionClone.setNumClasses(origCollection.getProjectStats().getNumClasses()); origCollectionVersionClone.setCodeSize(origCollection.getProjectStats().getCodeSize()); String sourceFile = classBugFoundIn.getSourceFileName(); boolean fixed = sourceFile != null && analyzedSourceFiles.contains(sourceFile) || newCollection.getProjectStats().getClassStats(className) != null; if (fixed) { if (!copyDeadBugs) { if (origCollection.getProjectStats().getClassStats(className) != null) { newBug.setIntroducedByChangeOfExistingClass(true);
Profiler profiler = bugReporter.getProjectStats().getProfiler(); profiler.start(this.getClass()); AnalysisContext.currentXFactory().canonicalizeAll(); bugReporter.getProjectStats().setReferencedClasses(referencedClassSet.size()); for (Iterator<AnalysisPass> passIterator = executionPlan.passIterator(); passIterator.hasNext();) { AnalysisPass pass = passIterator.next();
@Override public SortedBugCollection createEmptyCollectionWithMetadata() { SortedBugCollection dup = new SortedBugCollection(projectStats.clone(), comparator, project); dup.projectStats.clearBugCounts(); dup.errorList.addAll(this.errorList); dup.missingClassSet.addAll(this.missingClassSet); dup.summaryHTML = this.summaryHTML; dup.classFeatureSetMap.putAll(this.classFeatureSetMap); dup.sequence = this.sequence; dup.analysisVersion = this.analysisVersion; dup.analysisTimestamp = this.analysisTimestamp; dup.timestamp = this.timestamp; dup.releaseName = this.releaseName; for (AppVersion appVersion : appVersionList) { dup.appVersionList.add((AppVersion) appVersion.clone()); } return dup; }