Ejemplo n.º 1
0
    def _compute(self):
        self.results = {'closed': {}, 'open': {}}
        pr_age = map(lambda pr: (pr.closed_at - pr.created_at).seconds,
                     self.closed_pull_requests)
        self.results['closed']['age'] = {
            'max': max(pr_age),
            'min': min(pr_age),
            'avg': mean(pr_age)
        }
        self.results['closed']['commits'] = {
            'pr_count': len(pr_age),
            'commits_count': 0,
            'additions': 0,
            'deletions': 0,
            'biggest': 0
        }
        for p in self.closed_pull_requests:
            for c in p.iter_commits():
                commit = self.gh.commit(p.repository[1], c.sha)
                if DateUtils.parse(
                        commit.commit.author['date'],
                        self.DATE_FORMAT) > DateUtils.one_week_ago():
                    self.results['closed']['commits']['commits_count'] += 1
                    self.results['closed']['commits'][
                        'additions'] += commit.additions
                    self.results['closed']['commits'][
                        'deletions'] += commit.deletions
                    self.results['closed']['commits']['biggest'] = max(
                        self.results['closed']['commits']['biggest'],
                        commit.additions + commit.deletions)

        self.results['open'] = self.open_pull_requests
Ejemplo n.º 2
0
 def _retrieve_data(self):
     self.closed_pull_requests = []
     self.open_pull_requests = []
     for repo in self.gh.repos():
         for pr in repo.iter_pulls(state="all", base=self.base):
             if pr.state == "closed" and pr.closed_at > DateUtils.one_week_ago():
                 self.closed_pull_requests.append(repo.pull_request(pr.number))
             elif pr.state == "open" and pr.created_at <= DateUtils.one_week_ago():
                 self.open_pull_requests.append(repo.pull_request(pr.number))
Ejemplo n.º 3
0
 def _retrieve_data(self):
     self.closed_pull_requests = []
     self.open_pull_requests = []
     for repo in self.gh.repos():
         for pr in repo.iter_pulls(state="all", base=self.base):
             if pr.state == "closed" and pr.closed_at > DateUtils.one_week_ago(
             ):
                 self.closed_pull_requests.append(
                     repo.pull_request(pr.number))
             elif pr.state == "open" and pr.created_at <= DateUtils.one_week_ago(
             ):
                 self.open_pull_requests.append(repo.pull_request(
                     pr.number))
Ejemplo n.º 4
0
 def _retrieve_data(self):
     self.status = []
     for repo in self.gh.repos():
         self.logger.debug("Retrieving build status for: repo {} - branch {}".format(repo, self.base))
         for status in repo.iter_statuses(self.base):
             if status.created_at <= DateUtils.one_week_ago():
                 break
             self.status.append(status)
Ejemplo n.º 5
0
 def _retrieve_data(self):
     self.status = []
     for repo in self.gh.repos():
         self.logger.debug(
             "Retrieving build status for: repo {} - branch {}".format(
                 repo, self.base))
         for status in repo.iter_statuses(self.base):
             if status.created_at <= DateUtils.one_week_ago():
                 break
             self.status.append(status)
Ejemplo n.º 6
0
    def _retrieve_data(self):

        self.commits = []

        for repo in self.gh.repos():
            self.logger.debug("Retrieving commit info for: repo {} - branch {}".format(repo, self.base))
            try:
                for commit in repo.iter_commits(self.base, since=DateUtils.one_week_ago() + timedelta(days=1)):
                    self.commits.append(self.gh.commit(repo.name, commit.sha))
            except:
                self.logger.debug("{0} is empty in {1}".format(repo, self.base))
Ejemplo n.º 7
0
    def _compute(self):
        self.results = {"closed": {}, "open": {}}
        pr_age = map(lambda pr: (pr.closed_at - pr.created_at).seconds, self.closed_pull_requests)
        self.results["closed"]["age"] = {"max": max(pr_age), "min": min(pr_age), "avg": mean(pr_age)}
        self.results["closed"]["commits"] = {
            "pr_count": len(pr_age),
            "commits_count": 0,
            "additions": 0,
            "deletions": 0,
            "biggest": 0,
        }
        for p in self.closed_pull_requests:
            for c in p.iter_commits():
                commit = self.gh.commit(p.repository[1], c.sha)
                if DateUtils.parse(commit.commit.author["date"], self.DATE_FORMAT) > DateUtils.one_week_ago():
                    self.results["closed"]["commits"]["commits_count"] += 1
                    self.results["closed"]["commits"]["additions"] += commit.additions
                    self.results["closed"]["commits"]["deletions"] += commit.deletions
                    self.results["closed"]["commits"]["biggest"] = max(
                        self.results["closed"]["commits"]["biggest"], commit.additions + commit.deletions
                    )

        self.results["open"] = self.open_pull_requests
    def _retrieve_data(self):

        self.commits = []

        for repo in self.gh.repos():
            self.logger.debug(
                "Retrieving commit info for: repo {} - branch {}".format(
                    repo, self.base))
            try:
                for commit in repo.iter_commits(
                        self.base,
                        since=DateUtils.one_week_ago() + timedelta(days=1)):
                    self.commits.append(self.gh.commit(repo.name, commit.sha))
            except:
                self.logger.debug("{0} is empty in {1}".format(
                    repo, self.base))