Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
types: [opened, synchronize, reopened]

jobs:
test-and-lint:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -19,11 +19,10 @@ jobs:
with:
python-version: '3.13'

- name: Install dependencies
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install pytest ruff black
pip install -e . || pip install .
pip install ruff black

- name: Format check with black
run: |
Expand All @@ -33,10 +32,6 @@ jobs:
run: |
ruff check . || echo "Linting issues found (non-blocking)"

- name: Run tests
run: |
pytest tests/ -v --tb=short

documentation:
runs-on: ubuntu-latest
steps:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
Expand All @@ -32,6 +32,11 @@ jobs:
python -m pip install --upgrade pip
pip install -e ".[dev]" || pip install ".[dev]"

- name: Install multi-language support (Python < 3.13)
if: matrix.python-version != '3.13'
run: |
pip install -e ".[multilang]" || pip install ".[multilang]"

- name: Run tests
run: |
pytest tests/ -v --tb=short
Expand Down
63 changes: 62 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,66 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.2.1] - 2025-12-08

### Added
- **Advanced Code Complexity Metrics**
- Halstead complexity metrics (vocabulary, length, volume, difficulty, effort, time, bugs)
- Multi-language support for Halstead analysis via tree-sitter
- Python, JavaScript, TypeScript, Java, C, C++, C#, Go, Rust, PHP, Ruby, Swift
- Automated complexity analysis from code AST without user input
- Graceful fallback to Python AST when tree-sitter unavailable
- Support for calculating estimated bugs based on Halstead volume

- **Git Repository History Analysis**
- Commit count and contributor tracking
- Repository age calculation (days and years)
- Release/tag counting for maturity assessment
- Commit frequency analysis (commits per month)
- File churn detection (frequently modified files)
- Bus factor calculation (key contributor dependency)
- Average files changed per commit metric

- **Maintainability Index**
- Microsoft's Maintainability Index calculation (0-100 scale)
- Combines Halstead volume, cyclomatic complexity, LOC, and comment ratio
- Automatic classification (Low/Medium/High maintainability)
- Comment ratio tracking
- Complexity per KLOC calculation

- **Enhanced Cost Estimation**
- Maturity multiplier (1.0x - 2.5x) based on project age, contributors, and commits
- Halstead-based complexity multiplier (0.8x - 1.8x) based on code difficulty
- Improved confidence scoring incorporating all available metrics
- More accurate estimates for mature, large-scale projects

- **Testing**
- 50+ new unit tests for all analyzers
- Comprehensive git history analyzer tests (9 tests)
- Halstead complexity analyzer tests (15 tests)
- Multi-language test coverage (JavaScript, TypeScript, Java, Go, Rust)
- Language detection tests
- Multi-language directory analysis tests
- Maintainability calculator tests (10 tests)
- Enhanced multiplier tests (13 tests)
- End-to-end integration tests (4 tests)
- Total test suite: 94 tests, all passing

### Changed
- COCOMO II estimator now incorporates maturity and Halstead multipliers
- SLOCCount estimator updated with new multiplier support
- Cost estimates now include maturity_multiplier and halstead_multiplier fields
- Confidence scores adjusted to account for additional metrics
- Dependencies: Multi-language support (tree-sitter) now optional via `pip install ossval[multilang]`
- Available on Python 3.10-3.12 only (tree-sitter-languages doesn't support 3.13 yet)
- Python-only Halstead analysis still available on all Python versions via built-in AST
- Graceful fallback when tree-sitter not installed

### Improved
- More accurate cost estimates for mature projects with extensive history
- Better handling of complex codebases through Halstead metrics
- Realistic valuation for framework-level projects (e.g., ReactJS)

## [1.0.1] - 2025-11-29

### Added
Expand Down Expand Up @@ -98,5 +158,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Efficient SLOC counting with pygount
- Optimized repository URL discovery

[Unreleased]: https://github.com/SemClone/ossval/compare/v1.0.1...HEAD
[Unreleased]: https://github.com/SemClone/ossval/compare/v1.2.1...HEAD
[1.2.1]: https://github.com/SemClone/ossval/compare/v1.0.1...v1.2.1
[1.0.1]: https://github.com/SemClone/ossval/releases/tag/v1.0.1
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ossval"
version = "1.0.1"
version = "1.2.1"
description = "Open Source Software Valuation - Calculate development cost savings from OSS dependencies"
readme = "README.md"
requires-python = ">=3.10"
Expand All @@ -21,6 +21,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Quality Assurance",
]
Expand All @@ -39,6 +40,11 @@ dependencies = [
]

[project.optional-dependencies]
# Multi-language Halstead support (Python 3.10-3.12 only)
multilang = [
"tree-sitter>=0.21.0,<0.22.0; python_version < '3.13'",
"tree-sitter-languages>=1.10.0; python_version < '3.13'",
]
dev = [
"pytest>=7.0.0",
"pytest-asyncio>=0.21.0",
Expand Down
2 changes: 1 addition & 1 deletion src/ossval/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""OSSVAL: Open Source Software Valuation Tool."""

__version__ = "1.0.1"
__version__ = "1.2.1"

from ossval.core import analyze, parse_sbom, quick_estimate
from ossval.models import AnalysisConfig, AnalysisResult, Region, ProjectType
Expand Down
6 changes: 6 additions & 0 deletions src/ossval/analyzers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"""Code analysis modules."""

from ossval.analyzers.complexity import analyze_complexity, get_complexity_level
from ossval.analyzers.git_history import analyze_git_history
from ossval.analyzers.halstead import analyze_directory_halstead
from ossval.analyzers.health import analyze_health
from ossval.analyzers.maintainability import calculate_maintainability_index
from ossval.analyzers.repo_finder import find_repository_url
from ossval.analyzers.sloc import analyze_sloc

Expand All @@ -11,5 +14,8 @@
"analyze_complexity",
"get_complexity_level",
"analyze_health",
"analyze_git_history",
"analyze_directory_halstead",
"calculate_maintainability_index",
]

Loading