https://github.com/wdudokvanheel/pstatool
A Rust tool for analyzing GitHub repositories with CLOC and generating SVG visualizations of code statistics.
https://github.com/wdudokvanheel/pstatool
cloc github lines-of-code rust statistics svg
Last synced: about 2 months ago
JSON representation
A Rust tool for analyzing GitHub repositories with CLOC and generating SVG visualizations of code statistics.
- Host: GitHub
- URL: https://github.com/wdudokvanheel/pstatool
- Owner: wdudokvanheel
- Created: 2025-02-17T13:45:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-14T07:32:27.000Z (about 1 year ago)
- Last Synced: 2025-05-16T09:07:14.941Z (about 1 year ago)
- Topics: cloc, github, lines-of-code, rust, statistics, svg
- Language: Rust
- Homepage:
- Size: 45.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pstatool
Project Stats Tool (_pstatool_) automates the retrieval, analysis, and visualization of GitHub repositories. It clones
repositories, runs CLOC to gather code statistics, and generates SVG visualizations. Designed
for automation, it includes a Docker container that periodically updates projects, generates
visualizations, and serves them via a built-in web server.
## Features
- Shallow clones Git repositories for efficient analysis
- Generates SVG visualizations of code metrics
- Stores project statistics in a PostgreSQL database for further processing
- Docker container includes a web server for hosting of SVG files
## How to run
The binary can be run to retrieve all projects from the database and generate SVG files for each.
pstatool --db-url --svg-folder --temp-folder
### Docker compose
```
version: '3.0'
services:
postgres:
image: postgres:17.3
container_name: pstatool-db
restart: unless-stopped
environment:
POSTGRES_USER: "pstatool"
POSTGRES_PASSWORD: "pstatool"
POSTGRES_DB: "pstatool"
volumes:
- pstatool:/var/lib/postgresql/data
pstatool:
image: pstatool:latest
container_name: pstatool
restart: unless-stopped
depends_on:
- postgres
ports:
- "80:80"
environment:
DB_URL: "postgresql://pstatool:pstatool@pstatool-db:5432/pstatool"
volumes:
pstatool:
```
### Webserver
The generated SVG files are hosted by the Docker container (with nginx) at the path `githubuser/project-name.svg`
For example, this repository have its stats SVG at `http://localhost/wdudokvanheel/pstatool.svg`
## Example
These are the generated stats for this repository

To Do
- [ ] Sum SVG for all projects
- [ ] Allow binary generate svg of target folder (no database option)
- [ ] Allow binary generate svg of target git repo (no database option)