Clear bug counts
428230
public void clearBugCounts() {
        for (int i = 0; i < totalErrors.length; i++) {
            totalErrors[i] = 0;
        }
        for (PackageStats stats : packageStatsMap.values()) {
            stats.clearBugCounts();
        }
    }
1290732
def google_nest_count(self, style):
        """"""
        nest_count = 0
        if 'margin-left' in style:
            nest_count = int(style['margin-left'][:-2]) / self.google_list_indent
        return nest_count
397834
private void reportBugs() {
        Iterator<Map.Entry<Integer, Map<JavaClass, List<MethodInfo>>>> it = parameterDefiners.entrySet().iterator();
        while (it.hasNext()) {
            try {
                Map.Entry<Integer, Map<JavaClass, List<MethodInfo>>> entry = it.next();

                Integer reg = entry.getKey();
                if (!usedParameters.get(reg.intValue())) {
                    it.remove();
                    continue;
                }
                Map<JavaClass, List<MethodInfo>> definers = entry.getValue();
                definers.remove(objectClass);
                if (definers.size() > 1) {
                    removeInheritedInterfaces(definers);
                }

                if ((definers.size() == 1) && !hasOverloadedMethod()) {

                    String name = "";
                    LocalVariableTable lvt = getMethod().getLocalVariableTable();
                    if (lvt != null) {
                        LocalVariable lv = lvt.getLocalVariable(reg.intValue(), 0);
                        if (lv != null) {
                            name = lv.getName();
                        }
                    }
                    int parm = reg.intValue();
                    if (!methodIsStatic) {
                        parm--;
                    }

                    parm++; // users expect 1 based parameters

                    String infName = definers.keySet().iterator().next().getClassName();
                    bugReporter.reportBug(
                            new BugInstance(this, BugType.OCP_OVERLY_CONCRETE_PARAMETER.name(), NORMAL_PRIORITY)
                                    .addClass(this).addMethod(this).addSourceLine(this, 0)
                                    .addString(getCardinality(parm) + " parameter '" + name + "' could be declared as "
                                            + infName + " instead"));
                }
            } catch (ClassNotFoundException e) {
                bugReporter.reportMissingClass(e);
            }
        }
    }
146430
@Override
    public void sawOpcode(int seen) {
        int pc = 0;
        try {
            stack.precomputation(this);

            switch (state) {
                case SAW_NOTHING:
                    pc = sawOpcodeAfterNothing(seen);
                break;

                case SAW_CTOR:
                    if ((seen == Const.POP) || (seen == Const.RETURN)) {
                        bugReporter.reportBug(new BugInstance(this, BugType.SEC_SIDE_EFFECT_CONSTRUCTOR.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                                .addSourceLine(this));
                    }
                    state = State.SAW_NOTHING;
                break;
            }
        } finally {
            TernaryPatcher.pre(stack, seen);
            stack.sawOpcode(this, seen);
            TernaryPatcher.post(stack, seen);
            if ((pc != 0) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                item.setUserValue(Integer.valueOf(pc));
            }
        }
    }
1269451
def get_alt_date_bug_totals(self, startday, endday, bug_ids):
        """"""
        bugs = (BugJobMap.failures.by_date(startday, endday)
                                  .filter(bug_id__in=bug_ids)
                                  .values('bug_id')
                                  .annotate(total=Count('id'))
                                  .values('bug_id', 'total'))

        return {bug['bug_id']: bug['total'] for bug in bugs if bug['total'] >= 150}
1141958
public void incrementCounter(BugChecker bugChecker, String key, int count) {
    statisticsCollector.incrementCounter(statsKey(bugChecker.canonicalName() + "-" + key), count);
  }
866297
def count_changes(change):
    """"""
    if isinstance(change, ChangeSet):
        result = 0
        for child in change.changes:
            result += count_changes(child)
        return result
    return 1
1227011
def getbugfields(self, force_refresh=False):
        
        if force_refresh or not self._cache.bugfields:
            log.debug("Refreshing bugfields")
            self._cache.bugfields = self._getbugfields()
            self._cache.bugfields.sort()
            log.debug("bugfields = %s", self._cache.bugfields)

        return self._cache.bugfields
422711
@Override
    public void visitCode(Code obj) {
        stack.resetForMethodEntry(this);
        nodeCreations.clear();
        nodeStores.clear();
        super.visitCode(obj);

        BitSet reportedPCs = new BitSet();
        for (Integer pc : nodeCreations.values()) {
            if (!reportedPCs.get(pc.intValue())) {
                bugReporter.reportBug(new BugInstance(this, BugType.ODN_ORPHANED_DOM_NODE.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                        .addSourceLine(this, pc.intValue()));
                reportedPCs.set(pc.intValue());
            }
        }
        for (Integer pc : nodeStores.values()) {
            if (!reportedPCs.get(pc.intValue())) {
                bugReporter.reportBug(new BugInstance(this, BugType.ODN_ORPHANED_DOM_NODE.name(), NORMAL_PRIORITY).addClass(this).addMethod(this)
                        .addSourceLine(this, pc.intValue()));
                reportedPCs.set(pc.intValue());
            }
        }
    }
1052753
def fetch_all_bug_details(self, bug_ids):
        """"""
        min = 0
        max = 600
        bugs_list = []
        bug_ids_length = len(bug_ids)

        while bug_ids_length >= min and bug_ids_length > 0:
            data = self.fetch_bug_details(bug_ids[min:max])
            if data:
                bugs_list += data
            min = max
            max = max + 600

        return {bug['id']: bug for bug in bugs_list} if len(bugs_list) else None
393463
private void reportBugs() {
		int major = getClassContext().getJavaClass().getMajor();
		for (Map.Entry<String, FieldInfo> entry : fieldsReported.entrySet()) {
			String field = entry.getKey();
			FieldInfo fi = entry.getValue();
			int cnt = fi.getSetCount();
			if (cnt > 0) {
				FieldAnnotation fa = getFieldAnnotation(field);
				if (fa != null) {
					// can't use LinkedHashSet in 1.3 so report at LOW
					bugReporter.reportBug(new BugInstance(this, BugType.DLC_DUBIOUS_LIST_COLLECTION.name(),
							(major >= Const.MAJOR_1_4) ? NORMAL_PRIORITY : LOW_PRIORITY)
									.addSourceLine(fi.getSourceLineAnnotation()));
				}
			}
		}
	}
739142
def pkg_tracking(self):
        
        flag = []
        options = [
            "-t",
            "--tracking"
        ]
        additional_options = [
            "--check-deps",
            "--graph=",
            "--case-ins"
        ]
        for arg in self.args[2:]:
            if arg.startswith(additional_options[1]):
                flag.append(arg)
                self.args.remove(arg)
            if arg in additional_options:
                flag.append(arg)
        # clean additional options from args
        for f in flag:
            if f in self.args:
                self.args.remove(f)
        # print usage message if wrong additional option
        for arg in self.args:
            if arg.startswith("--"):
                if arg not in additional_options:
                    usage("")
                    raise SystemExit()
        if (len(self.args) >= 3 and len(self.args) <= 3 and
                self.args[0] in options and
                self.args[1] in self.meta.repositories):
            TrackingDeps(self.args[2], self.args[1], flag).run()
        elif (len(self.args) >= 2 and
                self.args[1] not in self.meta.repositories):
            usage(self.args[1])
        else:
            usage("")
719718
def check(self, final_line_count):
        """"""
        if self._lines_seen["version"]:
            self._process_version_lines()
        self._process_plan_lines(final_line_count)
718606
public static void saveCurrentBugCollection(IProject project, IProgressMonitor monitor) throws CoreException {
        if (isBugCollectionDirty(project)) {
            SortedBugCollection bugCollection = (SortedBugCollection) project.getSessionProperty(SESSION_PROPERTY_BUG_COLLECTION);

            if (bugCollection != null) {
                writeBugCollection(project, bugCollection, monitor);
            }
        }
    }
1161273
def _getbugs(self, idlist, permissive,
            include_fields=None, exclude_fields=None, extra_fields=None):
        
        oldidlist = idlist
        idlist = []
        for i in oldidlist:
            try:
                idlist.append(int(i))
            except ValueError:
                # String aliases can be passed as well
                idlist.append(i)

        extra_fields = self._listify(extra_fields or [])
        extra_fields += self._getbug_extra_fields

        getbugdata = {"ids": idlist}
        if permissive:
            getbugdata["permissive"] = 1

        getbugdata.update(self._process_include_fields(
            include_fields, exclude_fields, extra_fields))

        r = self._proxy.Bug.get(getbugdata)

        if self._check_version(4, 0):
            bugdict = dict([(b['id'], b) for b in r['bugs']])
        else:
            bugdict = dict([(b['id'], b['internals']) for b in r['bugs']])

        ret = []
        for i in idlist:
            found = None
            if i in bugdict:
                found = bugdict[i]
            else:
                # Need to map an alias
                for valdict in bugdict.values():
                    if i in self._listify(valdict.get("alias", None)):
                        found = valdict
                        break

            ret.append(found)

        return ret
282174
private void updateCounter() {

        m_counter.replaceData(
            Collections.singletonMap(
                CmsVaadinUtils.getMessageText(Messages.GUI_MODULES_STATISTICS_ROW_COUNT_0),
                String.valueOf(getContainerDataSource().size())));
    }
93280
@Override
    public void report() {
        for (Map.Entry<FQMethod, MethodInfo> entry : Statistics.getStatistics()) {
            MethodInfo mi = entry.getValue();

            int declaredAccess = mi.getDeclaredAccess();
            if ((declaredAccess & Const.ACC_PRIVATE) != 0) {
                continue;
            }

            if (mi.wasCalledPublicly() || !mi.wasCalled()) {
                continue;
            }

            FQMethod key = entry.getKey();

            String methodName = key.getMethodName();
            if (isGetterSetter(methodName, key.getSignature())) {
                continue;
            }

            if (isOverlyPermissive(declaredAccess) && !isConstrainedByInterface(key)) {
                try {
                    String clsName = key.getClassName();
                    if (!isDerived(Repository.lookupClass(clsName), key)) {

                        BugInstance bi = new BugInstance(this, BugType.OPM_OVERLY_PERMISSIVE_METHOD.name(), LOW_PRIORITY).addClass(clsName).addMethod(clsName,
                                key.getMethodName(), key.getSignature(), (declaredAccess & Const.ACC_STATIC) != 0);

                        String descr = String.format("- Method declared %s but could be declared %s", getDeclaredAccessValue(declaredAccess),
                                getRequiredAccessValue(mi));
                        bi.addString(descr);

                        bugReporter.reportBug(bi);
                    }
                } catch (ClassNotFoundException cnfe) {
                    bugReporter.reportMissingClass(cnfe);
                }
            }
        }
    }