A Streamlit web application that analyzes GitHub repositories to estimate Function Points (FP) based on Source Lines of Code (SLOC) for Python, JavaScript/TypeScript, and CSS files.
- Multi-Repository Analysis: Input one or multiple GitHub repository URLs for batch processing
- Comprehensive Language Support:
- Python:
.py
,.pyw
,.ipynb
(Jupyter notebooks with code extraction) - JavaScript/TypeScript:
.js
,.ts
,.tsx
,.jsx
,.mjs
,.cjs
- CSS:
.css
,.scss
,.sass
,.less
- Python:
- Accurate SLOC Counting: Ignores comments and blank lines with language-specific handling
- Function Point Calculation: Uses standard SLOC-to-FP conversion ratios
- Python: 45 SLOC per FP
- JavaScript/TypeScript/CSS: 54 SLOC per FP
- Interactive Dashboard:
- Data table sorted by total FP (highest first)
- Bar chart comparison across repositories
- Download results as JSON or CSV
- Progress Tracking: Real-time status updates during repository cloning and analysis
- URL Validation: Ensures valid GitHub repository URLs
- Clone this repository:
git clone https://github.com/kenhuangus/function-point-calculator.git
cd function-point-calculator
- Install dependencies:
pip install streamlit gitpython pandas
- Run the Streamlit app:
streamlit run app.py
-
Open your browser to the provided local URL (typically http://localhost:8501)
-
Enter GitHub repository URLs (one per line) in the text area
-
Click "Analyze Repositories" and wait for processing
-
View the results table, sorted by total FP, and download if needed
https://github.com/octocat/Hello-World.git
https://github.com/microsoft/vscode
https://github.com/facebook/react
The application performs the following steps:
- URL Validation: Ensures each input is a valid GitHub repository URL
- Repository Cloning: Uses GitPython to clone repos into a temporary directory
- File Discovery: Recursively scans for supported file types
- Code Extraction: For
.ipynb
files, extracts code fromcode
cells only - SLOC Counting:
- Skips blank lines
- Ignores comments:
- Python:
#
comments - JavaScript/TypeScript:
//
and/* ... */
blocks - CSS:
/* ... */
blocks
- Python:
- FP Calculation: SLOC / Ratio (rounded to 2 decimal places)
- Aggregation: Sums FP across all languages for total FP per repo
- Presentation: Sorts results by total FP descending
- Streamlit: Web framework for the UI
- GitPython: For Git repository operations
- Pandas: Data manipulation and CSV export
- JSON: For notebook file parsing
- Repositories are cloned into system temporary directories
- Application performs read-only operations on files
- No code execution; only static analysis of source files
Feel free to submit issues and enhancement requests!
This project is open source. Please use responsibly for GitHub repository analysis.