New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

scnt

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scnt

Utility program/library for counting source code lines

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

SCNT - Source Count

NodeJS utility program for counting source code lines (aka. SLOC).

Running this program in a folder, will parse each file in the directory (or directories depending on usage) and attempt to count the number of lines, characters, white-space, and comments (both block and inline if the language supports it).

After parsing and counting is complete, it outputs a tabular report of the findings.

Installation

The preferred usage is to install it as a program, ideally globally.

npm install -g scnt
npm i -g scnt

yarn global add scnt

If you want to use it as a Node module, or in API mode, then install it locally.

npm install --save scnt
npm i -s scnt

yarn add scnt

Usage

scnt [options] [<file>|<directory>|<glob>...]

Running scnt with no options will execute with the default configuration. By default, this will parse the contents of the current working directory with the standard parsers.

Additional help is available using the -h or --help argument.

Available Options

ArgumentDescription
-v, --versionoutput the version number
-D, --debugextra output info when processing (default: false)
-i, --ignore-errorslogs IO errors but continues processing (default: false)
-e, --exclude <regex>excludes the files that match the regular expression, stackable with multiple usages (default: [])
-a, --alias <extension>=<extension>alias one extension for another, stackable with multiple usages (default: {})
-p, --parsers <parsers...>list of Parser IDs to use, defaults to all
-d, --default <parser>sets the default parser to use for unknowns by Parser ID (default is none, they are skipped)
-l, --list-parserslists the available parser id keys, only this will be performed if provided
--dry-rundoes not read any files, just outputs all the debug information up to that point
-h, --helpdisplay help for command

Available Parsers

Plain Text

ID: plain

Name: "Plain Text"

Supported extensions: .txt, .md

C-Family

ID: cfamily

Name: "C-Family"

Supported extensions: .c, .cpp, .cc, .cxx, .cs, .h, .hpp, .hx, .js, .mjs, .jsx, .ts, .tsx, .java, .kt, .kts, .ktm, .php, .php5, .m, .mm, .swift, .scala, .sc, .sass, .scss, .less, .go, .rs

Example output

This output is taken directly from running scnt in the root folder of this repository, with no options.

Searching paths for ./*...
Processing file C:/scnt/clean.js
Processing file C:/scnt/LICENSE
Processing file C:/scnt/package-lock.json
Processing file C:/scnt/package.json
Processing file C:/scnt/README.md
Processing file C:/scnt/tsconfig.json
Completed processing 2 files

┌────────────────────────────┬────┐
│ Total of All Lines         │ 83 │
├────────────────────────────┼────┤
│ Total Source Lines         │ 52 │
├────────────────────────────┼────┤
│ Source Only Lines          │ 51 │
├────────────────────────────┼────┤
│ Total Comment Lines        │ 5  │
├────────────────────────────┼────┤
│ Inline Comment Lines       │ 0  │
├────────────────────────────┼────┤
│ Block Comment Lines        │ 4  │
├────────────────────────────┼────┤
│ Mixes Source/Comment Lines │ 1  │
├────────────────────────────┼────┤
│ Whitespace Only Lines      │ 0  │
├────────────────────────────┼────┤
│ Empty Lines                │ 27 │
└────────────────────────────┴────┘

┌─────────────────────────┬──────┐
│ Total Characters        │ 3032 │
├─────────────────────────┼──────┤
│ Source Characters       │ 1959 │
├─────────────────────────┼──────┤
│ Comment Characters      │ 96   │
├─────────────────────────┼──────┤
│ Whitespace Characters   │ 994  │
├─────────────────────────┼──────┤
│ Numerical Characters    │ 1    │
├─────────────────────────┼──────┤
│ Alphabetical Characters │ 1555 │
├─────────────────────────┼──────┤
│ Special Characters      │ 482  │
└─────────────────────────┴──────┘

License

MIT License.

See file LICENSE for full details. Licensed under the MIT license.

Keywords

cli

FAQs

Package last updated on 03 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts