https://github.com/priyavkaneria/codestats
A quick project to calculate and analyze code and contribution stats for all my github, gitlab, local projects along with those I have contributed to
https://github.com/priyavkaneria/codestats
analysis code github projects stats
Last synced: 3 months ago
JSON representation
A quick project to calculate and analyze code and contribution stats for all my github, gitlab, local projects along with those I have contributed to
- Host: GitHub
- URL: https://github.com/priyavkaneria/codestats
- Owner: PriyavKaneria
- License: mit
- Created: 2024-08-31T10:35:03.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-13T22:04:57.000Z (almost 2 years ago)
- Last Synced: 2025-09-05T06:38:51.286Z (10 months ago)
- Topics: analysis, code, github, projects, stats
- Language: Python
- Homepage:
- Size: 3.16 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeStats
A quick project to calculate and analyze stats for all my github, gitlab, local projects
Clones the repositories, counts the lines of code, and calculates the stats.
## Output stats
CLI Visualization

Demo
https://github.com/user-attachments/assets/c1030eb8-8e18-403d-aeef-7bfe9ce0211e
`loc_analysis.json`
```json5
"repo_name": {
"total_files": "number",
"total_lines": "number",
"total_blanks": "number",
"total_comments": "number",
"total_lines_of_code": "number",
"boilerplate_lines": "number", // import statements, require statements, etc for now
"actual_code_lines": "number",
"language_distribution": {
"language_extension": "number_of_lines", // supports any language can be configured as below
},
"description": "string",
"stars": "number", // if repo accessible
"topics": ["string"], // if repo accessible
"contributions": {
"total_commits": "number",
"total_lines_changed": {
"additions": "number",
"deletions": "number",
},
"first_commit_date": "datetime_string",
"last_commit_date": "datetime_string",
"median_commit_size": "float",
}
},
```
## Usage
### Requirements
Recommended Python version: 3.10+
```bash
pip install -r requirements.txt
```
### Configuration
Create a `repos.json` file in the root directory with the following structure:
```json5
[
{
"source": "github", // only github supported for now [local, gitlab to be added]
"path": "REPO_OWNER/REPO_NAME",
"ignore": ["files", "to", "ignore"],
"contributor": true // optional, default: false
},
]
```
Set environment variables for the following:
```env
CONTRIBUTION_AUTHOR_NAMES={COMMA_SEPARATED_AUTHOR_NAMES}
GITHUB_ACCESS_TOKEN={YOUR_GITHUB_ACCESS_TOKEN}
```
### Run
If you have cmake installed, you can use make commands to run the project
#### Getting unique languages across all repos
```bash
make languages
```
OR
```bash
python main.py languages
```
> The languages can be configured in the `main.py` file using the `analyze_file_types` variable
#### Calculating analysis for all repos
```bash
make analyze
```
OR
```bash
python main.py analyze
```
#### Visualizing the stats
```bash
make visualize
```
OR
```bash
python main.py visualize
```