def bus_factor(self, by='repository', ignore_globs=None, include_globs=None):
        """
        An experimental heuristic for truck factor of a repository calculated by the current distribution of blame in
        the repository's primary branch.  The factor is the fewest number of contributors whose contributions make up at
        least 50% of the codebase's LOC

        :param ignore_globs: (optional, default=None) a list of globs to ignore, default none excludes nothing
        :param include_globs: (optinal, default=None) a list of globs to include, default of None includes everything.
        :param by: (optional, default=repository) whether to group by repository or by file
        :return:
        """

        if by == 'file':
            raise NotImplementedError('File-wise bus factor')

        blame = self.blame(include_globs=include_globs, ignore_globs=ignore_globs, by=by)
        blame = blame.sort_values(by=['loc'], ascending=False)

        total = blame['loc'].sum()
        cumulative = 0
        tc = 0
        for idx in range(blame.shape[0]):
            cumulative += blame.ix[idx, 'loc']
            tc += 1
            if cumulative >= total / 2:
                break

        return DataFrame([[self._repo_name(), tc]], columns=['repository', 'bus factor'])
def bus_factor ( self , by = 'repository' , ignore_globs = None , include_globs = None ) : if by == 'file' : raise NotImplementedError ( 'File-wise bus factor' ) blame = self . blame ( include_globs = include_globs , ignore_globs = ignore_globs , by = by ) blame = blame . sort_values ( by = [ 'loc' ] , ascending = False ) total = blame [ 'loc' ] . sum ( ) cumulative = 0 tc = 0 for idx in range ( blame . shape [ 0 ] ) : cumulative += blame . ix [ idx , 'loc' ] tc += 1 if cumulative >= total / 2 : break return DataFrame ( [ [ self . _repo_name ( ) , tc ] ] , columns = [ 'repository' , 'bus factor' ] )
An experimental heuristic for truck factor of a repository calculated by the current distribution of blame in
        the repository's primary branch.  The factor is the fewest number of contributors whose contributions make up at
        least 50% of the codebase's LOC

        :param ignore_globs: (optional, default=None) a list of globs to ignore, default none excludes nothing
        :param include_globs: (optinal, default=None) a list of globs to include, default of None includes everything.
        :param by: (optional, default=repository) whether to group by repository or by file
        :return: