Skip to content

Commit a7e452a

Browse files
committed
Enhance GitHubStatsAnalyzer with code change statistics and improved output formatting
- Added accurate line counting for code changes, distinguishing between all files and code files only. - Introduced new statistics for code additions, deletions, and net change, enhancing the analysis detail. - Updated output formatting in text, JSON, and CSV to include code change statistics, improving clarity and usability. - Refactored the analyzer to handle commit file details, allowing for more granular tracking of changes per file. - Enhanced tests to validate new features and ensure accurate reporting of code statistics.
1 parent 2598f2d commit a7e452a

File tree

7 files changed

+353
-83
lines changed

7 files changed

+353
-83
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
66
[![PyPI version](https://badge.fury.io/py/github-stats-analyzer.svg)](https://badge.fury.io/py/github-stats-analyzer)
77
[![PyPI downloads](https://img.shields.io/pypi/dm/github-stats-analyzer.svg)](https://pypi.org/project/github-stats-analyzer/)
8+
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/SakuraPuare/github-stats-analyzer/test.yml?branch=main&label=tests)](https://github.com/SakuraPuare/github-stats-analyzer/actions/workflows/test.yml)
9+
[![GitHub stars](https://img.shields.io/github/stars/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/stargazers)
10+
[![GitHub forks](https://img.shields.io/github/forks/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/network/members)
11+
[![GitHub issues](https://img.shields.io/github/issues/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/issues)
12+
[![GitHub pull requests](https://img.shields.io/github/issues-pr/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/pulls)
13+
[![GitHub last commit](https://img.shields.io/github/last-commit/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/commits/main)
14+
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/releases)
15+
[![Codecov](https://codecov.io/gh/SakuraPuare/github-stats-analyzer/branch/main/graph/badge.svg)](https://codecov.io/gh/SakuraPuare/github-stats-analyzer)
16+
[![Documentation Status](https://readthedocs.org/projects/github-stats-analyzer/badge/?version=latest)](https://github-stats-analyzer.readthedocs.io/en/latest/?badge=latest)
17+
[![wakatime](https://wakatime.com/badge/user/6b4b61d2-7698-48db-9196-f67e42f0658d/project/b599418e-e4fa-4c9a-8624-b9c87c684632.svg)](https://wakatime.com/badge/user/6b4b61d2-7698-48db-9196-f67e42f0658d/project/b599418e-e4fa-4c9a-8624-b9c87c684632)
818

919
*Read this in [中文 (Chinese)](README_CN.md).*
1020

@@ -25,6 +35,7 @@ View the latest analysis results in the [stats branch](https://github.com/Sakura
2535
- **Comprehensive Analysis**: Collects detailed statistics on code contributions
2636
- **Language Breakdown**: Shows distribution of code across programming languages
2737
- **Smart Fork Analysis**: Analyzes all repositories including forks, but only counts user's own contributions
38+
- **Accurate Line Counting**: Precisely measures actual code lines by analyzing commit data directly from GitHub's API
2839
- **Parallel Processing**: Efficiently processes multiple repositories concurrently
2940
- **Rich Output**: Beautiful console output with tables and colors
3041
- **Detailed Logging**: Comprehensive logging for debugging
@@ -192,8 +203,8 @@ The program will display:
192203
## 📝 Notes
193204

194205
- The program analyzes all repositories including forks, but only counts the user's own contributions
206+
- **Highly Accurate Line Counting**: Unlike other tools that estimate based on file size, our analyzer precisely counts actual code lines by analyzing commit data
195207
- GitHub API has rate limits, so analyzing users with many repositories might take time
196-
- Lines of code are estimated based on byte count (approximation)
197208
- Some languages are excluded by default to avoid skewing statistics (use `--include-all` to include them)
198209
- Log files are stored in the `logs` directory
199210
- Basic access mode is suitable for quick analysis of public repositories

README_CN.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
66
[![PyPI version](https://badge.fury.io/py/github-stats-analyzer.svg)](https://badge.fury.io/py/github-stats-analyzer)
77
[![PyPI downloads](https://img.shields.io/pypi/dm/github-stats-analyzer.svg)](https://pypi.org/project/github-stats-analyzer/)
8+
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/SakuraPuare/github-stats-analyzer/test.yml?branch=main&label=tests)](https://github.com/SakuraPuare/github-stats-analyzer/actions/workflows/test.yml)
9+
[![GitHub stars](https://img.shields.io/github/stars/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/stargazers)
10+
[![GitHub forks](https://img.shields.io/github/forks/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/network/members)
11+
[![GitHub issues](https://img.shields.io/github/issues/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/issues)
12+
[![GitHub pull requests](https://img.shields.io/github/issues-pr/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/pulls)
13+
[![GitHub last commit](https://img.shields.io/github/last-commit/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/commits/main)
14+
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/SakuraPuare/github-stats-analyzer)](https://github.com/SakuraPuare/github-stats-analyzer/releases)
15+
[![Codecov](https://codecov.io/gh/SakuraPuare/github-stats-analyzer/branch/main/graph/badge.svg)](https://codecov.io/gh/SakuraPuare/github-stats-analyzer)
16+
[![Documentation Status](https://readthedocs.org/projects/github-stats-analyzer/badge/?version=latest)](https://github-stats-analyzer.readthedocs.io/en/latest/?badge=latest)
17+
[![wakatime](https://wakatime.com/badge/user/6b4b61d2-7698-48db-9196-f67e42f0658d/project/b599418e-e4fa-4c9a-8624-b9c87c684632.svg)](https://wakatime.com/badge/user/6b4b61d2-7698-48db-9196-f67e42f0658d/project/b599418e-e4fa-4c9a-8624-b9c87c684632)
818

919
*Read this in [English](README.md).*
1020

@@ -26,6 +36,7 @@
2636
- **全面分析**:收集代码贡献的详细统计数据
2737
- **语言细分**:显示代码在各编程语言中的分布
2838
- **智能Fork分析**:分析所有仓库包括fork的仓库,但只统计用户自己的贡献
39+
- **精确代码行统计**:通过直接分析GitHub API的提交数据,精确测量实际代码行数
2940
- **并行处理**:高效地并发处理多个仓库
3041
- **丰富输出**:美观的控制台输出,带有表格和颜色
3142
- **详细日志**:用于调试的全面日志记录
@@ -193,8 +204,8 @@ asyncio.run(analyze_user("octocat", AccessLevel.FULL))
193204
## 📝 注意事项
194205

195206
- 程序分析所有仓库包括 fork 的仓库,但只统计用户自己的贡献
207+
- **高精度代码行统计**:与其他基于文件大小进行估算的工具不同,我们的分析器通过分析提交数据精确计算实际代码行数
196208
- GitHub API 有速率限制,因此分析拥有许多仓库的用户可能需要一些时间
197-
- 代码行数是基于字节数的估计(近似值)
198209
- 默认情况下排除某些语言以避免统计偏差(使用 `--include-all` 选项可包含所有语言)
199210
- 日志文件存储在 `logs` 目录中
200211
- 基础访问模式适合快速分析公开仓库

0 commit comments

Comments
 (0)