lechibang-1512 5b111ee825 Enhance PDF report generation with improved color schemes, standardized formatting, and better error handling in fpdf2 integration 2 месяцев назад
__pycache__ ported to python 3 2 месяцев назад
.gitignore added export to pdf function and .gitignore 2 месяцев назад
README.md Add SLOC analysis and composition table (analyzesloc + SLOC helpers) — gitstats Track and plot pace of changes (pace_of_changes data + pace_of_changes.png/.dat) — gitstats Add PDF report generator using fpdf2 with embedded charts (PDFReportCreator) — gitstats Add repository size calculation and getter (repository_size_mb + getRepositorySize) — gitstats Add last-30-days and last-12-months activity summaries and accessors (last_30_days_*, last_12_months_*) — gitstats Add SLOC-per-extension breakdown on lines page and related data writers — gitstats Add commit timing / external-command timing and --debug/--verbose tracing in runner — gitstats Chores 2 месяцев назад
arrow-down.gif Add sortable.js for sortable tables in output. 17 лет назад
arrow-none.gif Add sortable.js for sortable tables in output. 17 лет назад
arrow-up.gif Add sortable.js for sortable tables in output. 17 лет назад
gitstats.css Add styles for team analysis, performance tables, and highlight patterns 2 месяцев назад
gitstats.py Enhance PDF report generation with improved color schemes, standardized formatting, and better error handling in fpdf2 integration 2 месяцев назад
sortable.js . Security Issues ✅ Fixed bare except clause in cache loading that could hide critical errors Added input validation to getpipeoutput() function to detect potential command injection attempts Improved file handling with proper context managers and error handling 2. Error Handling Patterns ✅ Replaced bare except with specific exception types (zlib.error, pickle.PickleError, EOFError, etc.) Added proper error messages with context information Fixed division by zero in execution time calculation Added main-level exception handling with debug mode support 3. Undefined Variables/Functions ✅ Verified all function calls are properly defined Fixed potential runtime errors in mathematical operations Added safe division operations where needed 4. JavaScript Code Style Issues ✅ Fixed undeclared variables in sortable.js by adding proper var declarations Fixed variable shadowing in compare_numeric() function Improved loop variable declarations in sortables_init() and ts_resortTable() Added missing variable declarations for ARROW, dt, mtstr, yr, etc. 5. Performance Issues ✅ Optimized file operations by using context managers Reviewed and confirmed existing code already handles most performance concerns appropriately Improved cache file handling to be more robust 6. Configuration and Path Validation ✅ Added comprehensive git repository validation (existence, directory check, .git folder verification) Added output directory validation with permission checks Enhanced configuration parsing with type validation and range checks Added better error messages for invalid configurations Key Improvements Made Better Error Messages: All error conditions now provide clear, actionable feedback Input Validation: Added checks for git repositories, output directories, and configuration values Robust File Handling: Using context managers and proper exception handling Security Hardening: Basic command injection detection and safer file operations Code Quality: Fixed JavaScript variable scope issues and improved maintainability 2 месяцев назад

README.md

gitstats3

gitstats3 is a git history statistics generator, ported from Python 2 to Python 3.

This project allows you to analyze and visualize various statistics from a git repository, such as commit activity, author contributions, and more. It is a fork of the original gitstats project, updated to work with modern Python environments.

Features

  • Generates detailed statistics and graphs from git repositories
  • Analyzes commit history, author contribution, file changes, and more
  • Output is visual and easy to share

Getting Started

Prerequisites

  • Python 3.x
  • Git (installed and available in your system path)

Installation

Clone the repository:

git clone https://github.com/lechibang-1512/gitstats3.git
cd gitstats3

Install required dependencies (if any):

pip install -r requirements.txt

Usage

To generate statistics for a git repository:

python gitstats <path-to-git-repo> <output-directory>

Example:

python gitstats /path/to/your/repo /path/to/output
To generate statistics for a git repository:

```sh
python gitstats <path-to-git-repo> <output-directory>

Common options:

  • --debug: print detailed command traces and timings (useful for diagnosing issues).
  • --verbose: show progress and executed git/gnuplot commands.
  • --processes N: run N worker processes when collecting data (default depends on your machine).

Example:

python gitstats /path/to/your/repo /path/to/output --verbose --processes 4

This will analyze the git repository and generate an HTML report (and optional PDF) in the output directory.

Required system dependencies and notes:

  • Python 3.x: the script targets modern Python 3.
  • Git: required for reading repository history.
  • gnuplot: used to render charts. If not installed, .dat and .plot files will still be produced but PNG graphs won't be generated.
  • fpdf (Python package): used to create a summary PDF. You may see deprecation warnings from older fpdf APIs; the PDF is still created successfully, but updating fpdf usage can remove warnings.

Install Python dependencies (if provided):

pip install -r requirements.txt

On Debian/Ubuntu you can install system deps with:

sudo apt-get update && sudo apt-get install git gnuplot

Generated output (example files written to the output directory):

  • index.html: main HTML report with links to charts and pages.
  • authors.html, lines.html, files.html, tags.html, activity.html: detail pages for each statistic.
  • *.dat, *.plot: raw data and gnuplot scripts used to generate images.
  • *.png: chart images produced by gnuplot (if available).
  • gitstats_*.pdf: optional PDF summary produced via fpdf.

Troubleshooting tips:

  • If charts are missing, confirm gnuplot is installed and available in your PATH.
  • If the script fails with permission errors, ensure you have read access to the git repository and write access to the output directory.
  • Use --debug to see the exact git and gnuplot commands being executed; this helps reproduce and fix issues.
  • If you see fpdf deprecation warnings, the PDF is likely still generated. Consider upgrading the fpdf package or updating the PDF-generation code to use the current API.