Beispiel #1
0
    def _check_sanity(self):
        '''
        Check that the configuration makes sense.
        :raise ConfigurationError
        '''

        # Some elementary sanity checks
        for key in self.GLOBAL_KEYS:
            if self._project_conf and key in self._project_conf:
                log.critical("The key '{}' may not be overridden in the "
                        "project configuration file".format(key))
                raise ConfigurationError('Invalid configuration key.')

        for key in self.GLOBAL_KEYS + self.PROJECT_KEYS:
            if not key in self:
                log.critical("Required key '{}' missing in configuration!"
                        ''.format(key))
                raise ConfigurationError('Missing configuration key.')

        if not self['tagging'] in LinkType.get_all_link_types():
            log.critical('Unsupported tagging mechanism specified!')
            raise ConfigurationError('Unsupported tagging mechanism.')

        if len(self["revisions"]) < 2:
            log.info("No revision range specified in configuration, using auto-generated windows")

        if len(self["revisions"]) != len(self["rcs"]):
            log.critical("Malformed configuration: revision and rcs list "
                "lengths differ! Found {0} revisions and {1} release "
                "candidates.".format(len(self["revisions"]), len(self["rcs"])))
            raise ConfigurationError('Malformed configuration.')

        unknown_keys = [k for k in self if k not in self.ALL_KEYS]
        for key in unknown_keys:
            log.warning("Unknown key '{}' in configuration.".format(key))
Beispiel #2
0
def getSignoffEtcCount(cmt):
    """Similar to getSignoffCount(), but also counts CCed, Acked-by, etc."""
    signoffs = 0

    tag_names_list = cmt.getTagNames()
    for key in LinkType.get_tag_types():
        if key in tag_names_list.keys():
            signoffs += len(tag_names_list[key])

    return signoffs
Beispiel #3
0
    def addSendRelation(self, relation_type, ID, cmt, weight):
        '''
        add a one directional relation from the person instance
        (ie. self) and the person identified by ID
        eg. self ----> ID
        the weight parameter specified the edge strength
        '''

        self.addRelation(relation_type, ID, self.inv_associations, weight)

        if relation_type in LinkType.get_tag_types():
            self.tagged_commits[relation_type].append(cmt.id)

        self.linksPerformed += 1
        self.addCmt2Subsys(cmt, relation_type)
Beispiel #4
0
    def addSendRelation(self, relation_type, ID, cmt, weight):
        '''
        add a one directional relation from the person instance
        (ie. self) and the person identified by ID
        eg. self ----> ID
        the weight parameter specified the edge strength
        '''

        self.addRelation(relation_type, ID, self.inv_associations, weight)

        if relation_type in LinkType.get_tag_types():
            self.tagged_commits[relation_type].append(cmt.id)

        self.linksPerformed +=1
        self.addCmt2Subsys(cmt, relation_type)
Beispiel #5
0
    def _check_sanity(self):
        '''
        Check that the configuration makes sense.
        :raise ConfigurationError
        '''

        # Some elementary sanity checks
        for key in self.GLOBAL_KEYS:
            if self._project_conf and key in self._project_conf:
                log.critical("The key '{}' may not be overridden in the "
                             "project configuration file".format(key))
                raise ConfigurationError('Invalid configuration key.')

        for key in self.GLOBAL_KEYS + self.PROJECT_KEYS:
            if not key in self:
                log.critical("Required key '{}' missing in configuration!"
                             ''.format(key))
                raise ConfigurationError('Missing configuration key.')

        if not self['tagging'] in LinkType.get_all_link_types():
            log.critical('Unsupported tagging mechanism specified!')
            raise ConfigurationError('Unsupported tagging mechanism.')

        if self["revisions"] == "3months":
            self._conf_file_substitute = True
            log.info(
                "3 months ranges specified in configuration, analyzing history "
                "in 3 month increments for at most 3 years")

        if len(self["revisions"]) < 2:
            log.info(
                "No revision range specified in configuration, analyzing history "
                "in 3 month increments")

        if len(self["revisions"]) != len(self["rcs"]):
            log.critical("Malformed configuration: revision and rcs list "
                         "lengths differ! Found {0} revisions and {1} release "
                         "candidates.".format(len(self["revisions"]),
                                              len(self["rcs"])))
            raise ConfigurationError('Malformed configuration.')

        unknown_keys = [k for k in self if k not in self.ALL_KEYS]
        for key in unknown_keys:
            log.warning("Unknown key '{}' in configuration.".format(key))
Beispiel #6
0
    def computeTagStats(self):
        """Compute statistics inferred from the tag information.

        While this can be called anytime, it makes sense to call the function
        only once all link data have been collected."""

        if self.linksPerformed == 0:
            log.warning("{0} did not perform any links?!".format(
                self.getName()))
            return

#        print("{0} performed {1} tags".format(self.getName(),
#                                               self.tagsPerformed))

# Per-author distribution of tags (e..g, 30% Signed-Off, 60%
# CC, 10% Acked-By)
        for tag in LinkType.get_tag_types() + ["author"]:
            self.tag_fraction[tag] = \
                len(self.tagged_commits[tag])/float(self.linksPerformed)
Beispiel #7
0
    def computeTagStats(self):
        """Compute statistics inferred from the tag information.

        While this can be called anytime, it makes sense to call the function
        only once all link data have been collected."""

        if self.linksPerformed == 0:
            log.warning("{0} did not perform any links?!".
                  format(self.getName()))
            return

#        print("{0} performed {1} tags".format(self.getName(),
#                                               self.tagsPerformed))

        # Per-author distribution of tags (e..g, 30% Signed-Off, 60%
        # CC, 10% Acked-By)
        for tag in LinkType.get_tag_types() + ["author"]:
            self.tag_fraction[tag] = \
                len(self.tagged_commits[tag])/float(self.linksPerformed)
Beispiel #8
0
    def computeRelationSums(self):
        # Summarise the links given _to_ (i.e, received by) the developer
        # from a specific ID
        for tag in LinkType.get_tag_types():
            self._sum_relations(tag, self.all_tags_received_by_id)

        # Active tags do not include things like CC, which can
        # be issued without the second party's consent
        for tag in active_tag_types:
            self._sum_relations(tag, self.active_tags_received_by_id)

        #sum other possible link types
        self._sum_relations(LinkType.proximity,
                            self.proximity_links_recieved_by_id)
        self._sum_relations(LinkType.feature,
                            self.feature_links_recieved_by_id)
        self._sum_relations(LinkType.feature_file,
                            self.feature_file_links_recieved_by_id)
        self._sum_relations(LinkType.committer2author,
                            self.committer_links_recieved_by_id)
        self._sum_relations(LinkType.file, self.file_links_recieved_by_id)
Beispiel #9
0
    def computeRelationSums(self):
        # Summarise the links given _to_ (i.e, received by) the developer
        # from a specific ID
        for tag in LinkType.get_tag_types():
            self._sum_relations(tag, self.all_tags_received_by_id)

        # Active tags do not include things like CC, which can
        # be issued without the second party's consent
        for tag in active_tag_types:
            self._sum_relations(tag, self.active_tags_received_by_id)

        #sum other possible link types
        self._sum_relations(
            LinkType.proximity, self.proximity_links_recieved_by_id)
        self._sum_relations(
            LinkType.feature, self.feature_links_recieved_by_id)
        self._sum_relations(
            LinkType.feature_file, self.feature_file_links_recieved_by_id)
        self._sum_relations(
            LinkType.committer2author, self.committer_links_recieved_by_id)
        self._sum_relations(
            LinkType.file, self.file_links_recieved_by_id)
Beispiel #10
0
    def __init__(self, subsys_names=[], ID=None, name="", email=""):
        self.ID = ID
        self.name = name
        self.email = email
        self.subsys_names = subsys_names

        # Store from which developers the person received a tag
        self.associations = {}
        for link_type in all_link_types:
            self.associations[link_type] = {}

        # See addSendRelation on the meaning of the following
        self.inv_associations = {}
        self.tagged_commits = {}
        for link_type in all_link_types + ["author"]:
            self.inv_associations[link_type] = {}

        # See computeTagStats()
        for tag in LinkType.get_tag_types() + ["author"]:
            self.tagged_commits[tag] = []
        self.tag_fraction = {}
        self.subsys_fraction = {}

        # List of all commits authored by this person (commit instances)
        # The commit_stats is a hash with summary statistics, see
        # computeCommitStats() for details
        self.commit_list = []
        self.commit_stats = None

        # Which subsystems were touched in which role. The entry
        # for each tag role is a hash with all subsystems as key, and the
        # count how often the subsystem was touched in that role as value
        self.subsys_touched = {}

        # "author" is a special-purpose role that is not included in
        # the generic tag role list.
        for link_type in all_link_types + ["author"]:
            self.subsys_touched[link_type] = {}

            # General is used if the commit does not touch any well-defined
            # subsystem(s), for instance when a generic header is modified.
            for subsys in subsys_names + ["general"]:
                self.subsys_touched[link_type][subsys] = 0
                self.subsys_touched[link_type]["general"] = 0

        # Count how often the person has made a link to someone else (i.e., given a
        # signed-off, made a commit in close proximity, committed someone code)
        self.linksPerformed = 0

        # Count how many tags (independent of tag category) have been
        # received form a specific ID.
        self.all_tags_received_by_id = {}

        # Count how many active tags (without "passive" categories like CC)
        # have beenreceived form a specific ID.
        self.active_tags_received_by_id = {}

        #count how many links based on the proximity metric were received by
        #a given ID
        self.proximity_links_recieved_by_id = {}

        # count how many links based on the feature metric were received by
        # a given ID
        self.feature_links_recieved_by_id = {}

        # count how many links based on the feature_file metric were
        # received by a given ID
        self.feature_file_links_recieved_by_id = {}

        #count how many links based on committer -> author were received by
        #a given ID
        self.committer_links_recieved_by_id = {}

        #count how many links based on commits in the same file were received by
        #a given ID
        self.file_links_recieved_by_id = {}
Beispiel #11
0
#
# Copyright 2010, 2011 by Wolfgang Mauerer <*****@*****.**>
# Copyright 2012, 2013, Siemens AG, Wolfgang Mauerer <*****@*****.**>
# All Rights Reserved.

from logging import getLogger
from codeface.linktype import LinkType

log = getLogger(__name__)

active_tag_types = [
    "Signed-off-by", "Acked-by", "Reviewed-by", "Tested-by", "Patch"
]

all_link_types = \
    LinkType.get_tag_types() + \
    [LinkType.proximity, LinkType.file, LinkType.committer2author,
     LinkType.feature, LinkType.feature_file]


# Readonly class
class RelationWeight:
    def __init__(self, weight, group_name, commit_ids1, commit_ids2):
        self.weight = weight
        self.groupName = group_name
        self.commitIds1 = commit_ids1
        self.commitIds2 = commit_ids2

    def get_weight(self):
        return self.weight
Beispiel #12
0
    def __init__(self, subsys_names = [], ID=None, name="", email=""):
        self.ID = ID
        self.name = name
        self.email = email
        self.subsys_names = subsys_names

        # Store from which developers the person received a tag
        self.associations = {}
        for link_type in all_link_types:
            self.associations[link_type] = {}

        # See addSendRelation on the meaning of the following
        self.inv_associations = {}
        self.tagged_commits = {}
        for link_type in all_link_types + ["author"]:
            self.inv_associations[link_type] = {}

        # See computeTagStats()
        for tag in LinkType.get_tag_types() + ["author"]:
            self.tagged_commits[tag] = []
        self.tag_fraction = {}
        self.subsys_fraction = {}

        # List of all commits authored by this person (commit instances)
        # The commit_stats is a hash with summary statistics, see
        # computeCommitStats() for details
        self.commit_list = []
        self.commit_stats = None

        # Which subsystems were touched in which role. The entry
        # for each tag role is a hash with all subsystems as key, and the
        # count how often the subsystem was touched in that role as value
        self.subsys_touched = {}

        # "author" is a special-purpose role that is not included in
        # the generic tag role list.
        for link_type in all_link_types + ["author"]:
            self.subsys_touched[link_type] = {}

            # General is used if the commit does not touch any well-defined
            # subsystem(s), for instance when a generic header is modified.
            for subsys in subsys_names + ["general"]:
                self.subsys_touched[link_type][subsys] = 0
                self.subsys_touched[link_type]["general"] = 0

        # Count how often the person has made a link to someone else (i.e., given a
        # signed-off, made a commit in close proximity, committed someone code)
        self.linksPerformed = 0

        # Count how many tags (independent of tag category) have been
        # received form a specific ID.
        self.all_tags_received_by_id = {}

        # Count how many active tags (without "passive" categories like CC)
        # have beenreceived form a specific ID.
        self.active_tags_received_by_id = {}

        #count how many links based on the proximity metric were received by
        #a given ID
        self.proximity_links_recieved_by_id = {}

        # count how many links based on the feature metric were received by
        # a given ID
        self.feature_links_recieved_by_id = {}

        # count how many links based on the feature_file metric were
        # received by a given ID
        self.feature_file_links_recieved_by_id = {}

        #count how many links based on committer -> author were received by
        #a given ID
        self.committer_links_recieved_by_id = {}

        #count how many links based on commits in the same file were received by
        #a given ID
        self.file_links_recieved_by_id = {}
Beispiel #13
0
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# Copyright 2010, 2011 by Wolfgang Mauerer <*****@*****.**>
# Copyright 2012, 2013, Siemens AG, Wolfgang Mauerer <*****@*****.**>
# All Rights Reserved.

from logging import getLogger;
from codeface.linktype import LinkType

log = getLogger(__name__)

active_tag_types = ["Signed-off-by", "Acked-by", "Reviewed-by",
                    "Tested-by", "Patch"]

all_link_types = \
    LinkType.get_tag_types() + \
    [LinkType.proximity, LinkType.file, LinkType.committer2author,
     LinkType.feature, LinkType.feature_file]


# Readonly class
class RelationWeight:
    def __init__(self, weight, group_name, commit_ids1, commit_ids2):
        self.weight = weight
        self.groupName = group_name
        self.commitIds1 = commit_ids1
        self.commitIds2 = commit_ids2

    def get_weight(self):
        return self.weight