Add models and data structures
Some checks failed
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
2026-02-01 08:27:30 +00:00
parent 050e9cfbf3
commit 53ec0d09c3

View File

@@ -22,31 +22,24 @@ class Commit:
"""Represents a git commit.""" """Represents a git commit."""
sha: str sha: str
message: str message: str
author_name: str author: str
author_email: str author_email: str
committed_datetime: datetime timestamp: datetime
author_datetime: datetime lines_added: int = 0
parents: List[str] = field(default_factory=list) lines_deleted: int = 0
additions: int = 0
deletions: int = 0
files_changed: List[str] = field(default_factory=list) files_changed: List[str] = field(default_factory=list)
file_changes: List["FileChange"] = field(default_factory=list)
is_merge: bool = False is_merge: bool = False
is_revert: bool = False is_revert: bool = False
@property
def timestamp(self) -> datetime:
return self.committed_datetime
@dataclass_json @dataclass_json
@dataclass @dataclass
class FileChange: class FileChange:
"""Represents changes to a file in a commit.""" """Represents changes to a file in a commit."""
filepath: str filepath: str
additions: int lines_added: int
deletions: int lines_deleted: int
changes: int = 0 change_type: str
@dataclass_json @dataclass_json
@@ -97,15 +90,3 @@ class VelocityAnalysis:
top_contributors: List[Author] top_contributors: List[Author]
most_active_day: str most_active_day: str
most_active_hour: str most_active_hour: str
@dataclass_json
@dataclass
class ProductivityReport:
"""Comprehensive productivity report."""
repository_path: str
analysis_days: int
commit_analysis: Optional[CommitAnalysis]
code_churn_analysis: Optional[CodeChurnAnalysis]
risky_commit_analysis: Optional[RiskyCommitAnalysis]
velocity_analysis: Optional[VelocityAnalysis]