| Crates.io | cocomo |
| lib.rs | cocomo |
| version | 0.11.0 |
| created_at | 2023-06-17 13:43:08.850156+00 |
| updated_at | 2025-08-28 12:23:36.253666+00 |
| description | COCOMO (Constructive Cost Model) CLI utility and library |
| homepage | |
| repository | https://github.com/qtfkwk/cocomo |
| max_upload_size | |
| id | 892901 |
| size | 68,889 |
CLI and library implementation of COCOMO (Constructive Cost Model) estimates using tokei as a library to calculate total SLOC and scc as reference
See also tokei#359.
$ cocomo -h
COCOMO (Constructive Cost Model) CLI utility and library
<https://crates.io/crates/cocomo> / <https://github.com/qtfkwk/cocomo>
See also: <https://en.wikipedia.org/wiki/COCOMO>
---
Usage: cocomo [OPTIONS] [PATH]...
Arguments:
[PATH]... Files / Directories [default: .]
Options:
--sloc <N>
Source lines of code [default: *calculate from Files / Directories
argument(s)*]
--average-wage <f64>
Average Wage [default: 56286.0]
--inflation-multiplier <f64>
Inflation multiplier [default: 1.0]
--inflation-year <usize>
Inflation year (1995-2024) [default: 1995]
--overhead <f64>
Overhead [default: 2.4]
--eaf <f64>
Effort Adjustment Factor (EAF); typically 0.9 - 1.4 [default: 1.0]
--project-type <TYPE>
Project type (organic: "--custom 2.4,1.05,0.38", embedded: "--custom
3.6,1.20,0.32", semi-detached: "--custom 3.0,1.12,0.35") [default:
organic] [possible values: embedded, organic, semi-detached]
--custom <f64,f64,f64>
Custom parameters (a, b, c) [default: "2.4,1.05,0.38" ("--project-type
organic")]
--development-time <f64>
Development time (d) [default: 2.5]
--currency-symbol <STRING>
Currency symbol [default: $]
-o, --output-format <FORMAT>
Output format [default: markdown-table] [possible values:
markdown-table, sloccount, sloccount-inflation]
-h, --help
Print help (see more with '--help')
-V, --version
Print version
$ cocomo -V
cocomo 0.11.0
Use tokei CLI to count lines of code in a given directory
$ tokei ~/github.com/XAMPPRocky/tokei
===============================================================================
Language Files Lines Code Comments Blanks
===============================================================================
BASH 4 48 30 10 8
JSON 1 2050 2050 0 0
Shell 1 49 38 1 10
TOML 3 126 105 5 16
-------------------------------------------------------------------------------
HTML 1 12 9 1 2
|- JavaScript 1 15 11 4 0
(Total) 27 20 5 2
-------------------------------------------------------------------------------
Markdown 5 1720 0 1391 329
|- BASH 1 3 3 0 0
|- JSON 1 46 46 0 0
|- Rust 1 7 4 3 0
|- Shell 1 16 14 0 2
(Total) 1792 67 1394 331
-------------------------------------------------------------------------------
Rust 24 4578 3845 140 593
|- Markdown 14 394 5 335 54
(Total) 4972 3850 475 647
===============================================================================
Total 39 8583 6077 1548 958
===============================================================================
Use cocomo CLI to calculate COCOMO estimates
$ cocomo ~/github.com/XAMPPRocky/tokei
Description | Value
---------------------------|---------------------------------
Total Source Lines of Code | 6,077
Estimated Cost to Develop | $179,686.45
Estimated Schedule Effort | 7.16 months
Estimated People Required | 2.23
Add -o sloccount to use the SLOCCount-style output format
$ cocomo ~/github.com/XAMPPRocky/tokei -o sloccount
Total Physical Source Lines of Code (SLOC) = 6,077
Development Effort Estimate, Person-Years (Person-Months) = 1.33 (15.96)
(Basic COCOMO model, Person-Months = 2.40*(KSLOC**1.05)*1.00)
Schedule Estimate, Years (Months) = 0.60 (7.16)
(Basic COCOMO model, Months = 2.50*(person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 2.23
Total Estimated Cost to Develop = $179,686
(average salary = $56,286/year, overhead = 2.40)
Pass --sloc N to calculate COCOMO estimates for a given number of lines of
code (without counting SLOC in any files or directories)
$ cocomo --sloc 5794
Description | Value
---------------------------|---------------------------------
Total Source Lines of Code | 5,794
Estimated Cost to Develop | $170,910.62
Estimated Schedule Effort | 7.03 months
Estimated People Required | 2.16
--inflation-year option.
Note that any given year outside the range above causes cocomo to revert to
the inflation multiplier given via the --inflation-multiplier option which
is 1.0 by default and effectively represents the year 1995.