CtrlK
BlogDocsLog inGet started
Tessl Logo

finkel/jgit

JGit documentation and API reference with code examples

92

1.09x
Quality

Pending

Does it follow best practices?

Impact

92%

1.09x

Average score across 10 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-2/

Git Repository Analysis Tool

Problem/Feature Description

Our engineering analytics team needs to generate reports on codebase health metrics across multiple projects. They currently use shell scripts with git log commands, but the parsing is fragile and doesn't scale well.

We need a Java-based repository analysis tool that can extract detailed statistics from Git repositories. The tool should analyze commit history, contributor activity, and file change patterns. It will be integrated into our analytics pipeline running on a server that processes hundreds of repositories daily.

Key requirements:

  • Open existing Git repositories (both bare and non-bare)
  • Extract commit statistics: total commits, commits by author, commit frequency over time
  • Analyze file change patterns: most frequently changed files, file types with most changes
  • Calculate basic metrics: average commits per day, bus factor (distribution of contributions)
  • Output results in structured format (JSON or CSV)
  • Handle large repositories efficiently (some have 100k+ commits)
  • Provide both programmatic API and command-line interface

The tool should use appropriate JGit APIs for efficiency - porcelain commands for high-level operations and low-level APIs where direct object access provides better performance.

Output Specification

Create a Java class RepositoryAnalyzer with the following functionality:

  1. Constructor: Takes a path to a Git repository
  2. analyzeCommits(): Returns commit statistics (total count, by author, timeline)
  3. analyzeFileChanges(): Returns file change statistics
  4. generateReport(): Outputs analysis in JSON format
  5. main() method: Command-line interface accepting repository path and output format options

Include supporting classes as needed for data structures.

Expected output files:

  • RepositoryAnalyzer.java - Main analysis class
  • CommitStats.java - Data class for commit statistics
  • FileChangeStats.java - Data class for file change statistics
  • AnalysisReport.java - Report generation class
  • build.gradle or pom.xml - Build configuration
  • README.md - Usage instructions

The solution should demonstrate understanding of both high-level and low-level JGit APIs, choosing the appropriate approach for different analysis tasks.

tile.json