Add commit pattern, code churn, risky commit, and velocity analyzers
This commit is contained in:
@@ -3,7 +3,7 @@ from dataclasses import dataclass
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from src.analyzers.git_repository import GitRepository
|
||||
from src.models.data_structures import CommitAnalysis
|
||||
from src.models.data_structures import CommitAnalysis, Author
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -24,8 +24,6 @@ class CommitPatternAnalyzer:
|
||||
commits_by_day: Dict[str, int] = defaultdict(int)
|
||||
commits_by_week: Dict[str, int] = defaultdict(int)
|
||||
|
||||
author_commits: Dict[str, List[str]] = defaultdict(list)
|
||||
|
||||
for commit in commits:
|
||||
hour_key = commit.timestamp.strftime("%H:00")
|
||||
day_key = commit.timestamp.strftime("%A")
|
||||
@@ -35,17 +33,7 @@ class CommitPatternAnalyzer:
|
||||
commits_by_day[day_key] += 1
|
||||
commits_by_week[week_key] += 1
|
||||
|
||||
author_commits[commit.author_email].append(commit.sha)
|
||||
|
||||
authors = []
|
||||
for email, commit_shas in author_commits.items():
|
||||
author = self.repo.get_authors()
|
||||
for a in author:
|
||||
if a.email == email:
|
||||
a.commit_count = len(commit_shas)
|
||||
authors.append(a)
|
||||
break
|
||||
|
||||
authors = self.repo.get_authors()
|
||||
authors.sort(key=lambda a: a.commit_count, reverse=True)
|
||||
top_authors = authors[:10]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user