Skip to content

jsloccount 2.0.0

Choose a tag to compare

@bkarak bkarak released this 11 Sep 11:31
· 11 commits to master since this release

Modernized for Java 21, with the counting and reporting defects that
predated it fixed and coverage grown from 83 file types to 192.

Reports

  • the two CSV columns were crossed: -filestats.csv carried line counts
    under "File Count" and -sizestats.csv carried file counts under "Source
    Lines of Code"
  • fields are escaped per RFC 4180
  • binary resources no longer pad the size report with zeroes

Counting

  • multi-line block comments were counted as code beyond their opening line,
    and an inline /* */ counted its line as source twice
  • comment markers inside string literals opened comments, so a line holding
    "http://example.com" was reported as a comment
  • block comments nest where the language nests them: Rust, Swift, Scala,
    Kotlin, Dart, Haskell, OCaml, F#, Julia, and D's /+ +/
  • Fortran's marker matched nothing in any dialect; Haskell, Pascal and
    batch files were missing forms of theirs
  • Vim Script's " is read as a comment or a string by position and by
    whether it closes, rather than always as a comment
  • Lua long brackets are recognized at levels [[ through [===[

Interface

  • -o, -n, --stdout, -x, --include-hidden, -q, --list-languages, -h, -V
  • logging moved to standard error, so --stdout carries clean CSV
  • exit 0 on success, 1 for an unscannable directory, 2 for misuse

Coverage

  • 192 file types, text and binary, from 83
  • the most common unrecognized suffixes are reported after a scan

Documentation

  • the supported types are grouped into ten categories, derived from the enum
    so the list cannot drift, and printed the same way by --list-languages

Requires Java 21 or newer.