-
Intelligent Code Metrics
- Advanced cyclomatic complexity calculation
- AST-based code structure analysis
- Smart pattern recognition for duplicates
- Multi-language support (40+ languages)
-
Code Quality Assessment
- ๐ Control Flow Analysis
- ๐ Documentation Coverage Analysis
- ๐ฏ Maintainability Scoring
- ๐ Duplicate Code Detection
- ๐ Comprehensive Quality Metrics
-
Industry-Standard Models
- COCOMO II (Constructive Cost Model)
- Function Point Analysis
- Calibrated LOC-based Estimation
-
Sophisticated Parameters
- Dynamic rate adjustment
- Project complexity analysis
- Team size optimization
- Risk factor consideration
- Rich interactive CLI interface
- Real-time analysis feedback
- Smart recommendations engine
- Detailed metric breakdowns
- Progress tracking
- Error resilience and recovery
CodeMetrix uses several sophisticated algorithms and techniques:
- Abstract Syntax Tree (AST) parsing
- Pattern matching algorithms
- Regex-based smart filtering
- Multi-pass code analysis
- Halstead complexity measures
- Maintainability index computation
- Documentation coverage analysis
- Duplicate code detection using hash comparison
- COCOMO II algorithmic model
- Function Point Analysis (FPA)
- Calibrated estimation formulas
- Multi-factor adjustment system
- Python 3.7 or higher
- pip package manager
- Clone the repository:
git clone https://github.com/Ayushx309/codemetrix.git
cd codemetrix
- Install dependencies:
pip install -r requirements.txt
python codemetrix.py -d /path/to/your/project
# Analyze specific file types
python codemetrix.py -d /path/to/project -e py js ts
# Exclude comments and blank lines
python codemetrix.py -d /path/to/project --no-comments
# Custom hourly rate for cost estimation
python codemetrix.py -d /path/to/project -r 75
# Exclude specific directories
python codemetrix.py -d /path/to/project -x node_modules venv
Option | Description |
---|---|
-d, --directory |
Directory to analyze (interactive if not specified) |
-e, --extensions |
File extensions to include (default: common code files) |
-a, --all |
Include blank lines in the count |
-c, --no-comments |
Exclude comment lines from the count |
-x, --exclude |
Directories to exclude from analysis |
-r, --rate |
Hourly rate in USD for cost estimation |
--no-cost |
Skip cost estimation |
Click to expand language list
- HTML/CSS:
.html
,.htm
,.css
,.scss
,.sass
,.less
- JavaScript:
.js
,.jsx
,.ts
,.tsx
,.vue
,.svelte
- Python:
.py
- Java:
.java
- PHP:
.php
- Ruby:
.rb
- Go:
.go
- Rust:
.rs
- C#:
.cs
- C/C++:
.c
,.cpp
,.cc
,.cxx
,.h
,.hpp
- Objective-C:
.m
,.mm
- Swift:
.swift
- Kotlin:
.kt
- Dart:
.dart
- SQL:
.sql
- JSON:
.json
- YAML:
.yaml
,.yml
- TOML:
.toml
- XML:
.xml
-
Cyclomatic Complexity
- Measures code complexity based on control flow
- Lower scores indicate simpler, more maintainable code
- Target: < 10 for good maintainability
-
Documentation Coverage
- Percentage of documented functions and classes
- Higher scores indicate better documentation
- Target: > 70% for good documentation
-
Maintainability Index
- Composite metric of code maintainability
- Scale: 0-100 (higher is better)
- Ratings:
- ๐ข 85-100: Excellent
- ๐ก 65-84: Good
- ๐ 40-64: Fair
- ๐ด 0-39: Poor
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Rich library for beautiful CLI formatting
- COCOMO II model research papers
- Function Point Analysis methodology
Ayush
- GitHub: @Ayushx309
- Website: eternalbytes.in
- Location: Ahmedabad, Gujarat, India