Skip to main content

haft stats

Display detailed code statistics for your Spring Boot project.

Usage

haft stats [flags]

Description

The stats command uses SCC (Sloc Cloc and Code) to analyze your codebase and provide detailed statistics including lines of code, comments, blank lines, and complexity metrics for each language in your project.

Flags

FlagDescription
--jsonOutput as JSON format
--cocomoInclude COCOMO cost estimates

Examples

# Show code statistics
haft stats

# Output as JSON
haft stats --json

# Include COCOMO cost estimates
haft stats --cocomo

# JSON with COCOMO
haft stats --json --cocomo

Output Columns

ColumnDescription
LanguageProgramming language detected
FilesNumber of files
LinesTotal lines (code + comments + blanks)
CodeLines of actual code
CommentsComment lines
BlanksEmpty/whitespace lines

Sample Output

  Code Statistics
─────────────────────────────────────────────────────────────────────────────────────
Language Files Lines Code Comments Blanks
─────────────────────────────────────────────────────────────────────────────────────
Java 19 534 378 0 156
XML 1 80 69 0 11
YAML 2 39 37 0 2
Properties File 1 3 3 0 0
─────────────────────────────────────────────────────────────────────────────────────
Total 23 656 487 0 169

Processed: 35.56 KB

COCOMO Estimates

With --cocomo flag, the command includes software cost estimates based on the COCOMO (Constructive Cost Model) methodology:

  COCOMO Estimates
─────────────────────────────────────────────────────────────────────────────────────
Estimated Cost: $24,608
Schedule Effort: 3.37 months
People Required: 0.65

COCOMO Metrics

MetricDescription
Estimated CostDevelopment cost estimate in USD
Schedule EffortEstimated development time in months
People RequiredAverage team size needed

Note: COCOMO estimates use industry-standard parameters and should be used as rough guidelines, not precise predictions.

JSON Output

With --json flag:

{
"languages": [
{
"name": "Java",
"files": 19,
"lines": 534,
"code": 378,
"comments": 0,
"blanks": 156,
"complexity": 18
},
{
"name": "XML",
"files": 1,
"lines": 80,
"code": 69,
"comments": 0,
"blanks": 11
}
],
"totalFiles": 20,
"totalLines": 614,
"totalCode": 447,
"totalComments": 0,
"totalBlanks": 167,
"totalBytes": 35560
}

With --json --cocomo:

{
"languages": [...],
"totalFiles": 20,
"totalLines": 614,
"totalCode": 447,
"totalComments": 0,
"totalBlanks": 167,
"totalBytes": 35560,
"estimatedCost": 24608.50,
"estimatedMonths": 3.37,
"estimatedPeople": 0.65
}

Excluded Directories

The following directories are automatically excluded from analysis:

  • .git
  • .svn
  • .hg
  • node_modules
  • target (Maven build output)
  • build (Gradle build output)
  • .gradle
  • .idea

Supported Languages

SCC supports 200+ programming languages. Common languages in Spring Boot projects:

  • Java
  • Kotlin
  • XML (pom.xml, configuration files)
  • YAML (application.yml)
  • Properties (application.properties)
  • SQL
  • HTML/CSS/JavaScript (if web resources present)

Quick Stats with haft info

For a quick lines of code summary without the full breakdown, use:

haft info --loc

This adds a condensed code statistics section to the project info output.

Use Cases

  • Track codebase growth over time
  • Estimate project complexity
  • Generate reports for stakeholders
  • Compare language distribution
  • Identify documentation coverage (comments ratio)

See Also