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.
Demo
code-stats-demo.mp4
loc_analysis.json
"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",
}
},Recommended Python version: 3.10+
pip install -r requirements.txtCreate a repos.json file in the root directory with the following structure:
[
{
"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:
CONTRIBUTION_AUTHOR_NAMES={COMMA_SEPARATED_AUTHOR_NAMES}
GITHUB_ACCESS_TOKEN={YOUR_GITHUB_ACCESS_TOKEN}If you have cmake installed, you can use make commands to run the project
make languagesOR
python main.py languagesThe languages can be configured in the
main.pyfile using theanalyze_file_typesvariable
make analyzeOR
python main.py analyzemake visualizeOR
python main.py visualize