#command-line-tool #loc #cloc #scc #tokei #sloc

bin+lib cocomo

COCOMO (Constructive Cost Model) CLI utility and library

14 releases (6 breaking)

0.7.1 Jun 24, 2023
0.7.0 Jun 24, 2023
0.6.0 Jun 24, 2023
0.5.0 Jun 21, 2023
0.1.1 Jun 17, 2023

#1375 in Command line utilities

MIT license

17KB
240 lines

About

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.

Usage

$ 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]
      --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 [default: organic] [possible values: embedded, organic,
          semi-detached]
      --custom <f64,f64,f64>
          Custom parameters (a, b, c)
      --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]
  -h, --help
          Print help (see more with '--help')
  -V, --version
          Print version

Examples

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         1706         1706            0            0
 Shell                   1           49           38            1           10
 TOML                    3          125          104            5           16
-------------------------------------------------------------------------------
 HTML                    1           12            9            1            2
 |- JavaScript           1           15           11            4            0
 (Total)                             27           20            5            2
-------------------------------------------------------------------------------
 Markdown                5         1518            0         1211          307
 |- JSON                 1           47           47            0            0
 |- Rust                 1            7            4            3            0
 |- Shell                1           16           14            0            2
 (Total)                           1588           65         1214          309
-------------------------------------------------------------------------------
 Rust                   23         4385         3680          130          575
 |- Markdown            13          374            5          318           51
 (Total)                           4759         3685          448          626
===============================================================================
 Total                  38         7843         5567         1358          918
===============================================================================

Use cocomo CLI to calculate COCOMO estimates

$ cocomo ~/github.com/XAMPPRocky/tokei
Description                | Value
---------------------------|---------------------------------
Total Source Lines of Code | 5,567
Estimated Cost to Develop  | $163,886.77
Estimated Schedule Effort  | 6.92 months
Estimated People Required  | 2.10

Add -o sloccount to use the SLOCCount-style output format

$ cocomo ~/github.com/XAMPPRocky/tokei -o sloccount
Total Physical Source Lines of Code (SLOC)                    = 5,567
Development Effort Estimate, Person-Years (Person-Months)     = 1.21 (14.56)
  (Basic COCOMO model, Person-Months = 2.40*(KSLOC**1.05)*1.00)
Schedule Estimate, Years (Months)                             = 0.58 (6.92)
  (Basic COCOMO model, Months = 2.50*(person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule)      = 2.10
Total Estimated Cost to Develop                               = $163,887
  (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 5567
Description                | Value
---------------------------|---------------------------------
Total Source Lines of Code | 5,567
Estimated Cost to Develop  | $163,886.77
Estimated Schedule Effort  | 6.92 months
Estimated People Required  | 2.10

Dependencies

~13–25MB
~445K SLoC